| 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_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 struct IndexedDBHostMsg_DatabaseDeleteRange_Params; | 21 struct IndexedDBHostMsg_DatabaseDeleteRange_Params; |
| 22 struct IndexedDBHostMsg_DatabaseGet_Params; | 22 struct IndexedDBHostMsg_DatabaseGet_Params; |
| 23 struct IndexedDBHostMsg_DatabaseOpenCursor_Params; | 23 struct IndexedDBHostMsg_DatabaseOpenCursor_Params; |
| 24 struct IndexedDBHostMsg_DatabasePut_Params; | 24 struct IndexedDBHostMsg_DatabasePut_Params; |
| 25 struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params; | 25 struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params; |
| 26 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; | 26 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; |
| 27 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; | 27 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; |
| 28 struct IndexedDBHostMsg_FactoryOpen_Params; | 28 struct IndexedDBHostMsg_FactoryOpen_Params; |
| 29 | 29 |
| 30 namespace WebKit { | 30 namespace WebKit { |
| 31 class WebIDBCursor; | |
| 32 class WebIDBDatabase; | |
| 33 struct WebIDBMetadata; | 31 struct WebIDBMetadata; |
| 34 } | 32 } |
| 35 | 33 |
| 36 namespace content { | 34 namespace content { |
| 37 class IndexedDBContextImpl; | 35 class IndexedDBContextImpl; |
| 38 class IndexedDBKey; | 36 class IndexedDBKey; |
| 39 class IndexedDBKeyPath; | 37 class IndexedDBKeyPath; |
| 40 class IndexedDBKeyRange; | 38 class IndexedDBKeyRange; |
| 39 class WebIDBCursorImpl; |
| 40 class WebIDBDatabaseImpl; |
| 41 | 41 |
| 42 // Handles all IndexedDB related messages from a particular renderer process. | 42 // Handles all IndexedDB related messages from a particular renderer process. |
| 43 class IndexedDBDispatcherHost : public BrowserMessageFilter { | 43 class IndexedDBDispatcherHost : public BrowserMessageFilter { |
| 44 public: | 44 public: |
| 45 // Only call the constructor from the UI thread. | 45 // Only call the constructor from the UI thread. |
| 46 IndexedDBDispatcherHost(int ipc_process_id, | 46 IndexedDBDispatcherHost(int ipc_process_id, |
| 47 IndexedDBContextImpl* indexed_db_context); | 47 IndexedDBContextImpl* indexed_db_context); |
| 48 | 48 |
| 49 static IndexedDBDatabaseMetadata ConvertMetadata( | 49 static IndexedDBDatabaseMetadata ConvertMetadata( |
| 50 const WebKit::WebIDBMetadata& metadata); | 50 const WebKit::WebIDBMetadata& metadata); |
| 51 | 51 |
| 52 // BrowserMessageFilter implementation. | 52 // BrowserMessageFilter implementation. |
| 53 virtual void OnChannelClosing() OVERRIDE; | 53 virtual void OnChannelClosing() OVERRIDE; |
| 54 virtual void OverrideThreadForMessage(const IPC::Message& message, | 54 virtual void OverrideThreadForMessage(const IPC::Message& message, |
| 55 BrowserThread::ID* thread) OVERRIDE; | 55 BrowserThread::ID* thread) OVERRIDE; |
| 56 virtual bool OnMessageReceived(const IPC::Message& message, | 56 virtual bool OnMessageReceived(const IPC::Message& message, |
| 57 bool* message_was_ok) OVERRIDE; | 57 bool* message_was_ok) OVERRIDE; |
| 58 | 58 |
| 59 void FinishTransaction(int64 host_transaction_id, bool committed); | 59 void FinishTransaction(int64 host_transaction_id, bool committed); |
| 60 | 60 |
| 61 // A shortcut for accessing our context. | 61 // A shortcut for accessing our context. |
| 62 IndexedDBContextImpl* Context() { return indexed_db_context_.get(); } | 62 IndexedDBContextImpl* Context() { return indexed_db_context_.get(); } |
| 63 | 63 |
| 64 // The various IndexedDBCallbacks children call these methods to add the | 64 // The various IndexedDBCallbacks children call these methods to add the |
| 65 // results into the applicable map. See below for more details. | 65 // results into the applicable map. See below for more details. |
| 66 int32 Add(WebKit::WebIDBCursor* idb_cursor); | 66 int32 Add(WebIDBCursorImpl* idb_cursor); |
| 67 int32 Add(WebKit::WebIDBDatabase* idb_database, | 67 int32 Add(WebIDBDatabaseImpl* idb_database, |
| 68 int32 ipc_thread_id, | 68 int32 ipc_thread_id, |
| 69 const GURL& origin_url); | 69 const GURL& origin_url); |
| 70 | 70 |
| 71 void RegisterTransactionId(int64 host_transaction_id, const GURL& origin_url); | 71 void RegisterTransactionId(int64 host_transaction_id, const GURL& origin_url); |
| 72 | 72 |
| 73 WebKit::WebIDBCursor* GetCursorFromId(int32 ipc_cursor_id); | 73 WebIDBCursorImpl* GetCursorFromId(int32 ipc_cursor_id); |
| 74 | 74 |
| 75 int64 HostTransactionId(int64 transaction_id); | 75 int64 HostTransactionId(int64 transaction_id); |
| 76 int64 RendererTransactionId(int64 host_transaction_id); | 76 int64 RendererTransactionId(int64 host_transaction_id); |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 virtual ~IndexedDBDispatcherHost(); | 79 virtual ~IndexedDBDispatcherHost(); |
| 80 | 80 |
| 81 // Message processing. Most of the work is delegated to the dispatcher hosts | 81 // Message processing. Most of the work is delegated to the dispatcher hosts |
| 82 // below. | 82 // below. |
| 83 void OnIDBFactoryGetDatabaseNames( | 83 void OnIDBFactoryGetDatabaseNames( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 void OnCreateIndex( | 147 void OnCreateIndex( |
| 148 const IndexedDBHostMsg_DatabaseCreateIndex_Params& params); | 148 const IndexedDBHostMsg_DatabaseCreateIndex_Params& params); |
| 149 void OnDeleteIndex(int32 ipc_database_id, | 149 void OnDeleteIndex(int32 ipc_database_id, |
| 150 int64 transaction_id, | 150 int64 transaction_id, |
| 151 int64 object_store_id, | 151 int64 object_store_id, |
| 152 int64 index_id); | 152 int64 index_id); |
| 153 | 153 |
| 154 void OnAbort(int32 ipc_database_id, int64 transaction_id); | 154 void OnAbort(int32 ipc_database_id, int64 transaction_id); |
| 155 void OnCommit(int32 ipc_database_id, int64 transaction_id); | 155 void OnCommit(int32 ipc_database_id, int64 transaction_id); |
| 156 IndexedDBDispatcherHost* parent_; | 156 IndexedDBDispatcherHost* parent_; |
| 157 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_; | 157 IDMap<WebIDBDatabaseImpl, IDMapOwnPointer> map_; |
| 158 WebIDBObjectIDToURLMap database_url_map_; | 158 WebIDBObjectIDToURLMap database_url_map_; |
| 159 TransactionIDToSizeMap transaction_size_map_; | 159 TransactionIDToSizeMap transaction_size_map_; |
| 160 TransactionIDToURLMap transaction_url_map_; | 160 TransactionIDToURLMap transaction_url_map_; |
| 161 TransactionIDToDatabaseIDMap transaction_database_map_; | 161 TransactionIDToDatabaseIDMap transaction_database_map_; |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 class CursorDispatcherHost { | 164 class CursorDispatcherHost { |
| 165 public: | 165 public: |
| 166 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); | 166 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); |
| 167 ~CursorDispatcherHost(); | 167 ~CursorDispatcherHost(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 180 void OnPrefetch(int32 ipc_cursor_id, | 180 void OnPrefetch(int32 ipc_cursor_id, |
| 181 int32 ipc_thread_id, | 181 int32 ipc_thread_id, |
| 182 int32 ipc_callbacks_id, | 182 int32 ipc_callbacks_id, |
| 183 int n); | 183 int n); |
| 184 void OnPrefetchReset(int32 ipc_cursor_id, | 184 void OnPrefetchReset(int32 ipc_cursor_id, |
| 185 int used_prefetches, | 185 int used_prefetches, |
| 186 int unused_prefetches); | 186 int unused_prefetches); |
| 187 void OnDestroyed(int32 ipc_cursor_id); | 187 void OnDestroyed(int32 ipc_cursor_id); |
| 188 | 188 |
| 189 IndexedDBDispatcherHost* parent_; | 189 IndexedDBDispatcherHost* parent_; |
| 190 IDMap<WebKit::WebIDBCursor, IDMapOwnPointer> map_; | 190 IDMap<WebIDBCursorImpl, IDMapOwnPointer> map_; |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 193 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 194 | 194 |
| 195 // Only access on WebKit thread. | 195 // Only access on WebKit thread. |
| 196 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 196 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
| 197 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 197 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
| 198 | 198 |
| 199 // Used to dispatch messages to the correct view host. | 199 // Used to dispatch messages to the correct view host. |
| 200 int ipc_process_id_; | 200 int ipc_process_id_; |
| 201 | 201 |
| 202 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 202 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
| 203 }; | 203 }; |
| 204 | 204 |
| 205 } // namespace content | 205 } // namespace content |
| 206 | 206 |
| 207 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 207 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
| OLD | NEW |