| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 void OnObserve(const IndexedDBHostMsg_DatabaseObserve_Params&); | 180 void OnObserve(const IndexedDBHostMsg_DatabaseObserve_Params&); |
| 181 void OnUnobserve(int32_t ipc_database_id, | 181 void OnUnobserve(int32_t ipc_database_id, |
| 182 const std::vector<int32_t>& observer_ids_to_remove); | 182 const std::vector<int32_t>& observer_ids_to_remove); |
| 183 | 183 |
| 184 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); | 184 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); |
| 185 void OnGetAll(const IndexedDBHostMsg_DatabaseGetAll_Params& params); | 185 void OnGetAll(const IndexedDBHostMsg_DatabaseGetAll_Params& params); |
| 186 // 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 |
| 187 // 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. |
| 188 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params); | 188 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params); |
| 189 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params, | 189 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params, |
| 190 std::vector<storage::BlobDataHandle*> handles); | 190 std::vector<std::unique_ptr<storage::BlobDataHandle>> handles); |
| 191 void OnSetIndexKeys( | 191 void OnSetIndexKeys( |
| 192 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); | 192 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); |
| 193 void OnSetIndexesReady(int32_t ipc_database_id, | 193 void OnSetIndexesReady(int32_t ipc_database_id, |
| 194 int64_t transaction_id, | 194 int64_t transaction_id, |
| 195 int64_t object_store_id, | 195 int64_t object_store_id, |
| 196 const std::vector<int64_t>& ids); | 196 const std::vector<int64_t>& ids); |
| 197 void OnOpenCursor(const IndexedDBHostMsg_DatabaseOpenCursor_Params& params); | 197 void OnOpenCursor(const IndexedDBHostMsg_DatabaseOpenCursor_Params& params); |
| 198 void OnCount(const IndexedDBHostMsg_DatabaseCount_Params& params); | 198 void OnCount(const IndexedDBHostMsg_DatabaseCount_Params& params); |
| 199 void OnDeleteRange( | 199 void OnDeleteRange( |
| 200 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params); | 200 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // Message processing. Most of the work is delegated to the dispatcher hosts | 281 // Message processing. Most of the work is delegated to the dispatcher hosts |
| 282 // below. | 282 // below. |
| 283 void OnIDBFactoryGetDatabaseNames( | 283 void OnIDBFactoryGetDatabaseNames( |
| 284 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); | 284 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); |
| 285 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); | 285 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); |
| 286 | 286 |
| 287 void OnIDBFactoryDeleteDatabase( | 287 void OnIDBFactoryDeleteDatabase( |
| 288 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); | 288 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); |
| 289 | 289 |
| 290 void OnAckReceivedBlobs(const std::vector<std::string>& uuids); | 290 void OnAckReceivedBlobs(const std::vector<std::string>& uuids); |
| 291 void OnPutHelper(const IndexedDBHostMsg_DatabasePut_Params& params, | 291 void OnPutHelper( |
| 292 std::vector<storage::BlobDataHandle*> handles); | 292 const IndexedDBHostMsg_DatabasePut_Params& params, |
| 293 std::vector<std::unique_ptr<storage::BlobDataHandle>> handles); |
| 293 | 294 |
| 294 void ResetDispatcherHosts(); | 295 void ResetDispatcherHosts(); |
| 295 void DropBlobData(const std::string& uuid); | 296 void DropBlobData(const std::string& uuid); |
| 296 | 297 |
| 297 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 298 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 298 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 299 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 299 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | 300 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
| 300 | 301 |
| 301 // Maps blob uuid to a pair (handle, ref count). Entry is added and/or count | 302 // Maps blob uuid to a pair (handle, ref count). Entry is added and/or count |
| 302 // is incremented in HoldBlobData(), and count is decremented and/or entry | 303 // is incremented in HoldBlobData(), and count is decremented and/or entry |
| 303 // removed in DropBlobData(). | 304 // removed in DropBlobData(). |
| 304 std::map<std::string, | 305 std::map<std::string, |
| 305 std::pair<std::unique_ptr<storage::BlobDataHandle>, int>> | 306 std::pair<std::unique_ptr<storage::BlobDataHandle>, int>> |
| 306 blob_data_handle_map_; | 307 blob_data_handle_map_; |
| 307 | 308 |
| 308 // Only access on IndexedDB thread. | 309 // Only access on IndexedDB thread. |
| 309 std::unique_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 310 std::unique_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
| 310 std::unique_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 311 std::unique_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
| 311 | 312 |
| 312 // Used to set file permissions for blob storage. | 313 // Used to set file permissions for blob storage. |
| 313 int ipc_process_id_; | 314 int ipc_process_id_; |
| 314 | 315 |
| 315 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 316 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
| 316 }; | 317 }; |
| 317 | 318 |
| 318 } // namespace content | 319 } // namespace content |
| 319 | 320 |
| 320 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 321 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
| OLD | NEW |