Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: content/browser/indexed_db/indexed_db_dispatcher_host.h

Issue 1841553002: IndexedDB: Use url::Origin rather than GURL for representing origins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@origin-idb
Patch Set: Rebased Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 21 matching lines...) Expand all
32 struct IndexedDBHostMsg_DatabaseDeleteRange_Params; 32 struct IndexedDBHostMsg_DatabaseDeleteRange_Params;
33 struct IndexedDBHostMsg_DatabaseGet_Params; 33 struct IndexedDBHostMsg_DatabaseGet_Params;
34 struct IndexedDBHostMsg_DatabaseGetAll_Params; 34 struct IndexedDBHostMsg_DatabaseGetAll_Params;
35 struct IndexedDBHostMsg_DatabaseOpenCursor_Params; 35 struct IndexedDBHostMsg_DatabaseOpenCursor_Params;
36 struct IndexedDBHostMsg_DatabasePut_Params; 36 struct IndexedDBHostMsg_DatabasePut_Params;
37 struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params; 37 struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params;
38 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params; 38 struct IndexedDBHostMsg_FactoryDeleteDatabase_Params;
39 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; 39 struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params;
40 struct IndexedDBHostMsg_FactoryOpen_Params; 40 struct IndexedDBHostMsg_FactoryOpen_Params;
41 41
42 namespace url {
43 class Origin;
44 }
45
42 namespace content { 46 namespace content {
43 class IndexedDBBlobInfo; 47 class IndexedDBBlobInfo;
44 class IndexedDBConnection; 48 class IndexedDBConnection;
45 class IndexedDBContextImpl; 49 class IndexedDBContextImpl;
46 class IndexedDBCursor; 50 class IndexedDBCursor;
47 class IndexedDBKey; 51 class IndexedDBKey;
48 class IndexedDBKeyPath; 52 class IndexedDBKeyPath;
49 class IndexedDBKeyRange; 53 class IndexedDBKeyRange;
50 struct IndexedDBDatabaseMetadata; 54 struct IndexedDBDatabaseMetadata;
51 55
(...skipping 27 matching lines...) Expand all
79 IndexedDBContextImpl* context() const { return indexed_db_context_.get(); } 83 IndexedDBContextImpl* context() const { return indexed_db_context_.get(); }
80 storage::BlobStorageContext* blob_storage_context() const { 84 storage::BlobStorageContext* blob_storage_context() const {
81 return blob_storage_context_->context(); 85 return blob_storage_context_->context();
82 } 86 }
83 87
84 // IndexedDBCallbacks call these methods to add the results into the 88 // IndexedDBCallbacks call these methods to add the results into the
85 // applicable map. See below for more details. 89 // applicable map. See below for more details.
86 int32_t Add(IndexedDBCursor* cursor); 90 int32_t Add(IndexedDBCursor* cursor);
87 int32_t Add(IndexedDBConnection* connection, 91 int32_t Add(IndexedDBConnection* connection,
88 int32_t ipc_thread_id, 92 int32_t ipc_thread_id,
89 const GURL& origin_url); 93 const url::Origin& origin);
90 94
91 void RegisterTransactionId(int64_t host_transaction_id, 95 void RegisterTransactionId(int64_t host_transaction_id,
92 const GURL& origin_url); 96 const url::Origin& origin);
93 97
94 IndexedDBCursor* GetCursorFromId(int32_t ipc_cursor_id); 98 IndexedDBCursor* GetCursorFromId(int32_t ipc_cursor_id);
95 99
96 // These are called to map a 32-bit front-end (renderer-specific) transaction 100 // These are called to map a 32-bit front-end (renderer-specific) transaction
97 // id to and from a back-end ("host") transaction id that encodes the process 101 // id to and from a back-end ("host") transaction id that encodes the process
98 // id in the high 32 bits. The mapping is host-specific and ids are validated. 102 // id in the high 32 bits. The mapping is host-specific and ids are validated.
99 int64_t HostTransactionId(int64_t transaction_id); 103 int64_t HostTransactionId(int64_t transaction_id);
100 int64_t RendererTransactionId(int64_t host_transaction_id); 104 int64_t RendererTransactionId(int64_t host_transaction_id);
101 105
102 // These are called to decode a host transaction ID, for diagnostic purposes. 106 // These are called to decode a host transaction ID, for diagnostic purposes.
103 static uint32_t TransactionIdToRendererTransactionId( 107 static uint32_t TransactionIdToRendererTransactionId(
104 int64_t host_transaction_id); 108 int64_t host_transaction_id);
105 static uint32_t TransactionIdToProcessId(int64_t host_transaction_id); 109 static uint32_t TransactionIdToProcessId(int64_t host_transaction_id);
106 110
107 std::string HoldBlobData(const IndexedDBBlobInfo& blob_info); 111 std::string HoldBlobData(const IndexedDBBlobInfo& blob_info);
108 112
109 private: 113 private:
110 // Friends to enable OnDestruct() delegation. 114 // Friends to enable OnDestruct() delegation.
111 friend class BrowserThread; 115 friend class BrowserThread;
112 friend class base::DeleteHelper<IndexedDBDispatcherHost>; 116 friend class base::DeleteHelper<IndexedDBDispatcherHost>;
113 117
114 // Used in nested classes. 118 // Used in nested classes.
115 typedef std::map<std::string, std::pair<storage::BlobDataHandle*, int>> 119 typedef std::map<std::string, std::pair<storage::BlobDataHandle*, int>>
116 BlobDataHandleMap; 120 BlobDataHandleMap;
117 typedef std::map<int64_t, int64_t> TransactionIDToDatabaseIDMap; 121 typedef std::map<int64_t, int64_t> TransactionIDToDatabaseIDMap;
118 typedef std::map<int64_t, uint64_t> TransactionIDToSizeMap; 122 typedef std::map<int64_t, uint64_t> TransactionIDToSizeMap;
119 typedef std::map<int64_t, GURL> TransactionIDToURLMap; 123 typedef std::map<int64_t, url::Origin> TransactionIDToOriginMap;
120 typedef std::map<int32_t, GURL> WebIDBObjectIDToURLMap; 124 typedef std::map<int32_t, url::Origin> WebIDBObjectIDToOriginMap;
121 125
122 // IDMap for RefCounted types 126 // IDMap for RefCounted types
123 template <typename RefCountedType> 127 template <typename RefCountedType>
124 class RefIDMap { 128 class RefIDMap {
125 public: 129 public:
126 typedef int32_t KeyType; 130 typedef int32_t KeyType;
127 131
128 RefIDMap() {} 132 RefIDMap() {}
129 ~RefIDMap() {} 133 ~RefIDMap() {}
130 134
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void OnAbort(int32_t ipc_database_id, int64_t transaction_id); 206 void OnAbort(int32_t ipc_database_id, int64_t transaction_id);
203 void OnCommit(int32_t ipc_database_id, int64_t transaction_id); 207 void OnCommit(int32_t ipc_database_id, int64_t transaction_id);
204 void OnGotUsageAndQuotaForCommit(int32_t ipc_database_id, 208 void OnGotUsageAndQuotaForCommit(int32_t ipc_database_id,
205 int64_t transaction_id, 209 int64_t transaction_id,
206 storage::QuotaStatusCode status, 210 storage::QuotaStatusCode status,
207 int64_t usage, 211 int64_t usage,
208 int64_t quota); 212 int64_t quota);
209 213
210 IndexedDBDispatcherHost* parent_; 214 IndexedDBDispatcherHost* parent_;
211 IDMap<IndexedDBConnection, IDMapOwnPointer> map_; 215 IDMap<IndexedDBConnection, IDMapOwnPointer> map_;
212 WebIDBObjectIDToURLMap database_url_map_; 216 WebIDBObjectIDToOriginMap database_origin_map_;
213 TransactionIDToSizeMap transaction_size_map_; 217 TransactionIDToSizeMap transaction_size_map_;
214 TransactionIDToURLMap transaction_url_map_; 218 TransactionIDToOriginMap transaction_origin_map_;
215 TransactionIDToDatabaseIDMap transaction_database_map_; 219 TransactionIDToDatabaseIDMap transaction_database_map_;
216 220
217 // Weak pointers are used when an asynchronous quota request is made, in 221 // Weak pointers are used when an asynchronous quota request is made, in
218 // case the dispatcher is torn down before the response returns. 222 // case the dispatcher is torn down before the response returns.
219 base::WeakPtrFactory<DatabaseDispatcherHost> weak_factory_; 223 base::WeakPtrFactory<DatabaseDispatcherHost> weak_factory_;
220 224
221 private: 225 private:
222 DISALLOW_COPY_AND_ASSIGN(DatabaseDispatcherHost); 226 DISALLOW_COPY_AND_ASSIGN(DatabaseDispatcherHost);
223 }; 227 };
224 228
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 302
299 // Used to set file permissions for blob storage. 303 // Used to set file permissions for blob storage.
300 int ipc_process_id_; 304 int ipc_process_id_;
301 305
302 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 306 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
303 }; 307 };
304 308
305 } // namespace content 309 } // namespace content
306 310
307 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ 311 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_database.cc ('k') | content/browser/indexed_db/indexed_db_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698