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

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: Unobserve functionality 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // id to and from a back-end ("host") transaction id that encodes the process 101 // id to and from a back-end ("host") transaction id that encodes the process
102 // id in the high 32 bits. The mapping is host-specific and ids are validated. 102 // id in the high 32 bits. The mapping is host-specific and ids are validated.
103 int64_t HostTransactionId(int64_t transaction_id); 103 int64_t HostTransactionId(int64_t transaction_id);
104 int64_t RendererTransactionId(int64_t host_transaction_id); 104 int64_t RendererTransactionId(int64_t host_transaction_id);
105 105
106 // These are called to decode a host transaction ID, for diagnostic purposes. 106 // These are called to decode a host transaction ID, for diagnostic purposes.
107 static uint32_t TransactionIdToRendererTransactionId( 107 static uint32_t TransactionIdToRendererTransactionId(
108 int64_t host_transaction_id); 108 int64_t host_transaction_id);
109 static uint32_t TransactionIdToProcessId(int64_t host_transaction_id); 109 static uint32_t TransactionIdToProcessId(int64_t host_transaction_id);
110 110
111 // These are called to map a 32-bit front-end (renderer-specific) observer
112 // id to and from a back-end ("host") observer id that encodes the process
113 // id in the high 32 bits. The mapping is host-specific and ids are validated.
114 int64_t HostObserverId(int64_t observer_id);
115 int64_t RendererObserverId(int64_t host_observer_id);
116
117 std::string HoldBlobData(const IndexedDBBlobInfo& blob_info); 111 std::string HoldBlobData(const IndexedDBBlobInfo& blob_info);
118 112
119 private: 113 private:
120 // Friends to enable OnDestruct() delegation. 114 // Friends to enable OnDestruct() delegation.
121 friend class BrowserThread; 115 friend class BrowserThread;
122 friend class base::DeleteHelper<IndexedDBDispatcherHost>; 116 friend class base::DeleteHelper<IndexedDBDispatcherHost>;
123 117
124 // Used in nested classes. 118 // Used in nested classes.
125 typedef std::map<std::string, std::pair<storage::BlobDataHandle*, int>> 119 typedef std::map<std::string, std::pair<storage::BlobDataHandle*, int>>
126 BlobDataHandleMap; 120 BlobDataHandleMap;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 int64_t object_store_id); 170 int64_t object_store_id);
177 void OnCreateTransaction( 171 void OnCreateTransaction(
178 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); 172 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&);
179 void OnClose(int32_t ipc_database_id); 173 void OnClose(int32_t ipc_database_id);
180 void OnVersionChangeIgnored(int32_t ipc_database_id); 174 void OnVersionChangeIgnored(int32_t ipc_database_id);
181 void OnDestroyed(int32_t ipc_database_id); 175 void OnDestroyed(int32_t ipc_database_id);
182 176
183 void OnObserve(int32_t ipc_thread_id, 177 void OnObserve(int32_t ipc_thread_id,
184 int32_t ipc_database_id, 178 int32_t ipc_database_id,
185 int64_t transaction_id, 179 int64_t transaction_id,
186 int64_t observer_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);
187 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); 184 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params);
188 void OnGetAll(const IndexedDBHostMsg_DatabaseGetAll_Params& params); 185 void OnGetAll(const IndexedDBHostMsg_DatabaseGetAll_Params& params);
189 // 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
190 // 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.
191 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params); 188 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params);
192 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params, 189 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params,
193 std::vector<storage::BlobDataHandle*> handles); 190 std::vector<storage::BlobDataHandle*> handles);
194 void OnSetIndexKeys( 191 void OnSetIndexKeys(
195 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); 192 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params);
196 void OnSetIndexesReady(int32_t ipc_database_id, 193 void OnSetIndexesReady(int32_t ipc_database_id,
(...skipping 16 matching lines...) Expand all
213 int64_t object_store_id, 210 int64_t object_store_id,
214 int64_t index_id); 211 int64_t index_id);
215 212
216 void OnAbort(int32_t ipc_database_id, int64_t transaction_id); 213 void OnAbort(int32_t ipc_database_id, int64_t transaction_id);
217 void OnCommit(int32_t ipc_database_id, int64_t transaction_id); 214 void OnCommit(int32_t ipc_database_id, int64_t transaction_id);
218 void OnGotUsageAndQuotaForCommit(int32_t ipc_database_id, 215 void OnGotUsageAndQuotaForCommit(int32_t ipc_database_id,
219 int64_t transaction_id, 216 int64_t transaction_id,
220 storage::QuotaStatusCode status, 217 storage::QuotaStatusCode status,
221 int64_t usage, 218 int64_t usage,
222 int64_t quota); 219 int64_t quota);
220 int64_t GenerateObserverId(int32_t observer_id, int32_t ipc_thread_id);
dmurph 2016/06/16 07:30:33 How about calling the result ObserverAndThreadId?
palakj1 2016/06/16 17:51:41 Done
221 std::vector<int64_t> RemoveObservers(std::vector<int32_t> remove_observers,
dmurph 2016/06/16 07:30:33 We still need the ipc_thread_id here as well.
palakj1 2016/06/16 17:51:41 Done
222 int32_t ipc_database_id);
223 223
dmurph 2016/06/16 07:30:33 Make sure we store a vector<std::pair<int32_t, int
palakj1 2016/06/16 17:51:41 done
224 IndexedDBDispatcherHost* parent_; 224 IndexedDBDispatcherHost* parent_;
225 IDMap<IndexedDBConnection, IDMapOwnPointer> map_; 225 IDMap<IndexedDBConnection, IDMapOwnPointer> map_;
226 WebIDBObjectIDToOriginMap database_origin_map_; 226 WebIDBObjectIDToOriginMap database_origin_map_;
227 TransactionIDToSizeMap transaction_size_map_; 227 TransactionIDToSizeMap transaction_size_map_;
228 TransactionIDToOriginMap transaction_origin_map_; 228 TransactionIDToOriginMap transaction_origin_map_;
229 TransactionIDToDatabaseIDMap transaction_database_map_; 229 TransactionIDToDatabaseIDMap transaction_database_map_;
230 std::vector<int64_t> observers_; 230 std::vector<int64_t> observers_;
231 231
232 // Weak pointers are used when an asynchronous quota request is made, in 232 // Weak pointers are used when an asynchronous quota request is made, in
233 // case the dispatcher is torn down before the response returns. 233 // case the dispatcher is torn down before the response returns.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 std::unique_ptr<CursorDispatcherHost> cursor_dispatcher_host_; 312 std::unique_ptr<CursorDispatcherHost> cursor_dispatcher_host_;
313 // Used to set file permissions for blob storage. 313 // Used to set file permissions for blob storage.
314 int ipc_process_id_; 314 int ipc_process_id_;
315 315
316 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 316 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
317 }; 317 };
318 318
319 } // namespace content 319 } // namespace content
320 320
321 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 321 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698