Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Side by Side Diff: content/browser/indexed_db/indexed_db_database.h

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Post dmurph review Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 20 matching lines...) Expand all
31 31
32 namespace content { 32 namespace content {
33 33
34 class IndexedDBBlobInfo; 34 class IndexedDBBlobInfo;
35 class IndexedDBConnection; 35 class IndexedDBConnection;
36 class IndexedDBDatabaseCallbacks; 36 class IndexedDBDatabaseCallbacks;
37 class IndexedDBFactory; 37 class IndexedDBFactory;
38 class IndexedDBKey; 38 class IndexedDBKey;
39 class IndexedDBKeyPath; 39 class IndexedDBKeyPath;
40 class IndexedDBKeyRange; 40 class IndexedDBKeyRange;
41 class IndexedDBObserver;
41 class IndexedDBTransaction; 42 class IndexedDBTransaction;
42 struct IndexedDBValue; 43 struct IndexedDBValue;
43 44
44 class CONTENT_EXPORT IndexedDBDatabase 45 class CONTENT_EXPORT IndexedDBDatabase
45 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { 46 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) {
46 public: 47 public:
47 // An index and corresponding set of keys 48 // An index and corresponding set of keys
48 using IndexKeys = std::pair<int64_t, std::vector<IndexedDBKey>>; 49 using IndexKeys = std::pair<int64_t, std::vector<IndexedDBKey>>;
49 50
50 // Identifier is pair of (origin, database name). 51 // Identifier is pair of (origin, database name).
51 using Identifier = std::pair<url::Origin, base::string16>; 52 using Identifier = std::pair<url::Origin, base::string16>;
52 53
54 std::map<int64_t, IndexedDBObserver*> active_observers_;
dmurph 2016/06/17 09:05:06 wrap IndexedDBObserver with std::unique_ptr
palakj1 2016/06/18 05:13:40 Done
55
53 static const int64_t kInvalidId = 0; 56 static const int64_t kInvalidId = 0;
54 static const int64_t kMinimumIndexId = 30; 57 static const int64_t kMinimumIndexId = 30;
55 58
56 static scoped_refptr<IndexedDBDatabase> Create( 59 static scoped_refptr<IndexedDBDatabase> Create(
57 const base::string16& name, 60 const base::string16& name,
58 IndexedDBBackingStore* backing_store, 61 IndexedDBBackingStore* backing_store,
59 IndexedDBFactory* factory, 62 IndexedDBFactory* factory,
60 const Identifier& unique_identifier, 63 const Identifier& unique_identifier,
61 leveldb::Status* s); 64 leveldb::Status* s);
62 65
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const IndexedDBTransactionCoordinator& transaction_coordinator() const { 120 const IndexedDBTransactionCoordinator& transaction_coordinator() const {
118 return transaction_coordinator_; 121 return transaction_coordinator_;
119 } 122 }
120 123
121 void TransactionCreated(IndexedDBTransaction* transaction); 124 void TransactionCreated(IndexedDBTransaction* transaction);
122 void TransactionFinished(IndexedDBTransaction* transaction, bool committed); 125 void TransactionFinished(IndexedDBTransaction* transaction, bool committed);
123 126
124 // Called by transactions to report failure committing to the backing store. 127 // Called by transactions to report failure committing to the backing store.
125 void TransactionCommitFailed(const leveldb::Status& status); 128 void TransactionCommitFailed(const leveldb::Status& status);
126 129
130 void Observe(int64_t transaction_id, int64_t observer_id);
131 void Unobserve(std::vector<int64_t> observersToRemove);
132
127 void Get(int64_t transaction_id, 133 void Get(int64_t transaction_id,
128 int64_t object_store_id, 134 int64_t object_store_id,
129 int64_t index_id, 135 int64_t index_id,
130 std::unique_ptr<IndexedDBKeyRange> key_range, 136 std::unique_ptr<IndexedDBKeyRange> key_range,
131 bool key_only, 137 bool key_only,
132 scoped_refptr<IndexedDBCallbacks> callbacks); 138 scoped_refptr<IndexedDBCallbacks> callbacks);
133 void GetAll(int64_t transaction_id, 139 void GetAll(int64_t transaction_id,
134 int64_t object_store_id, 140 int64_t object_store_id,
135 int64_t index_id, 141 int64_t index_id,
136 std::unique_ptr<IndexedDBKeyRange> key_range, 142 std::unique_ptr<IndexedDBKeyRange> key_range,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 318
313 ConnectionSet connections_; 319 ConnectionSet connections_;
314 bool experimental_web_platform_features_enabled_; 320 bool experimental_web_platform_features_enabled_;
315 321
316 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); 322 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase);
317 }; 323 };
318 324
319 } // namespace content 325 } // namespace content
320 326
321 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ 327 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_database.cc » ('j') | content/browser/indexed_db/indexed_db_database.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698