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