| 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 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 class CONTENT_EXPORT IndexedDBDatabase | 45 class CONTENT_EXPORT IndexedDBDatabase |
| 46 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { | 46 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { |
| 47 public: | 47 public: |
| 48 // An index and corresponding set of keys | 48 // An index and corresponding set of keys |
| 49 using IndexKeys = std::pair<int64_t, std::vector<IndexedDBKey>>; | 49 using IndexKeys = std::pair<int64_t, std::vector<IndexedDBKey>>; |
| 50 | 50 |
| 51 // Identifier is pair of (origin, database name). | 51 // Identifier is pair of (origin, database name). |
| 52 using Identifier = std::pair<url::Origin, base::string16>; | 52 using Identifier = std::pair<url::Origin, base::string16>; |
| 53 | 53 |
| 54 std::vector<std::unique_ptr<IndexedDBObserver>> active_observers_; | 54 std::map<int64_t, IndexedDBObserver*> active_observers_; |
| 55 | 55 |
| 56 static const int64_t kInvalidId = 0; | 56 static const int64_t kInvalidId = 0; |
| 57 static const int64_t kMinimumIndexId = 30; | 57 static const int64_t kMinimumIndexId = 30; |
| 58 | 58 |
| 59 static scoped_refptr<IndexedDBDatabase> Create( | 59 static scoped_refptr<IndexedDBDatabase> Create( |
| 60 const base::string16& name, | 60 const base::string16& name, |
| 61 IndexedDBBackingStore* backing_store, | 61 IndexedDBBackingStore* backing_store, |
| 62 IndexedDBFactory* factory, | 62 IndexedDBFactory* factory, |
| 63 const Identifier& unique_identifier, | 63 const Identifier& unique_identifier, |
| 64 leveldb::Status* s); | 64 leveldb::Status* s); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 return transaction_coordinator_; | 121 return transaction_coordinator_; |
| 122 } | 122 } |
| 123 | 123 |
| 124 void TransactionCreated(IndexedDBTransaction* transaction); | 124 void TransactionCreated(IndexedDBTransaction* transaction); |
| 125 void TransactionFinished(IndexedDBTransaction* transaction, bool committed); | 125 void TransactionFinished(IndexedDBTransaction* transaction, bool committed); |
| 126 | 126 |
| 127 // Called by transactions to report failure committing to the backing store. | 127 // Called by transactions to report failure committing to the backing store. |
| 128 void TransactionCommitFailed(const leveldb::Status& status); | 128 void TransactionCommitFailed(const leveldb::Status& status); |
| 129 | 129 |
| 130 void Observe(int64_t transaction_id, int64_t observer_id); | 130 void Observe(int64_t transaction_id, int64_t observer_id); |
| 131 void Unobserve(std::vector<int64_t> observersToRemove); |
| 131 | 132 |
| 132 void Get(int64_t transaction_id, | 133 void Get(int64_t transaction_id, |
| 133 int64_t object_store_id, | 134 int64_t object_store_id, |
| 134 int64_t index_id, | 135 int64_t index_id, |
| 135 std::unique_ptr<IndexedDBKeyRange> key_range, | 136 std::unique_ptr<IndexedDBKeyRange> key_range, |
| 136 bool key_only, | 137 bool key_only, |
| 137 scoped_refptr<IndexedDBCallbacks> callbacks); | 138 scoped_refptr<IndexedDBCallbacks> callbacks); |
| 138 void GetAll(int64_t transaction_id, | 139 void GetAll(int64_t transaction_id, |
| 139 int64_t object_store_id, | 140 int64_t object_store_id, |
| 140 int64_t index_id, | 141 int64_t index_id, |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 318 |
| 318 ConnectionSet connections_; | 319 ConnectionSet connections_; |
| 319 bool experimental_web_platform_features_enabled_; | 320 bool experimental_web_platform_features_enabled_; |
| 320 | 321 |
| 321 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); | 322 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); |
| 322 }; | 323 }; |
| 323 | 324 |
| 324 } // namespace content | 325 } // namespace content |
| 325 | 326 |
| 326 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 327 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| OLD | NEW |