OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FAKE_BACKING_STORE_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 10 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class TaskRunner; | 13 class TaskRunner; |
14 } | 14 } |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 class IndexedDBFactory; | 18 class IndexedDBFactory; |
19 | 19 |
20 class IndexedDBFakeBackingStore : public IndexedDBBackingStore { | 20 class IndexedDBFakeBackingStore : public IndexedDBBackingStore { |
21 public: | 21 public: |
22 IndexedDBFakeBackingStore(); | 22 IndexedDBFakeBackingStore(); |
23 IndexedDBFakeBackingStore(IndexedDBFactory* factory, | 23 IndexedDBFakeBackingStore(IndexedDBFactory* factory, |
24 base::TaskRunner* task_runner); | 24 base::TaskRunner* task_runner); |
25 virtual std::vector<base::string16> GetDatabaseNames() OVERRIDE; | 25 virtual std::vector<base::string16> GetDatabaseNames(leveldb::Status& s) |
| 26 OVERRIDE; |
26 virtual leveldb::Status GetIDBDatabaseMetaData(const base::string16& name, | 27 virtual leveldb::Status GetIDBDatabaseMetaData(const base::string16& name, |
27 IndexedDBDatabaseMetadata*, | 28 IndexedDBDatabaseMetadata*, |
28 bool* found) OVERRIDE; | 29 bool* found) OVERRIDE; |
29 virtual leveldb::Status CreateIDBDatabaseMetaData( | 30 virtual leveldb::Status CreateIDBDatabaseMetaData( |
30 const base::string16& name, | 31 const base::string16& name, |
31 const base::string16& version, | 32 const base::string16& version, |
32 int64 int_version, | 33 int64 int_version, |
33 int64* row_id) OVERRIDE; | 34 int64* row_id) OVERRIDE; |
34 virtual bool UpdateIDBDatabaseIntVersion(Transaction*, | 35 virtual bool UpdateIDBDatabaseIntVersion(Transaction*, |
35 int64 row_id, | 36 int64 row_id, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 const IndexedDBKey&, | 89 const IndexedDBKey&, |
89 const RecordIdentifier&) | 90 const RecordIdentifier&) |
90 OVERRIDE; | 91 OVERRIDE; |
91 virtual void ReportBlobUnused(int64 database_id, int64 blob_key) OVERRIDE; | 92 virtual void ReportBlobUnused(int64 database_id, int64 blob_key) OVERRIDE; |
92 | 93 |
93 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor( | 94 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor( |
94 Transaction* transaction, | 95 Transaction* transaction, |
95 int64 database_id, | 96 int64 database_id, |
96 int64 object_store_id, | 97 int64 object_store_id, |
97 const IndexedDBKeyRange& key_range, | 98 const IndexedDBKeyRange& key_range, |
98 indexed_db::CursorDirection) OVERRIDE; | 99 indexed_db::CursorDirection, |
| 100 leveldb::Status&) OVERRIDE; |
99 virtual scoped_ptr<Cursor> OpenObjectStoreCursor( | 101 virtual scoped_ptr<Cursor> OpenObjectStoreCursor( |
100 Transaction* transaction, | 102 Transaction* transaction, |
101 int64 database_id, | 103 int64 database_id, |
102 int64 object_store_id, | 104 int64 object_store_id, |
103 const IndexedDBKeyRange& key_range, | 105 const IndexedDBKeyRange& key_range, |
104 indexed_db::CursorDirection) OVERRIDE; | 106 indexed_db::CursorDirection, |
| 107 leveldb::Status&) OVERRIDE; |
105 virtual scoped_ptr<Cursor> OpenIndexKeyCursor( | 108 virtual scoped_ptr<Cursor> OpenIndexKeyCursor( |
106 Transaction* transaction, | 109 Transaction* transaction, |
107 int64 database_id, | 110 int64 database_id, |
108 int64 object_store_id, | 111 int64 object_store_id, |
109 int64 index_id, | 112 int64 index_id, |
110 const IndexedDBKeyRange& key_range, | 113 const IndexedDBKeyRange& key_range, |
111 indexed_db::CursorDirection) OVERRIDE; | 114 indexed_db::CursorDirection, |
| 115 leveldb::Status&) OVERRIDE; |
112 virtual scoped_ptr<Cursor> OpenIndexCursor(Transaction* transaction, | 116 virtual scoped_ptr<Cursor> OpenIndexCursor(Transaction* transaction, |
113 int64 database_id, | 117 int64 database_id, |
114 int64 object_store_id, | 118 int64 object_store_id, |
115 int64 index_id, | 119 int64 index_id, |
116 const IndexedDBKeyRange& key_range, | 120 const IndexedDBKeyRange& key_range, |
117 indexed_db::CursorDirection) | 121 indexed_db::CursorDirection, |
118 OVERRIDE; | 122 leveldb::Status&) OVERRIDE; |
119 | 123 |
120 class FakeTransaction : public IndexedDBBackingStore::Transaction { | 124 class FakeTransaction : public IndexedDBBackingStore::Transaction { |
121 public: | 125 public: |
122 FakeTransaction(bool result); | 126 FakeTransaction(bool result); |
123 virtual void Begin() OVERRIDE; | 127 virtual void Begin() OVERRIDE; |
124 virtual leveldb::Status Commit() OVERRIDE; | 128 virtual leveldb::Status Commit() OVERRIDE; |
125 virtual void Rollback() OVERRIDE; | 129 virtual void Rollback() OVERRIDE; |
126 | 130 |
127 private: | 131 private: |
128 bool result_; | 132 bool result_; |
129 }; | 133 }; |
130 | 134 |
131 protected: | 135 protected: |
132 friend class base::RefCounted<IndexedDBFakeBackingStore>; | 136 friend class base::RefCounted<IndexedDBFakeBackingStore>; |
133 virtual ~IndexedDBFakeBackingStore(); | 137 virtual ~IndexedDBFakeBackingStore(); |
134 }; | 138 }; |
135 | 139 |
136 } // namespace content | 140 } // namespace content |
137 | 141 |
138 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_ | 142 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FAKE_BACKING_STORE_H_ |
OLD | NEW |