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

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

Issue 7470008: Improve IndexedDB's quota support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: finally responded to everything Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/id_map.h" 10 #include "base/id_map.h"
(...skipping 27 matching lines...) Expand all
38 // Only call the constructor from the UI thread. 38 // Only call the constructor from the UI thread.
39 IndexedDBDispatcherHost(int process_id, WebKitContext* webkit_context); 39 IndexedDBDispatcherHost(int process_id, WebKitContext* webkit_context);
40 40
41 // BrowserMessageFilter implementation. 41 // BrowserMessageFilter implementation.
42 virtual void OnChannelClosing(); 42 virtual void OnChannelClosing();
43 virtual void OverrideThreadForMessage(const IPC::Message& message, 43 virtual void OverrideThreadForMessage(const IPC::Message& message,
44 BrowserThread::ID* thread); 44 BrowserThread::ID* thread);
45 virtual bool OnMessageReceived(const IPC::Message& message, 45 virtual bool OnMessageReceived(const IPC::Message& message,
46 bool* message_was_ok); 46 bool* message_was_ok);
47 47
48 void TransactionComplete(int32 transaction_id);
49
48 // A shortcut for accessing our context. 50 // A shortcut for accessing our context.
49 IndexedDBContext* Context() { 51 IndexedDBContext* Context() {
50 return webkit_context_->indexed_db_context(); 52 return webkit_context_->indexed_db_context();
51 } 53 }
52 54
53 // The various IndexedDBCallbacks children call these methods to add the 55 // The various IndexedDBCallbacks children call these methods to add the
54 // results into the applicable map. See below for more details. 56 // results into the applicable map. See below for more details.
55 int32 Add(WebKit::WebIDBCursor* idb_cursor); 57 int32 Add(WebKit::WebIDBCursor* idb_cursor);
56 int32 Add(WebKit::WebIDBDatabase* idb_database, const GURL& origin_url); 58 int32 Add(WebKit::WebIDBDatabase* idb_database, const GURL& origin_url);
57 int32 Add(WebKit::WebIDBIndex* idb_index); 59 int32 Add(WebKit::WebIDBIndex* idb_index);
58 int32 Add(WebKit::WebIDBObjectStore* idb_object_store); 60 int32 Add(WebKit::WebIDBObjectStore* idb_object_store);
59 int32 Add(WebKit::WebIDBTransaction* idb_transaction); 61 int32 Add(WebKit::WebIDBTransaction* idb_transaction, const GURL& origin_url);
60 62
61 private: 63 private:
62 virtual ~IndexedDBDispatcherHost(); 64 virtual ~IndexedDBDispatcherHost();
63 65
64 // Message processing. Most of the work is delegated to the dispatcher hosts 66 // Message processing. Most of the work is delegated to the dispatcher hosts
65 // below. 67 // below.
66 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p); 68 void OnIDBFactoryOpen(const IndexedDBHostMsg_FactoryOpen_Params& p);
67 69
68 void OnIDBFactoryDeleteDatabase( 70 void OnIDBFactoryDeleteDatabase(
69 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p); 71 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p);
70 72
71 void ResetDispatcherHosts(); 73 void ResetDispatcherHosts();
74 void CleanupTransactionMaps(int32 transaction_id);
72 75
73 // Helper templates. 76 // Helper templates.
74 template <class ReturnType> 77 template <class ReturnType>
75 ReturnType* GetOrTerminateProcess( 78 ReturnType* GetOrTerminateProcess(
76 IDMap<ReturnType, IDMapOwnPointer>* map, int32 return_object_id); 79 IDMap<ReturnType, IDMapOwnPointer>* map, int32 return_object_id);
77 80
78 template <typename ReplyType, typename WebObjectType, typename Method> 81 template <typename ReplyType, typename WebObjectType, typename Method>
79 void SyncGetter(IDMap<WebObjectType, IDMapOwnPointer>* map, int32 object_id, 82 void SyncGetter(IDMap<WebObjectType, IDMapOwnPointer>* map, int32 object_id,
80 ReplyType* reply, Method method); 83 ReplyType* reply, Method method);
81 84
82 template <typename ObjectType> 85 template <typename ObjectType>
83 void DestroyObject(IDMap<ObjectType, IDMapOwnPointer>* map, int32 object_id); 86 void DestroyObject(IDMap<ObjectType, IDMapOwnPointer>* map, int32 object_id);
84 87
88 // Used in nested classes.
89 typedef std::map<int32, GURL> WebIDBObjectIDToURLMap;
90 typedef std::map<int32, int64> WebIDBTransactionIDToSizeMap;
91
85 class DatabaseDispatcherHost { 92 class DatabaseDispatcherHost {
86 public: 93 public:
87 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent); 94 explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent);
88 ~DatabaseDispatcherHost(); 95 ~DatabaseDispatcherHost();
89 96
90 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); 97 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok);
91 void Send(IPC::Message* message); 98 void Send(IPC::Message* message);
92 99
93 void OnName(int32 idb_database_id, string16* name); 100 void OnName(int32 idb_database_id, string16* name);
94 void OnVersion(int32 idb_database_id, string16* version); 101 void OnVersion(int32 idb_database_id, string16* version);
(...skipping 14 matching lines...) Expand all
109 const std::vector<string16>& names, 116 const std::vector<string16>& names,
110 int32 mode, int32 timeout, 117 int32 mode, int32 timeout,
111 int32* idb_transaction_id, 118 int32* idb_transaction_id,
112 WebKit::WebExceptionCode* ec); 119 WebKit::WebExceptionCode* ec);
113 void OnOpen(int32 idb_database_id, int32 response_id); 120 void OnOpen(int32 idb_database_id, int32 response_id);
114 void OnClose(int32 idb_database_id); 121 void OnClose(int32 idb_database_id);
115 void OnDestroyed(int32 idb_database_id); 122 void OnDestroyed(int32 idb_database_id);
116 123
117 IndexedDBDispatcherHost* parent_; 124 IndexedDBDispatcherHost* parent_;
118 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_; 125 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_;
119 typedef std::map<int32, GURL> WebIDBDatabaseIDToURLMap; 126 WebIDBObjectIDToURLMap database_url_map_;
120 WebIDBDatabaseIDToURLMap url_map_;
121 }; 127 };
122 128
123 class IndexDispatcherHost { 129 class IndexDispatcherHost {
124 public: 130 public:
125 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent); 131 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent);
126 ~IndexDispatcherHost(); 132 ~IndexDispatcherHost();
127 133
128 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok); 134 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok);
129 void Send(IPC::Message* message); 135 void Send(IPC::Message* message);
130 136
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 void OnObjectStore(int32 transaction_id, 253 void OnObjectStore(int32 transaction_id,
248 const string16& name, 254 const string16& name,
249 int32* object_store_id, 255 int32* object_store_id,
250 WebKit::WebExceptionCode* ec); 256 WebKit::WebExceptionCode* ec);
251 void OnDidCompleteTaskEvents(int transaction_id); 257 void OnDidCompleteTaskEvents(int transaction_id);
252 void OnDestroyed(int32 idb_transaction_id); 258 void OnDestroyed(int32 idb_transaction_id);
253 259
254 IndexedDBDispatcherHost* parent_; 260 IndexedDBDispatcherHost* parent_;
255 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType; 261 typedef IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> MapType;
256 MapType map_; 262 MapType map_;
263 WebIDBObjectIDToURLMap transaction_url_map_;
264 WebIDBTransactionIDToSizeMap transaction_size_map_;
257 }; 265 };
258 266
259 // Data shared between renderer processes with the same profile. 267 // Data shared between renderer processes with the same profile.
260 scoped_refptr<WebKitContext> webkit_context_; 268 scoped_refptr<WebKitContext> webkit_context_;
261 269
262 // Only access on WebKit thread. 270 // Only access on WebKit thread.
263 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; 271 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_;
264 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; 272 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_;
265 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_; 273 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_;
266 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; 274 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_;
267 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_; 275 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_;
268 276
269 // Used to dispatch messages to the correct view host. 277 // Used to dispatch messages to the correct view host.
270 int process_id_; 278 int process_id_;
271 279
272 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 280 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
273 }; 281 };
274 282
275 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ 283 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698