| 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 12 matching lines...) Expand all Loading... |
| 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; | 31 class WebIDBCursor; |
| 32 class WebIDBDatabase; | 32 class WebIDBDatabase; |
| 33 class WebIDBIndex; |
| 34 class WebIDBObjectStore; |
| 33 struct WebIDBMetadata; | 35 struct WebIDBMetadata; |
| 34 } | 36 } |
| 35 | 37 |
| 36 namespace content { | 38 namespace content { |
| 37 class IndexedDBContextImpl; | 39 class IndexedDBContextImpl; |
| 38 class IndexedDBKey; | 40 class IndexedDBKey; |
| 39 class IndexedDBKeyPath; | 41 class IndexedDBKeyPath; |
| 40 class IndexedDBKeyRange; | 42 class IndexedDBKeyRange; |
| 41 | 43 |
| 42 // Handles all IndexedDB related messages from a particular renderer process. | 44 // Handles all IndexedDB related messages from a particular renderer process. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); | 86 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); |
| 85 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); | 87 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); |
| 86 | 88 |
| 87 void OnIDBFactoryDeleteDatabase( | 89 void OnIDBFactoryDeleteDatabase( |
| 88 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); | 90 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); |
| 89 | 91 |
| 90 void ResetDispatcherHosts(); | 92 void ResetDispatcherHosts(); |
| 91 | 93 |
| 92 // Helper templates. | 94 // Helper templates. |
| 93 template <class ReturnType> | 95 template <class ReturnType> |
| 94 ReturnType* GetOrTerminateProcess(IDMap<ReturnType, IDMapOwnPointer>* map, | 96 ReturnType* GetOrTerminateProcess( |
| 95 int32 ipc_return_object_id); | 97 IDMap<ReturnType, IDMapOwnPointer>* map, int32 ipc_return_object_id); |
| 96 | 98 |
| 97 template <typename ObjectType> | 99 template <typename ObjectType> |
| 98 void DestroyObject(IDMap<ObjectType, IDMapOwnPointer>* map, | 100 void DestroyObject(IDMap<ObjectType, IDMapOwnPointer>* map, |
| 99 int32 ipc_object_id); | 101 int32 ipc_object_id); |
| 100 | 102 |
| 101 // Used in nested classes. | 103 // Used in nested classes. |
| 102 typedef std::map<int32, GURL> WebIDBObjectIDToURLMap; | 104 typedef std::map<int32, GURL> WebIDBObjectIDToURLMap; |
| 103 | 105 |
| 104 typedef std::map<int64, GURL> TransactionIDToURLMap; | 106 typedef std::map<int64, GURL> TransactionIDToURLMap; |
| 105 typedef std::map<int64, uint64> TransactionIDToSizeMap; | 107 typedef std::map<int64, uint64> TransactionIDToSizeMap; |
| 106 typedef std::map<int64, int64> TransactionIDToDatabaseIDMap; | 108 typedef std::map<int64, int64> TransactionIDToDatabaseIDMap; |
| 107 | 109 |
| 108 class DatabaseDispatcherHost { | 110 class DatabaseDispatcherHost { |
| 109 public: | 111 public: |
| 110 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent); | 112 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent); |
| 111 ~DatabaseDispatcherHost(); | 113 ~DatabaseDispatcherHost(); |
| 112 | 114 |
| 113 void CloseAll(); | 115 void CloseAll(); |
| 114 bool OnMessageReceived(const IPC::Message& message, bool* msg_is_ok); | 116 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); |
| 115 void Send(IPC::Message* message); | 117 void Send(IPC::Message* message); |
| 116 | 118 |
| 117 void OnCreateObjectStore( | 119 void OnCreateObjectStore( |
| 118 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params); | 120 const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params); |
| 119 void OnDeleteObjectStore(int32 ipc_database_id, | 121 void OnDeleteObjectStore(int32 ipc_database_id, |
| 120 int64 transaction_id, | 122 int64 transaction_id, |
| 121 int64 object_store_id); | 123 int64 object_store_id); |
| 122 void OnCreateTransaction( | 124 void OnCreateTransaction( |
| 123 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); | 125 const IndexedDBHostMsg_DatabaseCreateTransaction_Params&); |
| 124 void OnOpen(int32 ipc_database_id, | 126 void OnOpen(int32 ipc_database_id, int32 ipc_thread_id, |
| 125 int32 ipc_thread_id, | |
| 126 int32 ipc_callbacks_id); | 127 int32 ipc_callbacks_id); |
| 127 void OnClose(int32 ipc_database_id); | 128 void OnClose(int32 ipc_database_id); |
| 128 void OnDestroyed(int32 ipc_database_id); | 129 void OnDestroyed(int32 ipc_database_id); |
| 129 | 130 |
| 130 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); | 131 void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params); |
| 131 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params); | 132 void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params); |
| 132 void OnSetIndexKeys( | 133 void OnSetIndexKeys( |
| 133 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); | 134 const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params); |
| 134 void OnSetIndexesReady(int32 ipc_database_id, | 135 void OnSetIndexesReady( |
| 135 int64 transaction_id, | 136 int32 ipc_database_id, |
| 136 int64 object_store_id, | 137 int64 transaction_id, |
| 137 const std::vector<int64>& ids); | 138 int64 object_store_id, |
| 138 void OnOpenCursor(const IndexedDBHostMsg_DatabaseOpenCursor_Params& params); | 139 const std::vector<int64>& ids); |
| 140 void OnOpenCursor( |
| 141 const IndexedDBHostMsg_DatabaseOpenCursor_Params& params); |
| 139 void OnCount(const IndexedDBHostMsg_DatabaseCount_Params& params); | 142 void OnCount(const IndexedDBHostMsg_DatabaseCount_Params& params); |
| 140 void OnDeleteRange( | 143 void OnDeleteRange( |
| 141 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params); | 144 const IndexedDBHostMsg_DatabaseDeleteRange_Params& params); |
| 142 void OnClear(int32 ipc_thread_id, | 145 void OnClear(int32 ipc_thread_id, |
| 143 int32 ipc_callbacks_id, | 146 int32 ipc_callbacks_id, |
| 144 int32 ipc_database_id, | 147 int32 ipc_database_id, |
| 145 int64 transaction_id, | 148 int64 transaction_id, |
| 146 int64 object_store_id); | 149 int64 object_store_id); |
| 147 void OnCreateIndex( | 150 void OnCreateIndex( |
| 148 const IndexedDBHostMsg_DatabaseCreateIndex_Params& params); | 151 const IndexedDBHostMsg_DatabaseCreateIndex_Params& params); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 159 TransactionIDToSizeMap transaction_size_map_; | 162 TransactionIDToSizeMap transaction_size_map_; |
| 160 TransactionIDToURLMap transaction_url_map_; | 163 TransactionIDToURLMap transaction_url_map_; |
| 161 TransactionIDToDatabaseIDMap transaction_database_map_; | 164 TransactionIDToDatabaseIDMap transaction_database_map_; |
| 162 }; | 165 }; |
| 163 | 166 |
| 164 class CursorDispatcherHost { | 167 class CursorDispatcherHost { |
| 165 public: | 168 public: |
| 166 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); | 169 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); |
| 167 ~CursorDispatcherHost(); | 170 ~CursorDispatcherHost(); |
| 168 | 171 |
| 169 bool OnMessageReceived(const IPC::Message& message, bool* msg_is_ok); | 172 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); |
| 170 void Send(IPC::Message* message); | 173 void Send(IPC::Message* message); |
| 171 | 174 |
| 172 void OnAdvance(int32 ipc_object_store_id, | 175 void OnAdvance(int32 ipc_object_store_id, |
| 173 int32 ipc_thread_id, | 176 int32 ipc_thread_id, |
| 174 int32 ipc_callbacks_id, | 177 int32 ipc_callbacks_id, |
| 175 unsigned long count); | 178 unsigned long count); |
| 176 void OnContinue(int32 ipc_object_store_id, | 179 void OnContinue(int32 ipc_object_store_id, |
| 177 int32 ipc_thread_id, | 180 int32 ipc_thread_id, |
| 178 int32 ipc_callbacks_id, | 181 int32 ipc_callbacks_id, |
| 179 const IndexedDBKey& key); | 182 const IndexedDBKey& key); |
| 180 void OnPrefetch(int32 ipc_cursor_id, | 183 void OnPrefetch(int32 ipc_cursor_id, |
| 181 int32 ipc_thread_id, | 184 int32 ipc_thread_id, |
| 182 int32 ipc_callbacks_id, | 185 int32 ipc_callbacks_id, |
| 183 int n); | 186 int n); |
| 184 void OnPrefetchReset(int32 ipc_cursor_id, | 187 void OnPrefetchReset(int32 ipc_cursor_id, int used_prefetches, |
| 185 int used_prefetches, | |
| 186 int unused_prefetches); | 188 int unused_prefetches); |
| 187 void OnDelete(int32 ipc_object_store_id, | 189 void OnDelete(int32 ipc_object_store_id, |
| 188 int32 ipc_thread_id, | 190 int32 ipc_thread_id, |
| 189 int32 ipc_callbacks_id); | 191 int32 ipc_callbacks_id); |
| 190 void OnDestroyed(int32 ipc_cursor_id); | 192 void OnDestroyed(int32 ipc_cursor_id); |
| 191 | 193 |
| 192 IndexedDBDispatcherHost* parent_; | 194 IndexedDBDispatcherHost* parent_; |
| 193 IDMap<WebKit::WebIDBCursor, IDMapOwnPointer> map_; | 195 IDMap<WebKit::WebIDBCursor, IDMapOwnPointer> map_; |
| 194 }; | 196 }; |
| 195 | 197 |
| 196 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 198 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 197 | 199 |
| 198 // Only access on WebKit thread. | 200 // Only access on WebKit thread. |
| 199 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 201 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
| 200 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 202 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
| 201 | 203 |
| 202 // Used to dispatch messages to the correct view host. | 204 // Used to dispatch messages to the correct view host. |
| 203 int ipc_process_id_; | 205 int ipc_process_id_; |
| 204 | 206 |
| 205 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 207 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
| 206 }; | 208 }; |
| 207 | 209 |
| 208 } // namespace content | 210 } // namespace content |
| 209 | 211 |
| 210 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ | 212 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ |
| OLD | NEW |