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

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

Issue 3163028: Fix compilation errors of 56862 (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix include path (again) Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_
6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ 6 #define CHROME_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"
11 #include "base/process.h" 11 #include "base/process.h"
12 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
13 #include "chrome/browser/in_process_webkit/webkit_context.h" 13 #include "chrome/browser/in_process_webkit/webkit_context.h"
14 #include "ipc/ipc_message.h" 14 #include "ipc/ipc_message.h"
15 15
16 class IndexedDBKey; 16 class IndexedDBKey;
17 class SerializedScriptValue; 17 class SerializedScriptValue;
18 struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params; 18 struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params;
19 struct ViewHostMsg_IDBFactoryOpen_Params; 19 struct ViewHostMsg_IDBFactoryOpen_Params;
20 struct ViewHostMsg_IDBObjectStoreCreateIndex_Params; 20 struct ViewHostMsg_IDBObjectStoreCreateIndex_Params;
21 struct ViewHostMsg_IDBObjectStoreOpenCursor_Params; 21 struct ViewHostMsg_IDBObjectStoreOpenCursor_Params;
22 22
23 namespace WebKit { 23 namespace WebKit {
24 class WebIDBCursor; 24 class WebIDBCursor;
25 class WebIDBDatabase; 25 class WebIDBDatabase;
26 class WebIDBIndex; 26 class WebIDBIndex;
27 class WebIDBObjectStore; 27 class WebIDBObjectStore;
28 class WebIDBTransaction;
28 } 29 }
29 30
30 // Handles all IndexedDB related messages from a particular renderer process. 31 // Handles all IndexedDB related messages from a particular renderer process.
31 class IndexedDBDispatcherHost 32 class IndexedDBDispatcherHost
32 : public base::RefCountedThreadSafe<IndexedDBDispatcherHost> { 33 : public base::RefCountedThreadSafe<IndexedDBDispatcherHost> {
33 public: 34 public:
34 // Only call the constructor from the UI thread. 35 // Only call the constructor from the UI thread.
35 IndexedDBDispatcherHost(IPC::Message::Sender* sender, 36 IndexedDBDispatcherHost(IPC::Message::Sender* sender,
36 WebKitContext* webkit_context); 37 WebKitContext* webkit_context);
37 38
(...skipping 15 matching lines...) Expand all
53 IndexedDBContext* Context() { 54 IndexedDBContext* Context() {
54 return webkit_context_->indexed_db_context(); 55 return webkit_context_->indexed_db_context();
55 } 56 }
56 57
57 // The various IndexedDBCallbacks children call these methods to add the 58 // The various IndexedDBCallbacks children call these methods to add the
58 // results into the applicable map. See below for more details. 59 // results into the applicable map. See below for more details.
59 int32 Add(WebKit::WebIDBCursor* idb_cursor); 60 int32 Add(WebKit::WebIDBCursor* idb_cursor);
60 int32 Add(WebKit::WebIDBDatabase* idb_database); 61 int32 Add(WebKit::WebIDBDatabase* idb_database);
61 int32 Add(WebKit::WebIDBIndex* idb_index); 62 int32 Add(WebKit::WebIDBIndex* idb_index);
62 int32 Add(WebKit::WebIDBObjectStore* idb_object_store); 63 int32 Add(WebKit::WebIDBObjectStore* idb_object_store);
64 void Add(WebKit::WebIDBTransaction* idb_transaction);
63 65
64 private: 66 private:
65 friend class base::RefCountedThreadSafe<IndexedDBDispatcherHost>; 67 friend class base::RefCountedThreadSafe<IndexedDBDispatcherHost>;
66 ~IndexedDBDispatcherHost(); 68 ~IndexedDBDispatcherHost();
67 69
68 // Message processing. Most of the work is delegated to the dispatcher hosts 70 // Message processing. Most of the work is delegated to the dispatcher hosts
69 // below. 71 // below.
70 void OnMessageReceivedWebKit(const IPC::Message& message); 72 void OnMessageReceivedWebKit(const IPC::Message& message);
71 void OnIDBFactoryOpen(const ViewHostMsg_IDBFactoryOpen_Params& p); 73 void OnIDBFactoryOpen(const ViewHostMsg_IDBFactoryOpen_Params& p);
74 void OnIDBFactoryAbortPendingTransactions(const std::vector<int32>& ids);
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 IPC::Message* reply_msg, uint32 message_type); 80 IPC::Message* reply_msg, uint32 message_type);
78 81
79 template <typename ReplyType, typename MessageType, 82 template <typename ReplyType, typename MessageType,
80 typename WebObjectType, typename Method> 83 typename WebObjectType, typename Method>
81 void SyncGetter(IDMap<WebObjectType, IDMapOwnPointer>* map, int32 object_id, 84 void SyncGetter(IDMap<WebObjectType, IDMapOwnPointer>* map, int32 object_id,
(...skipping 14 matching lines...) Expand all
96 void OnName(int32 idb_database_id, IPC::Message* reply_msg); 99 void OnName(int32 idb_database_id, IPC::Message* reply_msg);
97 void OnDescription(int32 idb_database_id, IPC::Message* reply_msg); 100 void OnDescription(int32 idb_database_id, IPC::Message* reply_msg);
98 void OnVersion(int32 idb_database_id, IPC::Message* reply_msg); 101 void OnVersion(int32 idb_database_id, IPC::Message* reply_msg);
99 void OnObjectStores(int32 idb_database_id, IPC::Message* reply_msg); 102 void OnObjectStores(int32 idb_database_id, IPC::Message* reply_msg);
100 void OnCreateObjectStore( 103 void OnCreateObjectStore(
101 const ViewHostMsg_IDBDatabaseCreateObjectStore_Params& params); 104 const ViewHostMsg_IDBDatabaseCreateObjectStore_Params& params);
102 void OnObjectStore(int32 idb_database_id, const string16& name, int32 mode, 105 void OnObjectStore(int32 idb_database_id, const string16& name, int32 mode,
103 IPC::Message* reply_msg); 106 IPC::Message* reply_msg);
104 void OnRemoveObjectStore(int32 idb_database_id, int32 response_id, 107 void OnRemoveObjectStore(int32 idb_database_id, int32 response_id,
105 const string16& name); 108 const string16& name);
109 void OnTransaction(int32 idb_database_id,
110 const std::vector<string16>& names,
111 int32 mode, int32 timeout, IPC::Message* reply_msg);
106 void OnDestroyed(int32 idb_database_id); 112 void OnDestroyed(int32 idb_database_id);
107 113
108 IndexedDBDispatcherHost* parent_; 114 IndexedDBDispatcherHost* parent_;
109 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_; 115 IDMap<WebKit::WebIDBDatabase, IDMapOwnPointer> map_;
110 }; 116 };
111 117
112 class IndexDispatcherHost { 118 class IndexDispatcherHost {
113 public: 119 public:
114 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent); 120 explicit IndexDispatcherHost(IndexedDBDispatcherHost* parent);
115 ~IndexDispatcherHost(); 121 ~IndexDispatcherHost();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 void OnOpenCursor( 173 void OnOpenCursor(
168 const ViewHostMsg_IDBObjectStoreOpenCursor_Params& params); 174 const ViewHostMsg_IDBObjectStoreOpenCursor_Params& params);
169 void OnDirection(int32 idb_object_store_id, IPC::Message* reply_msg); 175 void OnDirection(int32 idb_object_store_id, IPC::Message* reply_msg);
170 void OnKey(int32 idb_object_store_id, IPC::Message* reply_msg); 176 void OnKey(int32 idb_object_store_id, IPC::Message* reply_msg);
171 void OnValue(int32 idb_object_store_id, IPC::Message* reply_msg); 177 void OnValue(int32 idb_object_store_id, IPC::Message* reply_msg);
172 void OnDestroyed(int32 idb_cursor_id); 178 void OnDestroyed(int32 idb_cursor_id);
173 179
174 IndexedDBDispatcherHost* parent_; 180 IndexedDBDispatcherHost* parent_;
175 IDMap<WebKit::WebIDBCursor, IDMapOwnPointer> map_; 181 IDMap<WebKit::WebIDBCursor, IDMapOwnPointer> map_;
176 }; 182 };
183
184 class TransactionDispatcherHost {
185 public:
186 explicit TransactionDispatcherHost(IndexedDBDispatcherHost* parent);
187 ~TransactionDispatcherHost();
188
189 bool OnMessageReceived(const IPC::Message& message, bool *msg_is_ok);
190 void Send(IPC::Message* message);
191
192 // TODO: add the rest of the transaction methods.
193 void OnDestroyed(int32 idb_transaction_id);
194
195 IndexedDBDispatcherHost* parent_;
196 IDMap<WebKit::WebIDBTransaction, IDMapOwnPointer> map_;
197 };
198
177 // Only use on the IO thread. 199 // Only use on the IO thread.
178 IPC::Message::Sender* sender_; 200 IPC::Message::Sender* sender_;
179 201
180 // Data shared between renderer processes with the same profile. 202 // Data shared between renderer processes with the same profile.
181 scoped_refptr<WebKitContext> webkit_context_; 203 scoped_refptr<WebKitContext> webkit_context_;
182 204
183 // Only access on WebKit thread. 205 // Only access on WebKit thread.
184 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_; 206 scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_;
185 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_; 207 scoped_ptr<IndexDispatcherHost> index_dispatcher_host_;
186 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_; 208 scoped_ptr<ObjectStoreDispatcherHost> object_store_dispatcher_host_;
187 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_; 209 scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_;
210 scoped_ptr<TransactionDispatcherHost> transaction_dispatcher_host_;
211
188 212
189 // If we get a corrupt message from a renderer, we need to kill it using this 213 // If we get a corrupt message from a renderer, we need to kill it using this
190 // handle. 214 // handle.
191 base::ProcessHandle process_handle_; 215 base::ProcessHandle process_handle_;
192 216
193 // Used to dispatch messages to the correct view host. 217 // Used to dispatch messages to the correct view host.
194 int process_id_; 218 int process_id_;
195 219
196 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost); 220 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
197 }; 221 };
198 222
199 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_ 223 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698