OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <list> | 11 #include <list> |
12 #include <map> | 12 #include <map> |
13 #include <memory> | 13 #include <memory> |
14 #include <queue> | 14 #include <queue> |
15 #include <string> | 15 #include <string> |
16 #include <utility> | 16 #include <utility> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
21 #include "content/browser/indexed_db/indexed_db.h" | 21 #include "content/browser/indexed_db/indexed_db.h" |
22 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 22 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
23 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 23 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
24 #include "content/browser/indexed_db/indexed_db_metadata.h" | 24 #include "content/browser/indexed_db/indexed_db_metadata.h" |
| 25 #include "content/browser/indexed_db/indexed_db_observer.h" |
25 #include "content/browser/indexed_db/indexed_db_pending_connection.h" | 26 #include "content/browser/indexed_db/indexed_db_pending_connection.h" |
26 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 27 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
27 #include "content/browser/indexed_db/list_set.h" | 28 #include "content/browser/indexed_db/list_set.h" |
28 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 29 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
29 | 30 |
30 namespace url { | 31 namespace url { |
31 class Origin; | 32 class Origin; |
32 } | 33 } |
33 | 34 |
34 namespace content { | 35 namespace content { |
35 | 36 |
36 class IndexedDBBlobInfo; | 37 class IndexedDBBlobInfo; |
37 class IndexedDBConnection; | 38 class IndexedDBConnection; |
38 class IndexedDBDatabaseCallbacks; | 39 class IndexedDBDatabaseCallbacks; |
39 class IndexedDBFactory; | 40 class IndexedDBFactory; |
40 class IndexedDBKey; | 41 class IndexedDBKey; |
41 class IndexedDBKeyPath; | 42 class IndexedDBKeyPath; |
42 class IndexedDBKeyRange; | 43 class IndexedDBKeyRange; |
| 44 class IndexedDBObservation; |
| 45 class IndexedDBObserverChanges; |
43 class IndexedDBTransaction; | 46 class IndexedDBTransaction; |
44 struct IndexedDBValue; | 47 struct IndexedDBValue; |
45 | 48 |
46 class CONTENT_EXPORT IndexedDBDatabase | 49 class CONTENT_EXPORT IndexedDBDatabase |
47 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { | 50 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { |
48 public: | 51 public: |
49 // An index and corresponding set of keys | 52 // An index and corresponding set of keys |
50 using IndexKeys = std::pair<int64_t, std::vector<IndexedDBKey>>; | 53 using IndexKeys = std::pair<int64_t, std::vector<IndexedDBKey>>; |
51 | 54 |
52 // Identifier is pair of (origin, database name). | 55 // Identifier is pair of (origin, database name). |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const IndexedDBTransactionCoordinator& transaction_coordinator() const { | 123 const IndexedDBTransactionCoordinator& transaction_coordinator() const { |
121 return transaction_coordinator_; | 124 return transaction_coordinator_; |
122 } | 125 } |
123 | 126 |
124 void TransactionCreated(IndexedDBTransaction* transaction); | 127 void TransactionCreated(IndexedDBTransaction* transaction); |
125 void TransactionFinished(IndexedDBTransaction* transaction, bool committed); | 128 void TransactionFinished(IndexedDBTransaction* transaction, bool committed); |
126 | 129 |
127 // Called by transactions to report failure committing to the backing store. | 130 // Called by transactions to report failure committing to the backing store. |
128 void TransactionCommitFailed(const leveldb::Status& status); | 131 void TransactionCommitFailed(const leveldb::Status& status); |
129 | 132 |
130 void AddPendingObserver(int64_t transaction_id, int32_t observer_id); | 133 void AddPendingObserver(int64_t transaction_id, |
| 134 int32_t observer_id, |
| 135 const IndexedDBObserver::Options& options); |
131 void RemovePendingObservers(IndexedDBConnection* connection, | 136 void RemovePendingObservers(IndexedDBConnection* connection, |
132 const std::vector<int32_t>& pending_observer_ids); | 137 const std::vector<int32_t>& pending_observer_ids); |
133 | 138 |
| 139 void FilterObservation(IndexedDBTransaction*, |
| 140 int64_t object_store_id, |
| 141 blink::WebIDBOperationType type, |
| 142 const IndexedDBKeyRange& key_range); |
| 143 void SendObservations( |
| 144 std::map<int32_t, std::unique_ptr<IndexedDBObserverChanges>> change_map); |
| 145 |
134 void Get(int64_t transaction_id, | 146 void Get(int64_t transaction_id, |
135 int64_t object_store_id, | 147 int64_t object_store_id, |
136 int64_t index_id, | 148 int64_t index_id, |
137 std::unique_ptr<IndexedDBKeyRange> key_range, | 149 std::unique_ptr<IndexedDBKeyRange> key_range, |
138 bool key_only, | 150 bool key_only, |
139 scoped_refptr<IndexedDBCallbacks> callbacks); | 151 scoped_refptr<IndexedDBCallbacks> callbacks); |
140 void GetAll(int64_t transaction_id, | 152 void GetAll(int64_t transaction_id, |
141 int64_t object_store_id, | 153 int64_t object_store_id, |
142 int64_t index_id, | 154 int64_t index_id, |
143 std::unique_ptr<IndexedDBKeyRange> key_range, | 155 std::unique_ptr<IndexedDBKeyRange> key_range, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 bool processing_pending_requests_ = false; | 332 bool processing_pending_requests_ = false; |
321 | 333 |
322 bool experimental_web_platform_features_enabled_; | 334 bool experimental_web_platform_features_enabled_; |
323 | 335 |
324 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); | 336 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); |
325 }; | 337 }; |
326 | 338 |
327 } // namespace content | 339 } // namespace content |
328 | 340 |
329 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 341 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
OLD | NEW |