| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/memory/ref_counted.h" |
| 14 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 15 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 15 #include "content/browser/indexed_db/indexed_db_database.h" | 16 #include "content/browser/indexed_db/indexed_db_database.h" |
| 16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 17 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 18 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
| 18 | 19 |
| 19 namespace leveldb { | 20 namespace leveldb { |
| 20 class Iterator; | 21 class Iterator; |
| 21 } // namespace leveldb | 22 } // namespace leveldb |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 // Use this factory to create some IndexedDB objects. Exists solely to | 35 // Use this factory to create some IndexedDB objects. Exists solely to |
| 35 // facilitate tests which sometimes need to inject mock objects into the system. | 36 // facilitate tests which sometimes need to inject mock objects into the system. |
| 36 class CONTENT_EXPORT IndexedDBClassFactory { | 37 class CONTENT_EXPORT IndexedDBClassFactory { |
| 37 public: | 38 public: |
| 38 typedef IndexedDBClassFactory* GetterCallback(); | 39 typedef IndexedDBClassFactory* GetterCallback(); |
| 39 | 40 |
| 40 static IndexedDBClassFactory* Get(); | 41 static IndexedDBClassFactory* Get(); |
| 41 | 42 |
| 42 static void SetIndexedDBClassFactoryGetter(GetterCallback* cb); | 43 static void SetIndexedDBClassFactoryGetter(GetterCallback* cb); |
| 43 | 44 |
| 44 virtual IndexedDBDatabase* CreateIndexedDBDatabase( | 45 virtual scoped_refptr<IndexedDBDatabase> CreateIndexedDBDatabase( |
| 45 const base::string16& name, | 46 const base::string16& name, |
| 46 IndexedDBBackingStore* backing_store, | 47 IndexedDBBackingStore* backing_store, |
| 47 IndexedDBFactory* factory, | 48 IndexedDBFactory* factory, |
| 48 const IndexedDBDatabase::Identifier& unique_identifier); | 49 const IndexedDBDatabase::Identifier& unique_identifier); |
| 49 | 50 |
| 50 virtual IndexedDBTransaction* CreateIndexedDBTransaction( | 51 virtual IndexedDBTransaction* CreateIndexedDBTransaction( |
| 51 int64_t id, | 52 int64_t id, |
| 52 base::WeakPtr<IndexedDBConnection> connection, | 53 base::WeakPtr<IndexedDBConnection> connection, |
| 53 const std::set<int64_t>& scope, | 54 const std::set<int64_t>& scope, |
| 54 blink::WebIDBTransactionMode mode, | 55 blink::WebIDBTransactionMode mode, |
| 55 IndexedDBBackingStore::Transaction* backing_store_transaction); | 56 IndexedDBBackingStore::Transaction* backing_store_transaction); |
| 56 | 57 |
| 57 virtual LevelDBIteratorImpl* CreateIteratorImpl( | 58 virtual std::unique_ptr<LevelDBIteratorImpl> CreateIteratorImpl( |
| 58 std::unique_ptr<leveldb::Iterator> iterator); | 59 std::unique_ptr<leveldb::Iterator> iterator); |
| 59 virtual LevelDBTransaction* CreateLevelDBTransaction(LevelDBDatabase* db); | 60 |
| 61 virtual scoped_refptr<LevelDBTransaction> CreateLevelDBTransaction( |
| 62 LevelDBDatabase* db); |
| 60 | 63 |
| 61 protected: | 64 protected: |
| 62 IndexedDBClassFactory() {} | 65 IndexedDBClassFactory() {} |
| 63 virtual ~IndexedDBClassFactory() {} | 66 virtual ~IndexedDBClassFactory() {} |
| 64 friend struct base::DefaultLazyInstanceTraits<IndexedDBClassFactory>; | 67 friend struct base::DefaultLazyInstanceTraits<IndexedDBClassFactory>; |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 } // namespace content | 70 } // namespace content |
| 68 | 71 |
| 69 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_ | 72 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_ |
| OLD | NEW |