| 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 30 matching lines...) Expand all Loading... |
| 41 public: | 41 public: |
| 42 // Only call the constructor from the UI thread. | 42 // Only call the constructor from the UI thread. |
| 43 IndexedDBDispatcherHost(int ipc_process_id, | 43 IndexedDBDispatcherHost(int ipc_process_id, |
| 44 IndexedDBContextImpl* indexed_db_context); | 44 IndexedDBContextImpl* indexed_db_context); |
| 45 | 45 |
| 46 static ::IndexedDBDatabaseMetadata ConvertMetadata( | 46 static ::IndexedDBDatabaseMetadata ConvertMetadata( |
| 47 const content::IndexedDBDatabaseMetadata& metadata); | 47 const content::IndexedDBDatabaseMetadata& metadata); |
| 48 | 48 |
| 49 // BrowserMessageFilter implementation. | 49 // BrowserMessageFilter implementation. |
| 50 virtual void OnChannelClosing() OVERRIDE; | 50 virtual void OnChannelClosing() OVERRIDE; |
| 51 virtual void OverrideThreadForMessage(const IPC::Message& message, | 51 virtual void OnDestruct() const OVERRIDE; |
| 52 BrowserThread::ID* thread) OVERRIDE; | 52 virtual base::TaskRunner* OverrideTaskRunnerForMessage( |
| 53 const IPC::Message& message) OVERRIDE; |
| 53 virtual bool OnMessageReceived(const IPC::Message& message, | 54 virtual bool OnMessageReceived(const IPC::Message& message, |
| 54 bool* message_was_ok) OVERRIDE; | 55 bool* message_was_ok) OVERRIDE; |
| 55 | 56 |
| 56 void FinishTransaction(int64 host_transaction_id, bool committed); | 57 void FinishTransaction(int64 host_transaction_id, bool committed); |
| 57 | 58 |
| 58 // A shortcut for accessing our context. | 59 // A shortcut for accessing our context. |
| 59 IndexedDBContextImpl* Context() { return indexed_db_context_.get(); } | 60 IndexedDBContextImpl* Context() { return indexed_db_context_.get(); } |
| 60 | 61 |
| 61 // The various IndexedDBCallbacks children call these methods to add the | 62 // The various IndexedDBCallbacks children call these methods to add the |
| 62 // results into the applicable map. See below for more details. | 63 // results into the applicable map. See below for more details. |
| 63 int32 Add(WebIDBCursorImpl* idb_cursor); | 64 int32 Add(WebIDBCursorImpl* idb_cursor); |
| 64 int32 Add(WebIDBDatabaseImpl* idb_database, | 65 int32 Add(WebIDBDatabaseImpl* idb_database, |
| 65 int32 ipc_thread_id, | 66 int32 ipc_thread_id, |
| 66 const GURL& origin_url); | 67 const GURL& origin_url); |
| 67 | 68 |
| 68 void RegisterTransactionId(int64 host_transaction_id, const GURL& origin_url); | 69 void RegisterTransactionId(int64 host_transaction_id, const GURL& origin_url); |
| 69 | 70 |
| 70 WebIDBCursorImpl* GetCursorFromId(int32 ipc_cursor_id); | 71 WebIDBCursorImpl* GetCursorFromId(int32 ipc_cursor_id); |
| 71 | 72 |
| 72 int64 HostTransactionId(int64 transaction_id); | 73 int64 HostTransactionId(int64 transaction_id); |
| 73 int64 RendererTransactionId(int64 host_transaction_id); | 74 int64 RendererTransactionId(int64 host_transaction_id); |
| 74 | 75 |
| 75 private: | 76 private: |
| 77 // Friends to enable OnDestruct() delegation. |
| 78 friend class BrowserThread; |
| 79 friend class base::DeleteHelper<IndexedDBDispatcherHost>; |
| 80 |
| 76 virtual ~IndexedDBDispatcherHost(); | 81 virtual ~IndexedDBDispatcherHost(); |
| 77 | 82 |
| 78 // Message processing. Most of the work is delegated to the dispatcher hosts | 83 // Message processing. Most of the work is delegated to the dispatcher hosts |
| 79 // below. | 84 // below. |
| 80 void OnIDBFactoryGetDatabaseNames( | 85 void OnIDBFactoryGetDatabaseNames( |
| 81 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); | 86 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); |
| 82 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); | 87 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); |
| 83 | 88 |
| 84 void OnIDBFactoryDeleteDatabase( | 89 void OnIDBFactoryDeleteDatabase( |
| 85 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); | 90 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 int used_prefetches, | 187 int used_prefetches, |
| 183 int unused_prefetches); | 188 int unused_prefetches); |
| 184 void OnDestroyed(int32 ipc_cursor_id); | 189 void OnDestroyed(int32 ipc_cursor_id); |
| 185 | 190 |
| 186 IndexedDBDispatcherHost* parent_; | 191 IndexedDBDispatcherHost* parent_; |
| 187 IDMap<WebIDBCursorImpl, IDMapOwnPointer> map_; | 192 IDMap<WebIDBCursorImpl, IDMapOwnPointer> map_; |
| 188 }; | 193 }; |
| 189 | 194 |
| 190 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 195 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 191 | 196 |
| 192 // Only access on WebKit thread. | 197 // Only access on IndexedDB thread. |
| 193 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 198 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
| 194 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 199 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
| 195 | 200 |
| 196 // Used to dispatch messages to the correct view host. | 201 // Used to dispatch messages to the correct view host. |
| 197 int ipc_process_id_; | 202 int ipc_process_id_; |
| 198 | 203 |
| 199 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 204 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
| 200 }; | 205 }; |
| 201 | 206 |
| 202 } // namespace content | 207 } // namespace content |
| 203 | 208 |
| 204 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 209 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
| OLD | NEW |