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