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

Side by Side Diff: content/browser/indexed_db/indexed_db_dispatcher_host.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params); 167 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params);
168 void OnDeleteObjectStore(int32_t ipc_database_id, 168 void OnDeleteObjectStore(int32_t ipc_database_id,
169 int64_t transaction_id, 169 int64_t transaction_id,
170 int64_t object_store_id); 170 int64_t object_store_id);
171 void OnCreateTransaction( 171 void OnCreateTransaction(
172 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); 172 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&);
173 void OnClose(int32_t ipc_database_id); 173 void OnClose(int32_t ipc_database_id);
174 void OnVersionChangeIgnored(int32_t ipc_database_id); 174 void OnVersionChangeIgnored(int32_t ipc_database_id);
175 void OnDestroyed(int32_t ipc_database_id); 175 void OnDestroyed(int32_t ipc_database_id);
176 176
177 void OnObserve(int32_t ipc_thread_id,
178 int32_t ipc_database_id,
179 int64_t transaction_id,
180 int32_t observer_id);
181 void OnUnobserve(int32_t ipc_thread_id,
182 int32_t ipc_database_id,
183 std::vector<int32_t> remove_observers);
177 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); 184 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params);
178 void OnGetAll(const IndexedDBHostMsg_DatabaseGetAll_Params& params); 185 void OnGetAll(const IndexedDBHostMsg_DatabaseGetAll_Params& params);
179 // OnPutWrapper starts on the IO thread so that it can grab BlobDataHandles 186 // OnPutWrapper starts on the IO thread so that it can grab BlobDataHandles
180 // before posting to the IDB TaskRunner for the rest of the job. 187 // before posting to the IDB TaskRunner for the rest of the job.
181 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params); 188 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params);
182 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params, 189 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params,
183 std::vector<storage::BlobDataHandle*> handles); 190 std::vector<storage::BlobDataHandle*> handles);
184 void OnSetIndexKeys( 191 void OnSetIndexKeys(
185 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); 192 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params);
186 void OnSetIndexesReady(int32_t ipc_database_id, 193 void OnSetIndexesReady(int32_t ipc_database_id,
(...skipping 16 matching lines...) Expand all
203 int64_t object_store_id, 210 int64_t object_store_id,
204 int64_t index_id); 211 int64_t index_id);
205 212
206 void OnAbort(int32_t ipc_database_id, int64_t transaction_id); 213 void OnAbort(int32_t ipc_database_id, int64_t transaction_id);
207 void OnCommit(int32_t ipc_database_id, int64_t transaction_id); 214 void OnCommit(int32_t ipc_database_id, int64_t transaction_id);
208 void OnGotUsageAndQuotaForCommit(int32_t ipc_database_id, 215 void OnGotUsageAndQuotaForCommit(int32_t ipc_database_id,
209 int64_t transaction_id, 216 int64_t transaction_id,
210 storage::QuotaStatusCode status, 217 storage::QuotaStatusCode status,
211 int64_t usage, 218 int64_t usage,
212 int64_t quota); 219 int64_t quota);
220 int64_t GenerateObserverAndThreadId(int32_t observer_id,
221 int32_t ipc_thread_id);
222 std::vector<int64_t> RemoveObservers(std::vector<int32_t> remove_observers,
223 int32_t ipc_thread_id);
213 224
214 IndexedDBDispatcherHost* parent_; 225 IndexedDBDispatcherHost* parent_;
215 IDMap<IndexedDBConnection, IDMapOwnPointer> map_; 226 IDMap<IndexedDBConnection, IDMapOwnPointer> map_;
216 WebIDBObjectIDToOriginMap database_origin_map_; 227 WebIDBObjectIDToOriginMap database_origin_map_;
217 TransactionIDToSizeMap transaction_size_map_; 228 TransactionIDToSizeMap transaction_size_map_;
218 TransactionIDToOriginMap transaction_origin_map_; 229 TransactionIDToOriginMap transaction_origin_map_;
219 TransactionIDToDatabaseIDMap transaction_database_map_; 230 TransactionIDToDatabaseIDMap transaction_database_map_;
231 std::vector<std::pair<int32_t, int64_t>> observers_;
220 232
221 // Weak pointers are used when an asynchronous quota request is made, in 233 // Weak pointers are used when an asynchronous quota request is made, in
222 // case the dispatcher is torn down before the response returns. 234 // case the dispatcher is torn down before the response returns.
223 base::WeakPtrFactory<DatabaseDispatcherHost> weak_factory_; 235 base::WeakPtrFactory<DatabaseDispatcherHost> weak_factory_;
224 236
225 private: 237 private:
226 DISALLOW_COPY_AND_ASSIGN(DatabaseDispatcherHost); 238 DISALLOW_COPY_AND_ASSIGN(DatabaseDispatcherHost);
227 }; 239 };
228 240
229 class CursorDispatcherHost { 241 class CursorDispatcherHost {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 304 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
293 net::URLRequestContext* request_context_; 305 net::URLRequestContext* request_context_;
294 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; 306 scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
295 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; 307 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
296 308
297 BlobDataHandleMap blob_data_handle_map_; 309 BlobDataHandleMap blob_data_handle_map_;
298 310
299 // Only access on IndexedDB thread. 311 // Only access on IndexedDB thread.
300 std::unique_ptr<DatabaseDispatcherHost> database_dispatcher_host_; 312 std::unique_ptr<DatabaseDispatcherHost> database_dispatcher_host_;
301 std::unique_ptr<CursorDispatcherHost> cursor_dispatcher_host_; 313 std::unique_ptr<CursorDispatcherHost> cursor_dispatcher_host_;
302
303 // Used to set file permissions for blob storage. 314 // Used to set file permissions for blob storage.
304 int ipc_process_id_; 315 int ipc_process_id_;
305 316
306 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 317 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
307 }; 318 };
308 319
309 } // namespace content 320 } // namespace content
310 321
311 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 322 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698