| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 class IndexedDBCursor; | 34 class IndexedDBCursor; |
| 35 class IndexedDBKey; | 35 class IndexedDBKey; |
| 36 class IndexedDBKeyPath; | 36 class IndexedDBKeyPath; |
| 37 class IndexedDBKeyRange; | 37 class IndexedDBKeyRange; |
| 38 struct IndexedDBDatabaseMetadata; | 38 struct IndexedDBDatabaseMetadata; |
| 39 | 39 |
| 40 // Handles all IndexedDB related messages from a particular renderer process. | 40 // Handles all IndexedDB related messages from a particular renderer process. |
| 41 class IndexedDBDispatcherHost : public BrowserMessageFilter { | 41 class IndexedDBDispatcherHost : public BrowserMessageFilter { |
| 42 public: | 42 public: |
| 43 // Only call the constructor from the UI thread. | 43 // Only call the constructor from the UI thread. |
| 44 IndexedDBDispatcherHost(int ipc_process_id, | 44 explicit IndexedDBDispatcherHost(IndexedDBContextImpl* indexed_db_context); |
| 45 IndexedDBContextImpl* indexed_db_context); | |
| 46 | 45 |
| 47 static ::IndexedDBDatabaseMetadata ConvertMetadata( | 46 static ::IndexedDBDatabaseMetadata ConvertMetadata( |
| 48 const content::IndexedDBDatabaseMetadata& metadata); | 47 const content::IndexedDBDatabaseMetadata& metadata); |
| 49 | 48 |
| 50 // BrowserMessageFilter implementation. | 49 // BrowserMessageFilter implementation. |
| 51 virtual void OnChannelClosing() OVERRIDE; | 50 virtual void OnChannelClosing() OVERRIDE; |
| 52 virtual void OnDestruct() const OVERRIDE; | 51 virtual void OnDestruct() const OVERRIDE; |
| 53 virtual base::TaskRunner* OverrideTaskRunnerForMessage( | 52 virtual base::TaskRunner* OverrideTaskRunnerForMessage( |
| 54 const IPC::Message& message) OVERRIDE; | 53 const IPC::Message& message) OVERRIDE; |
| 55 virtual bool OnMessageReceived(const IPC::Message& message, | 54 virtual bool OnMessageReceived(const IPC::Message& message, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 typedef std::map<int64, uint64> TransactionIDToSizeMap; | 147 typedef std::map<int64, uint64> TransactionIDToSizeMap; |
| 149 typedef std::map<int64, int64> TransactionIDToDatabaseIDMap; | 148 typedef std::map<int64, int64> TransactionIDToDatabaseIDMap; |
| 150 | 149 |
| 151 class DatabaseDispatcherHost { | 150 class DatabaseDispatcherHost { |
| 152 public: | 151 public: |
| 153 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent); | 152 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent); |
| 154 ~DatabaseDispatcherHost(); | 153 ~DatabaseDispatcherHost(); |
| 155 | 154 |
| 156 void CloseAll(); | 155 void CloseAll(); |
| 157 bool OnMessageReceived(const IPC::Message& message, bool* msg_is_ok); | 156 bool OnMessageReceived(const IPC::Message& message, bool* msg_is_ok); |
| 158 void Send(IPC::Message* message); | |
| 159 | 157 |
| 160 void OnCreateObjectStore( | 158 void OnCreateObjectStore( |
| 161 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params); | 159 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params); |
| 162 void OnDeleteObjectStore(int32 ipc_database_id, | 160 void OnDeleteObjectStore(int32 ipc_database_id, |
| 163 int64 transaction_id, | 161 int64 transaction_id, |
| 164 int64 object_store_id); | 162 int64 object_store_id); |
| 165 void OnCreateTransaction( | 163 void OnCreateTransaction( |
| 166 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); | 164 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); |
| 167 void OnOpen(int32 ipc_database_id, | |
| 168 int32 ipc_thread_id, | |
| 169 int32 ipc_callbacks_id); | |
| 170 void OnClose(int32 ipc_database_id); | 165 void OnClose(int32 ipc_database_id); |
| 171 void OnDestroyed(int32 ipc_database_id); | 166 void OnDestroyed(int32 ipc_database_id); |
| 172 | 167 |
| 173 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); | 168 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); |
| 174 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params); | 169 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params); |
| 175 void OnSetIndexKeys( | 170 void OnSetIndexKeys( |
| 176 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); | 171 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); |
| 177 void OnSetIndexesReady(int32 ipc_database_id, | 172 void OnSetIndexesReady(int32 ipc_database_id, |
| 178 int64 transaction_id, | 173 int64 transaction_id, |
| 179 int64 object_store_id, | 174 int64 object_store_id, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 203 TransactionIDToURLMap transaction_url_map_; | 198 TransactionIDToURLMap transaction_url_map_; |
| 204 TransactionIDToDatabaseIDMap transaction_database_map_; | 199 TransactionIDToDatabaseIDMap transaction_database_map_; |
| 205 }; | 200 }; |
| 206 | 201 |
| 207 class CursorDispatcherHost { | 202 class CursorDispatcherHost { |
| 208 public: | 203 public: |
| 209 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); | 204 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); |
| 210 ~CursorDispatcherHost(); | 205 ~CursorDispatcherHost(); |
| 211 | 206 |
| 212 bool OnMessageReceived(const IPC::Message& message, bool* msg_is_ok); | 207 bool OnMessageReceived(const IPC::Message& message, bool* msg_is_ok); |
| 213 void Send(IPC::Message* message); | |
| 214 | 208 |
| 215 void OnAdvance(int32 ipc_object_store_id, | 209 void OnAdvance(int32 ipc_object_store_id, |
| 216 int32 ipc_thread_id, | 210 int32 ipc_thread_id, |
| 217 int32 ipc_callbacks_id, | 211 int32 ipc_callbacks_id, |
| 218 unsigned long count); | 212 unsigned long count); |
| 219 void OnContinue(int32 ipc_object_store_id, | 213 void OnContinue(int32 ipc_object_store_id, |
| 220 int32 ipc_thread_id, | 214 int32 ipc_thread_id, |
| 221 int32 ipc_callbacks_id, | 215 int32 ipc_callbacks_id, |
| 222 const IndexedDBKey& key); | 216 const IndexedDBKey& key); |
| 223 void OnPrefetch(int32 ipc_cursor_id, | 217 void OnPrefetch(int32 ipc_cursor_id, |
| 224 int32 ipc_thread_id, | 218 int32 ipc_thread_id, |
| 225 int32 ipc_callbacks_id, | 219 int32 ipc_callbacks_id, |
| 226 int n); | 220 int n); |
| 227 void OnPrefetchReset(int32 ipc_cursor_id, | 221 void OnPrefetchReset(int32 ipc_cursor_id, |
| 228 int used_prefetches, | 222 int used_prefetches, |
| 229 int unused_prefetches); | 223 int unused_prefetches); |
| 230 void OnDestroyed(int32 ipc_cursor_id); | 224 void OnDestroyed(int32 ipc_cursor_id); |
| 231 | 225 |
| 232 IndexedDBDispatcherHost* parent_; | 226 IndexedDBDispatcherHost* parent_; |
| 233 RefIDMap<IndexedDBCursor> map_; | 227 RefIDMap<IndexedDBCursor> map_; |
| 234 }; | 228 }; |
| 235 | 229 |
| 236 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 230 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 237 | 231 |
| 238 // Only access on IndexedDB thread. | 232 // Only access on IndexedDB thread. |
| 239 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 233 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
| 240 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 234 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
| 241 | 235 |
| 242 // Used to dispatch messages to the correct view host. | |
| 243 int ipc_process_id_; | |
| 244 | |
| 245 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 236 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
| 246 }; | 237 }; |
| 247 | 238 |
| 248 } // namespace content | 239 } // namespace content |
| 249 | 240 |
| 250 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 241 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
| OLD | NEW |