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

Side by Side Diff: content/child/indexed_db/webidbdatabase_impl.h

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Observer addition and removal Created 4 years, 5 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 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_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ 5 #ifndef CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_
6 #define CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ 6 #define CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBCursor.h" 11 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBCursor.h"
12 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabase.h" 12 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabase.h"
13 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" 13 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h"
14 14
15 namespace blink { 15 namespace blink {
16 class WebBlobInfo; 16 class WebBlobInfo;
17 class WebIDBCallbacks; 17 class WebIDBCallbacks;
18 class WebIDBDatabaseCallbacks; 18 class WebIDBDatabaseCallbacks;
19 class WebIDBObserver;
19 class WebString; 20 class WebString;
20 } 21 }
21 22
22 namespace content { 23 namespace content {
23 class ThreadSafeSender; 24 class ThreadSafeSender;
24 25
25 class WebIDBDatabaseImpl : public blink::WebIDBDatabase { 26 class WebIDBDatabaseImpl : public blink::WebIDBDatabase {
26 public: 27 public:
27 WebIDBDatabaseImpl(int32_t ipc_database_id, 28 WebIDBDatabaseImpl(int32_t ipc_database_id,
28 int32_t ipc_database_callbacks_id, 29 int32_t ipc_database_callbacks_id,
29 ThreadSafeSender* thread_safe_sender); 30 ThreadSafeSender* thread_safe_sender);
30 ~WebIDBDatabaseImpl() override; 31 ~WebIDBDatabaseImpl() override;
31 32
32 // blink::WebIDBDatabase 33 // blink::WebIDBDatabase
33 void createObjectStore(long long transaction_id, 34 void createObjectStore(long long transaction_id,
34 long long objectstore_id, 35 long long objectstore_id,
35 const blink::WebString& name, 36 const blink::WebString& name,
36 const blink::WebIDBKeyPath& key_path, 37 const blink::WebIDBKeyPath& key_path,
37 bool auto_increment) override; 38 bool auto_increment) override;
38 void deleteObjectStore(long long transaction_id, 39 void deleteObjectStore(long long transaction_id,
39 long long object_store_id) override; 40 long long object_store_id) override;
40 void createTransaction(long long transaction_id, 41 void createTransaction(long long transaction_id,
41 blink::WebIDBDatabaseCallbacks* callbacks, 42 blink::WebIDBDatabaseCallbacks* callbacks,
42 const blink::WebVector<long long>& scope, 43 const blink::WebVector<long long>& scope,
43 blink::WebIDBTransactionMode mode) override; 44 blink::WebIDBTransactionMode mode) override;
44 45
45 void close() override; 46 void close() override;
46 void versionChangeIgnored() override; 47 void versionChangeIgnored() override;
47 48
49 int32_t addObserver(blink::WebIDBObserver*, long long transactionId) override;
50 // returns true if the element has been removed from the set.
dmurph 2016/06/27 21:20:51 Please capitalize the sentence (all comments shoul
palakj1 2016/06/27 23:13:08 Done.
51 bool removeObserverId(int32_t id) override;
52 void removeObservers(
53 const std::vector<int32_t>& observer_ids_to_remove) override;
54
48 void get(long long transactionId, 55 void get(long long transactionId,
49 long long objectStoreId, 56 long long objectStoreId,
50 long long indexId, 57 long long indexId,
51 const blink::WebIDBKeyRange&, 58 const blink::WebIDBKeyRange&,
52 bool keyOnly, 59 bool keyOnly,
53 blink::WebIDBCallbacks*) override; 60 blink::WebIDBCallbacks*) override;
54 void getAll(long long transactionId, 61 void getAll(long long transactionId,
55 long long objectStoreId, 62 long long objectStoreId,
56 long long indexId, 63 long long indexId,
57 const blink::WebIDBKeyRange&, 64 const blink::WebIDBKeyRange&,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 long long objectStoreId, 113 long long objectStoreId,
107 long long indexId) override; 114 long long indexId) override;
108 void abort(long long transaction_id) override; 115 void abort(long long transaction_id) override;
109 void commit(long long transaction_id) override; 116 void commit(long long transaction_id) override;
110 void ackReceivedBlobs( 117 void ackReceivedBlobs(
111 const blink::WebVector<blink::WebString>& uuids) override; 118 const blink::WebVector<blink::WebString>& uuids) override;
112 119
113 private: 120 private:
114 int32_t ipc_database_id_; 121 int32_t ipc_database_id_;
115 int32_t ipc_database_callbacks_id_; 122 int32_t ipc_database_callbacks_id_;
123 std::set<int32_t> observer_ids_;
116 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 124 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
117 }; 125 };
118 126
119 } // namespace content 127 } // namespace content
120 128
121 #endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ 129 #endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698