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