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 14 matching lines...) Expand all Loading... |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 struct IndexedDBDatabaseMetadata; | 27 struct IndexedDBDatabaseMetadata; |
28 struct IndexedDBHostMsg_DatabaseCount_Params; | 28 struct IndexedDBHostMsg_DatabaseCount_Params; |
29 struct IndexedDBHostMsg_DatabaseCreateIndex_Params; | 29 struct IndexedDBHostMsg_DatabaseCreateIndex_Params; |
30 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; | 30 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; |
31 struct IndexedDBHostMsg_DatabaseCreateTransaction_Params; | 31 struct IndexedDBHostMsg_DatabaseCreateTransaction_Params; |
32 struct IndexedDBHostMsg_DatabaseDeleteRange_Params; | 32 struct IndexedDBHostMsg_DatabaseDeleteRange_Params; |
33 struct IndexedDBHostMsg_DatabaseGet_Params; | 33 struct IndexedDBHostMsg_DatabaseGet_Params; |
34 struct IndexedDBHostMsg_DatabaseGetAll_Params; | 34 struct IndexedDBHostMsg_DatabaseGetAll_Params; |
| 35 struct IndexedDBHostMsg_DatabaseObserve_Params; |
35 struct IndexedDBHostMsg_DatabaseOpenCursor_Params; | 36 struct IndexedDBHostMsg_DatabaseOpenCursor_Params; |
36 struct IndexedDBHostMsg_DatabasePut_Params; | 37 struct IndexedDBHostMsg_DatabasePut_Params; |
37 struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params; | 38 struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params; |
38 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; | 39 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; |
39 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; | 40 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; |
40 struct IndexedDBHostMsg_FactoryOpen_Params; | 41 struct IndexedDBHostMsg_FactoryOpen_Params; |
| 42 struct IndexedDBMsg_Observation; |
| 43 struct IndexedDBMsg_ObserverChanges; |
41 | 44 |
42 namespace url { | 45 namespace url { |
43 class Origin; | 46 class Origin; |
44 } | 47 } |
45 | 48 |
46 namespace content { | 49 namespace content { |
47 class IndexedDBBlobInfo; | 50 class IndexedDBBlobInfo; |
48 class IndexedDBConnection; | 51 class IndexedDBConnection; |
49 class IndexedDBContextImpl; | 52 class IndexedDBContextImpl; |
50 class IndexedDBCursor; | 53 class IndexedDBCursor; |
51 class IndexedDBKey; | 54 class IndexedDBKey; |
52 class IndexedDBKeyPath; | 55 class IndexedDBKeyPath; |
53 class IndexedDBKeyRange; | 56 class IndexedDBKeyRange; |
| 57 class IndexedDBObservation; |
| 58 class IndexedDBObserverChanges; |
54 struct IndexedDBDatabaseMetadata; | 59 struct IndexedDBDatabaseMetadata; |
55 | 60 |
56 // Handles all IndexedDB related messages from a particular renderer process. | 61 // Handles all IndexedDB related messages from a particular renderer process. |
57 class IndexedDBDispatcherHost : public BrowserMessageFilter { | 62 class IndexedDBDispatcherHost : public BrowserMessageFilter { |
58 public: | 63 public: |
59 // Only call the constructor from the UI thread. | 64 // Only call the constructor from the UI thread. |
60 IndexedDBDispatcherHost(int ipc_process_id, | 65 IndexedDBDispatcherHost(int ipc_process_id, |
61 net::URLRequestContextGetter* request_context_getter, | 66 net::URLRequestContextGetter* request_context_getter, |
62 IndexedDBContextImpl* indexed_db_context, | 67 IndexedDBContextImpl* indexed_db_context, |
63 ChromeBlobStorageContext* blob_storage_context); | 68 ChromeBlobStorageContext* blob_storage_context); |
64 IndexedDBDispatcherHost(int ipc_process_id, | 69 IndexedDBDispatcherHost(int ipc_process_id, |
65 net::URLRequestContext* request_context, | 70 net::URLRequestContext* request_context, |
66 IndexedDBContextImpl* indexed_db_context, | 71 IndexedDBContextImpl* indexed_db_context, |
67 ChromeBlobStorageContext* blob_storage_context); | 72 ChromeBlobStorageContext* blob_storage_context); |
68 | 73 |
69 static ::IndexedDBDatabaseMetadata ConvertMetadata( | 74 static ::IndexedDBDatabaseMetadata ConvertMetadata( |
70 const content::IndexedDBDatabaseMetadata& metadata); | 75 const content::IndexedDBDatabaseMetadata& metadata); |
| 76 static IndexedDBMsg_ObserverChanges ConvertObserverChanges( |
| 77 std::unique_ptr<IndexedDBObserverChanges> changes); |
| 78 static IndexedDBMsg_Observation ConvertObservation( |
| 79 const IndexedDBObservation* observation); |
71 | 80 |
72 // BrowserMessageFilter implementation. | 81 // BrowserMessageFilter implementation. |
73 void OnChannelConnected(int32_t peer_pid) override; | 82 void OnChannelConnected(int32_t peer_pid) override; |
74 void OnChannelClosing() override; | 83 void OnChannelClosing() override; |
75 void OnDestruct() const override; | 84 void OnDestruct() const override; |
76 base::TaskRunner* OverrideTaskRunnerForMessage( | 85 base::TaskRunner* OverrideTaskRunnerForMessage( |
77 const IPC::Message& message) override; | 86 const IPC::Message& message) override; |
78 bool OnMessageReceived(const IPC::Message& message) override; | 87 bool OnMessageReceived(const IPC::Message& message) override; |
79 | 88 |
80 void FinishTransaction(int64_t host_transaction_id, bool committed); | 89 void FinishTransaction(int64_t host_transaction_id, bool committed); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params); | 176 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params); |
168 void OnDeleteObjectStore(int32_t ipc_database_id, | 177 void OnDeleteObjectStore(int32_t ipc_database_id, |
169 int64_t transaction_id, | 178 int64_t transaction_id, |
170 int64_t object_store_id); | 179 int64_t object_store_id); |
171 void OnCreateTransaction( | 180 void OnCreateTransaction( |
172 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); | 181 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); |
173 void OnClose(int32_t ipc_database_id); | 182 void OnClose(int32_t ipc_database_id); |
174 void OnVersionChangeIgnored(int32_t ipc_database_id); | 183 void OnVersionChangeIgnored(int32_t ipc_database_id); |
175 void OnDestroyed(int32_t ipc_database_id); | 184 void OnDestroyed(int32_t ipc_database_id); |
176 | 185 |
177 void OnObserve(int32_t ipc_database_id, | 186 void OnObserve(const IndexedDBHostMsg_DatabaseObserve_Params&); |
178 int64_t transaction_id, | |
179 int32_t observer_id); | |
180 void OnUnobserve(int32_t ipc_database_id, | 187 void OnUnobserve(int32_t ipc_database_id, |
181 const std::vector<int32_t>& observer_ids_to_remove); | 188 const std::vector<int32_t>& observer_ids_to_remove); |
182 | 189 |
183 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); | 190 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); |
184 void OnGetAll(const IndexedDBHostMsg_DatabaseGetAll_Params& params); | 191 void OnGetAll(const IndexedDBHostMsg_DatabaseGetAll_Params& params); |
185 // OnPutWrapper starts on the IO thread so that it can grab BlobDataHandles | 192 // OnPutWrapper starts on the IO thread so that it can grab BlobDataHandles |
186 // before posting to the IDB TaskRunner for the rest of the job. | 193 // before posting to the IDB TaskRunner for the rest of the job. |
187 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params); | 194 void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params); |
188 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params, | 195 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params, |
189 std::vector<storage::BlobDataHandle*> handles); | 196 std::vector<storage::BlobDataHandle*> handles); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 315 |
309 // Used to set file permissions for blob storage. | 316 // Used to set file permissions for blob storage. |
310 int ipc_process_id_; | 317 int ipc_process_id_; |
311 | 318 |
312 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 319 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
313 }; | 320 }; |
314 | 321 |
315 } // namespace content | 322 } // namespace content |
316 | 323 |
317 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 324 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
OLD | NEW |