Chromium Code Reviews| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "content/public/browser/browser_message_filter.h" | 14 #include "content/public/browser/browser_message_filter.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 #include "webkit/browser/blob/blob_data_handle.h" | |
| 16 | 17 |
| 17 struct IndexedDBDatabaseMetadata; | 18 struct IndexedDBDatabaseMetadata; |
| 18 struct IndexedDBHostMsg_DatabaseCount_Params; | 19 struct IndexedDBHostMsg_DatabaseCount_Params; |
| 19 struct IndexedDBHostMsg_DatabaseCreateIndex_Params; | 20 struct IndexedDBHostMsg_DatabaseCreateIndex_Params; |
| 20 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; | 21 struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params; |
| 21 struct IndexedDBHostMsg_DatabaseCreateTransaction_Params; | 22 struct IndexedDBHostMsg_DatabaseCreateTransaction_Params; |
| 22 struct IndexedDBHostMsg_DatabaseDeleteRange_Params; | 23 struct IndexedDBHostMsg_DatabaseDeleteRange_Params; |
| 23 struct IndexedDBHostMsg_DatabaseGet_Params; | 24 struct IndexedDBHostMsg_DatabaseGet_Params; |
| 24 struct IndexedDBHostMsg_DatabaseOpenCursor_Params; | 25 struct IndexedDBHostMsg_DatabaseOpenCursor_Params; |
| 25 struct IndexedDBHostMsg_DatabasePut_Params; | 26 struct IndexedDBHostMsg_DatabasePut_Params; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 // These are called to map a 32-bit front-end (renderer-specific) transaction | 74 // These are called to map a 32-bit front-end (renderer-specific) transaction |
| 74 // id to and from a back-end ("host") transaction id that encodes the process | 75 // id to and from a back-end ("host") transaction id that encodes the process |
| 75 // id in the high 32 bits. The mapping is host-specific and ids are validated. | 76 // id in the high 32 bits. The mapping is host-specific and ids are validated. |
| 76 int64 HostTransactionId(int64 transaction_id); | 77 int64 HostTransactionId(int64 transaction_id); |
| 77 int64 RendererTransactionId(int64 host_transaction_id); | 78 int64 RendererTransactionId(int64 host_transaction_id); |
| 78 | 79 |
| 79 // These are called to decode a host transaction ID, for diagnostic purposes. | 80 // These are called to decode a host transaction ID, for diagnostic purposes. |
| 80 static uint32 TransactionIdToRendererTransactionId(int64 host_transaction_id); | 81 static uint32 TransactionIdToRendererTransactionId(int64 host_transaction_id); |
| 81 static uint32 TransactionIdToProcessId(int64 host_transaction_id); | 82 static uint32 TransactionIdToProcessId(int64 host_transaction_id); |
| 82 | 83 |
| 84 void HoldBlobDataHandle( | |
|
jsbell
2014/03/14 21:32:54
FYI to other readers: it looks like we need to mir
| |
| 85 const std::string& uuid, | |
| 86 scoped_ptr<webkit_blob::BlobDataHandle>& blob_data_handle); | |
| 87 void DropBlobDataHandle(const std::string& uuid); | |
| 88 | |
| 83 private: | 89 private: |
| 84 // Friends to enable OnDestruct() delegation. | 90 // Friends to enable OnDestruct() delegation. |
| 85 friend class BrowserThread; | 91 friend class BrowserThread; |
| 86 friend class base::DeleteHelper<IndexedDBDispatcherHost>; | 92 friend class base::DeleteHelper<IndexedDBDispatcherHost>; |
| 87 | 93 |
| 88 virtual ~IndexedDBDispatcherHost(); | 94 virtual ~IndexedDBDispatcherHost(); |
| 89 | 95 |
| 90 // Message processing. Most of the work is delegated to the dispatcher hosts | 96 // Message processing. Most of the work is delegated to the dispatcher hosts |
| 91 // below. | 97 // below. |
| 92 void OnIDBFactoryGetDatabaseNames( | 98 void OnIDBFactoryGetDatabaseNames( |
| 93 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); | 99 const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& p); |
| 94 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); | 100 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); |
| 95 | 101 |
| 96 void OnIDBFactoryDeleteDatabase( | 102 void OnIDBFactoryDeleteDatabase( |
| 97 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); | 103 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); |
| 98 | 104 |
| 105 void OnAckReceivedBlobs(const std::vector<std::string>& uuids); | |
| 106 | |
| 99 void ResetDispatcherHosts(); | 107 void ResetDispatcherHosts(); |
| 100 | 108 |
| 101 // IDMap for RefCounted types | 109 // IDMap for RefCounted types |
| 102 template <typename RefCountedType> | 110 template <typename RefCountedType> |
| 103 class RefIDMap { | 111 class RefIDMap { |
| 104 private: | 112 private: |
| 105 typedef int32 KeyType; | 113 typedef int32 KeyType; |
| 106 | 114 |
| 107 public: | 115 public: |
| 108 RefIDMap() {} | 116 RefIDMap() {} |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 int used_prefetches, | 231 int used_prefetches, |
| 224 int unused_prefetches); | 232 int unused_prefetches); |
| 225 void OnDestroyed(int32 ipc_cursor_id); | 233 void OnDestroyed(int32 ipc_cursor_id); |
| 226 | 234 |
| 227 IndexedDBDispatcherHost* parent_; | 235 IndexedDBDispatcherHost* parent_; |
| 228 RefIDMap<IndexedDBCursor> map_; | 236 RefIDMap<IndexedDBCursor> map_; |
| 229 }; | 237 }; |
| 230 | 238 |
| 231 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; | 239 scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
| 232 | 240 |
| 241 typedef std::map<std::string, webkit_blob::BlobDataHandle*> BlobDataHandleMap; | |
| 242 BlobDataHandleMap blob_data_handle_map_; | |
| 243 | |
| 233 // Only access on IndexedDB thread. | 244 // Only access on IndexedDB thread. |
| 234 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; | 245 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; |
| 235 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; | 246 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; |
| 236 | 247 |
| 237 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); | 248 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); |
| 238 }; | 249 }; |
| 239 | 250 |
| 240 } // namespace content | 251 } // namespace content |
| 241 | 252 |
| 242 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ | 253 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ |
| OLD | NEW |