OLD | NEW |
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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 static uint32 TransactionIdToProcessId(int64 host_transaction_id); | 97 static uint32 TransactionIdToProcessId(int64 host_transaction_id); |
98 | 98 |
99 std::string HoldBlobData(const IndexedDBBlobInfo& blob_info); | 99 std::string HoldBlobData(const IndexedDBBlobInfo& blob_info); |
100 | 100 |
101 private: | 101 private: |
102 // Friends to enable OnDestruct() delegation. | 102 // Friends to enable OnDestruct() delegation. |
103 friend class BrowserThread; | 103 friend class BrowserThread; |
104 friend class base::DeleteHelper<IndexedDBDispatcherHost>; | 104 friend class base::DeleteHelper<IndexedDBDispatcherHost>; |
105 | 105 |
106 // Used in nested classes. | 106 // Used in nested classes. |
107 typedef std::map<std::string, std::pair<storage::BlobDataHandle*, int>> | 107 typedef std::map<std::string, |
| 108 std::pair<storage::BlobDataSnapshotHandle*, int>> |
108 BlobDataHandleMap; | 109 BlobDataHandleMap; |
109 typedef std::map<int64, int64> TransactionIDToDatabaseIDMap; | 110 typedef std::map<int64, int64> TransactionIDToDatabaseIDMap; |
110 typedef std::map<int64, uint64> TransactionIDToSizeMap; | 111 typedef std::map<int64, uint64> TransactionIDToSizeMap; |
111 typedef std::map<int64, GURL> TransactionIDToURLMap; | 112 typedef std::map<int64, GURL> TransactionIDToURLMap; |
112 typedef std::map<int32, GURL> WebIDBObjectIDToURLMap; | 113 typedef std::map<int32, GURL> WebIDBObjectIDToURLMap; |
113 | 114 |
114 // IDMap for RefCounted types | 115 // IDMap for RefCounted types |
115 template <typename RefCountedType> | 116 template <typename RefCountedType> |
116 class RefIDMap { | 117 class RefIDMap { |
117 public: | 118 public: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); | 161 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); |
161 void OnClose(int32 ipc_database_id); | 162 void OnClose(int32 ipc_database_id); |
162 void OnVersionChangeIgnored(int32 ipc_database_id); | 163 void OnVersionChangeIgnored(int32 ipc_database_id); |
163 void OnDestroyed(int32 ipc_database_id); | 164 void OnDestroyed(int32 ipc_database_id); |
164 | 165 |
165 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); | 166 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); |
166 // OnPutWrapper starts on the IO thread so that it can grab BlobDataHandles | 167 // OnPutWrapper starts on the IO thread so that it can grab BlobDataHandles |
167 // before posting to the IDB TaskRunner for the rest of the job. | 168 // before posting to the IDB TaskRunner for the rest of the job. |
168 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params); | 169 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params); |
169 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params, | 170 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params, |
170 std::vector<storage::BlobDataHandle*> handles); | 171 std::vector<storage::BlobDataSnapshotHandle*> handles); |
171 void OnSetIndexKeys( | 172 void OnSetIndexKeys( |
172 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); | 173 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); |
173 void OnSetIndexesReady(int32 ipc_database_id, | 174 void OnSetIndexesReady(int32 ipc_database_id, |
174 int64 transaction_id, | 175 int64 transaction_id, |
175 int64 object_store_id, | 176 int64 object_store_id, |
176 const std::vector<int64>& ids); | 177 const std::vector<int64>& ids); |
177 void OnOpenCursor(const IndexedDBHostMsg_DatabaseOpenCursor_Params& params); | 178 void OnOpenCursor(const IndexedDBHostMsg_DatabaseOpenCursor_Params& params); |
178 void OnCount(const IndexedDBHostMsg_DatabaseCount_Params& params); | 179 void OnCount(const IndexedDBHostMsg_DatabaseCount_Params& params); |
179 void OnDeleteRange( | 180 void OnDeleteRange( |
180 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params); | 181 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // below. | 253 // below. |
253 void OnIDBFactoryGetDatabaseNames( | 254 void OnIDBFactoryGetDatabaseNames( |
254 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); | 255 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); |
255 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); | 256 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); |
256 | 257 |
257 void OnIDBFactoryDeleteDatabase( | 258 void OnIDBFactoryDeleteDatabase( |
258 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); | 259 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); |
259 | 260 |
260 void OnAckReceivedBlobs(const std::vector<std::string>& uuids); | 261 void OnAckReceivedBlobs(const std::vector<std::string>& uuids); |
261 void OnPutHelper(const IndexedDBHostMsg_DatabasePut_Params& params, | 262 void OnPutHelper(const IndexedDBHostMsg_DatabasePut_Params& params, |
262 std::vector<storage::BlobDataHandle*> handles); | 263 std::vector<storage::BlobDataSnapshotHandle*> handles); |
263 | 264 |
264 void ResetDispatcherHosts(); | 265 void ResetDispatcherHosts(); |
265 void DropBlobData(const std::string& uuid); | 266 void DropBlobData(const std::string& uuid); |
266 | 267 |
267 // The getter holds the context until OnChannelConnected() can be called from | 268 // The getter holds the context until OnChannelConnected() can be called from |
268 // the IO thread, which will extract the net::URLRequestContext from it. | 269 // the IO thread, which will extract the net::URLRequestContext from it. |
269 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 270 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
270 net::URLRequestContext* request_context_; | 271 net::URLRequestContext* request_context_; |
271 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 272 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
272 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | 273 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
273 | 274 |
274 BlobDataHandleMap blob_data_handle_map_; | 275 BlobDataHandleMap blob_data_handle_map_; |
275 | 276 |
276 // Only access on IndexedDB thread. | 277 // Only access on IndexedDB thread. |
277 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 278 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
278 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 279 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
279 | 280 |
280 // Used to set file permissions for blob storage. | 281 // Used to set file permissions for blob storage. |
281 int ipc_process_id_; | 282 int ipc_process_id_; |
282 | 283 |
283 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 284 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
284 }; | 285 }; |
285 | 286 |
286 } // namespace content | 287 } // namespace content |
287 | 288 |
288 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 289 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
OLD | NEW |