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