| 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 "base/memory/ref_counted.h" |
| 15 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 15 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 16 #include "content/browser/indexed_db/indexed_db_database.h" | 16 #include "content/browser/indexed_db/indexed_db_database.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 18 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
| 19 | 19 |
| 20 namespace leveldb { | 20 namespace leveldb { |
| 21 class Iterator; | 21 class Iterator; |
| 22 class Snapshot; |
| 22 } // namespace leveldb | 23 } // namespace leveldb |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 | 26 |
| 26 class IndexedDBBackingStore; | 27 class IndexedDBBackingStore; |
| 27 class IndexedDBConnection; | 28 class IndexedDBConnection; |
| 28 class IndexedDBFactory; | 29 class IndexedDBFactory; |
| 29 class IndexedDBTransaction; | 30 class IndexedDBTransaction; |
| 30 class LevelDBDatabase; | 31 class LevelDBDatabase; |
| 31 class LevelDBIteratorImpl; | 32 class LevelDBIteratorImpl; |
| 33 class LevelDBIteratorPoolController; |
| 32 class LevelDBTransaction; | 34 class LevelDBTransaction; |
| 33 | 35 |
| 34 // Use this factory to create some IndexedDB objects. Exists solely to | 36 // Use this factory to create some IndexedDB objects. Exists solely to |
| 35 // facilitate tests which sometimes need to inject mock objects into the system. | 37 // facilitate tests which sometimes need to inject mock objects into the system. |
| 36 class CONTENT_EXPORT IndexedDBClassFactory { | 38 class CONTENT_EXPORT IndexedDBClassFactory { |
| 37 public: | 39 public: |
| 38 typedef IndexedDBClassFactory* GetterCallback(); | 40 typedef IndexedDBClassFactory* GetterCallback(); |
| 39 | 41 |
| 40 static IndexedDBClassFactory* Get(); | 42 static IndexedDBClassFactory* Get(); |
| 41 | 43 |
| 42 static void SetIndexedDBClassFactoryGetter(GetterCallback* cb); | 44 static void SetIndexedDBClassFactoryGetter(GetterCallback* cb); |
| 43 | 45 |
| 44 virtual scoped_refptr<IndexedDBDatabase> CreateIndexedDBDatabase( | 46 virtual scoped_refptr<IndexedDBDatabase> CreateIndexedDBDatabase( |
| 45 const base::string16& name, | 47 const base::string16& name, |
| 46 scoped_refptr<IndexedDBBackingStore> backing_store, | 48 scoped_refptr<IndexedDBBackingStore> backing_store, |
| 47 scoped_refptr<IndexedDBFactory> factory, | 49 scoped_refptr<IndexedDBFactory> factory, |
| 48 const IndexedDBDatabase::Identifier& unique_identifier); | 50 const IndexedDBDatabase::Identifier& unique_identifier); |
| 49 | 51 |
| 50 virtual std::unique_ptr<IndexedDBTransaction> CreateIndexedDBTransaction( | 52 virtual std::unique_ptr<IndexedDBTransaction> CreateIndexedDBTransaction( |
| 51 int64_t id, | 53 int64_t id, |
| 52 IndexedDBConnection* connection, | 54 IndexedDBConnection* connection, |
| 53 const std::set<int64_t>& scope, | 55 const std::set<int64_t>& scope, |
| 54 blink::WebIDBTransactionMode mode, | 56 blink::WebIDBTransactionMode mode, |
| 55 IndexedDBBackingStore::Transaction* backing_store_transaction); | 57 IndexedDBBackingStore::Transaction* backing_store_transaction); |
| 56 | 58 |
| 57 virtual std::unique_ptr<LevelDBIteratorImpl> CreateIteratorImpl( | 59 virtual std::unique_ptr<LevelDBIteratorImpl> CreateIteratorImpl( |
| 58 std::unique_ptr<leveldb::Iterator> iterator); | 60 std::unique_ptr<leveldb::Iterator> iterator, |
| 61 LevelDBIteratorPoolController* pool_controller, |
| 62 const leveldb::Snapshot* snapshot); |
| 59 | 63 |
| 60 virtual scoped_refptr<LevelDBTransaction> CreateLevelDBTransaction( | 64 virtual scoped_refptr<LevelDBTransaction> CreateLevelDBTransaction( |
| 61 LevelDBDatabase* db); | 65 LevelDBDatabase* db); |
| 62 | 66 |
| 63 protected: | 67 protected: |
| 64 IndexedDBClassFactory() {} | 68 IndexedDBClassFactory() {} |
| 65 virtual ~IndexedDBClassFactory() {} | 69 virtual ~IndexedDBClassFactory() {} |
| 66 friend struct base::LazyInstanceTraitsBase<IndexedDBClassFactory>; | 70 friend struct base::LazyInstanceTraitsBase<IndexedDBClassFactory>; |
| 67 }; | 71 }; |
| 68 | 72 |
| 69 } // namespace content | 73 } // namespace content |
| 70 | 74 |
| 71 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_ | 75 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CLASS_FACTORY_H_ |
| OLD | NEW |