1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/indexed_db/indexed_db_class_factory.h"
6 #include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h"
7 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h"
11 static IndexedDBClassFactory::GetterCallback
* s_factory_getter
;
12 static ::base::LazyInstance
<IndexedDBClassFactory
>::Leaky s_factory
=
13 LAZY_INSTANCE_INITIALIZER
;
15 void IndexedDBClassFactory::SetIndexedDBClassFactoryGetter(GetterCallback
* cb
) {
16 s_factory_getter
= cb
;
19 IndexedDBClassFactory
* IndexedDBClassFactory::Get() {
21 return (*s_factory_getter
)();
23 return s_factory
.Pointer();
26 LevelDBTransaction
* IndexedDBClassFactory::CreateLevelDBTransaction(
27 LevelDBDatabase
* db
) {
28 return new LevelDBTransaction(db
);
31 content::LevelDBIteratorImpl
* IndexedDBClassFactory::CreateIteratorImpl(
32 scoped_ptr
<leveldb::Iterator
> iterator
) {
33 return new LevelDBIteratorImpl(iterator
.Pass());
36 } // namespace content