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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 | 143 |
144 void Remove(KeyType id) { map_.Remove(id); } | 144 void Remove(KeyType id) { map_.Remove(id); } |
145 | 145 |
146 void set_check_on_null_data(bool value) { | 146 void set_check_on_null_data(bool value) { |
147 map_.set_check_on_null_data(value); | 147 map_.set_check_on_null_data(value); |
148 } | 148 } |
149 | 149 |
150 private: | 150 private: |
151 IDMap<scoped_refptr<RefCountedType>, IDMapOwnPointer> map_; | 151 IDMap<scoped_refptr<RefCountedType>, IDMapOwnPointer> map_; |
| 152 |
| 153 DISALLOW_COPY_AND_ASSIGN(RefIDMap); |
152 }; | 154 }; |
153 | 155 |
154 // Helper templates. | 156 // Helper templates. |
155 template <class ReturnType> | 157 template <class ReturnType> |
156 ReturnType* GetOrTerminateProcess(IDMap<ReturnType, IDMapOwnPointer>* map, | 158 ReturnType* GetOrTerminateProcess(IDMap<ReturnType, IDMapOwnPointer>* map, |
157 int32 ipc_return_object_id); | 159 int32 ipc_return_object_id); |
158 template <class ReturnType> | 160 template <class ReturnType> |
159 ReturnType* GetOrTerminateProcess(RefIDMap<ReturnType>* map, | 161 ReturnType* GetOrTerminateProcess(RefIDMap<ReturnType>* map, |
160 int32 ipc_return_object_id); | 162 int32 ipc_return_object_id); |
161 | 163 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 int64 index_id); | 218 int64 index_id); |
217 | 219 |
218 void OnAbort(int32 ipc_database_id, int64 transaction_id); | 220 void OnAbort(int32 ipc_database_id, int64 transaction_id); |
219 void OnCommit(int32 ipc_database_id, int64 transaction_id); | 221 void OnCommit(int32 ipc_database_id, int64 transaction_id); |
220 IndexedDBDispatcherHost* parent_; | 222 IndexedDBDispatcherHost* parent_; |
221 IDMap<IndexedDBConnection, IDMapOwnPointer> map_; | 223 IDMap<IndexedDBConnection, IDMapOwnPointer> map_; |
222 WebIDBObjectIDToURLMap database_url_map_; | 224 WebIDBObjectIDToURLMap database_url_map_; |
223 TransactionIDToSizeMap transaction_size_map_; | 225 TransactionIDToSizeMap transaction_size_map_; |
224 TransactionIDToURLMap transaction_url_map_; | 226 TransactionIDToURLMap transaction_url_map_; |
225 TransactionIDToDatabaseIDMap transaction_database_map_; | 227 TransactionIDToDatabaseIDMap transaction_database_map_; |
| 228 |
| 229 private: |
| 230 DISALLOW_COPY_AND_ASSIGN(DatabaseDispatcherHost); |
226 }; | 231 }; |
227 | 232 |
228 class CursorDispatcherHost { | 233 class CursorDispatcherHost { |
229 public: | 234 public: |
230 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); | 235 explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent); |
231 ~CursorDispatcherHost(); | 236 ~CursorDispatcherHost(); |
232 | 237 |
233 bool OnMessageReceived(const IPC::Message& message); | 238 bool OnMessageReceived(const IPC::Message& message); |
234 | 239 |
235 void OnAdvance(int32 ipc_object_store_id, | 240 void OnAdvance(int32 ipc_object_store_id, |
236 int32 ipc_thread_id, | 241 int32 ipc_thread_id, |
237 int32 ipc_callbacks_id, | 242 int32 ipc_callbacks_id, |
238 unsigned long count); | 243 unsigned long count); |
239 void OnContinue(int32 ipc_object_store_id, | 244 void OnContinue(int32 ipc_object_store_id, |
240 int32 ipc_thread_id, | 245 int32 ipc_thread_id, |
241 int32 ipc_callbacks_id, | 246 int32 ipc_callbacks_id, |
242 const IndexedDBKey& key, | 247 const IndexedDBKey& key, |
243 const IndexedDBKey& primary_key); | 248 const IndexedDBKey& primary_key); |
244 void OnPrefetch(int32 ipc_cursor_id, | 249 void OnPrefetch(int32 ipc_cursor_id, |
245 int32 ipc_thread_id, | 250 int32 ipc_thread_id, |
246 int32 ipc_callbacks_id, | 251 int32 ipc_callbacks_id, |
247 int n); | 252 int n); |
248 void OnPrefetchReset(int32 ipc_cursor_id, | 253 void OnPrefetchReset(int32 ipc_cursor_id, |
249 int used_prefetches, | 254 int used_prefetches, |
250 int unused_prefetches); | 255 int unused_prefetches); |
251 void OnDestroyed(int32 ipc_cursor_id); | 256 void OnDestroyed(int32 ipc_cursor_id); |
252 | 257 |
253 IndexedDBDispatcherHost* parent_; | 258 IndexedDBDispatcherHost* parent_; |
254 RefIDMap<IndexedDBCursor> map_; | 259 RefIDMap<IndexedDBCursor> map_; |
| 260 |
| 261 private: |
| 262 DISALLOW_COPY_AND_ASSIGN(CursorDispatcherHost); |
255 }; | 263 }; |
256 | 264 |
257 // The getter holds the context until OnChannelConnected() can be called from | 265 // The getter holds the context until OnChannelConnected() can be called from |
258 // the IO thread, which will extract the net::URLRequestContext from it. | 266 // the IO thread, which will extract the net::URLRequestContext from it. |
259 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 267 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
260 net::URLRequestContext* request_context_; | 268 net::URLRequestContext* request_context_; |
261 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 269 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
262 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; | 270 scoped_refptr<ChromeBlobStorageContext> blob_storage_context_; |
263 | 271 |
264 typedef std::map<std::string, webkit_blob::BlobDataHandle*> BlobDataHandleMap; | 272 typedef std::map<std::string, webkit_blob::BlobDataHandle*> BlobDataHandleMap; |
265 BlobDataHandleMap blob_data_handle_map_; | 273 BlobDataHandleMap blob_data_handle_map_; |
266 | 274 |
267 // Only access on IndexedDB thread. | 275 // Only access on IndexedDB thread. |
268 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 276 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
269 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 277 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
270 | 278 |
271 // Used to set file permissions for blob storage. | 279 // Used to set file permissions for blob storage. |
272 int ipc_process_id_; | 280 int ipc_process_id_; |
273 | 281 |
274 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 282 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
275 }; | 283 }; |
276 | 284 |
277 } // namespace content | 285 } // namespace content |
278 | 286 |
279 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 287 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
OLD | NEW |