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

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

Issue 3165026: [IndexedDB] Add transaction coordinator. (Closed)
Patch Set: Fix Jeremy's comments 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 #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h" 5 #include "chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/chrome_thread.h" 8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/in_process_webkit/indexed_db_callbacks.h" 9 #include "chrome/browser/in_process_webkit/indexed_db_callbacks.h"
10 #include "chrome/browser/renderer_host/browser_render_process_host.h" 10 #include "chrome/browser/renderer_host/browser_render_process_host.h"
11 #include "chrome/browser/renderer_host/resource_message_filter.h" 11 #include "chrome/browser/renderer_host/resource_message_filter.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/render_messages.h" 13 #include "chrome/common/render_messages.h"
14 #include "chrome/common/serialized_script_value.h" 14 #include "chrome/common/serialized_script_value.h"
15 #include "third_party/WebKit/WebKit/chromium/public/WebDOMStringList.h" 15 #include "third_party/WebKit/WebKit/chromium/public/WebDOMStringList.h"
16 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabase.h" 16 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabase.h"
17 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" 17 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h"
18 #include "third_party/WebKit/WebKit/chromium/public/WebIDBIndex.h" 18 #include "third_party/WebKit/WebKit/chromium/public/WebIDBIndex.h"
19 #include "third_party/WebKit/WebKit/chromium/public/WebIDBFactory.h" 19 #include "third_party/WebKit/WebKit/chromium/public/WebIDBFactory.h"
20 #include "third_party/WebKit/WebKit/chromium/public/WebIDBObjectStore.h" 20 #include "third_party/WebKit/WebKit/chromium/public/WebIDBObjectStore.h"
21 #include "third_party/WebKit/WebKit/chromium/public/WebIDBTransaction.h"
21 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" 22 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h"
23 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
22 24
23 using WebKit::WebDOMStringList; 25 using WebKit::WebDOMStringList;
24 using WebKit::WebIDBDatabase; 26 using WebKit::WebIDBDatabase;
25 using WebKit::WebIDBDatabaseError; 27 using WebKit::WebIDBDatabaseError;
26 using WebKit::WebIDBIndex; 28 using WebKit::WebIDBIndex;
27 using WebKit::WebIDBKey; 29 using WebKit::WebIDBKey;
28 using WebKit::WebIDBObjectStore; 30 using WebKit::WebIDBObjectStore;
31 using WebKit::WebIDBTransaction;
29 using WebKit::WebSecurityOrigin; 32 using WebKit::WebSecurityOrigin;
30 using WebKit::WebSerializedScriptValue; 33 using WebKit::WebSerializedScriptValue;
34 using WebKit::WebVector;
31 35
32 IndexedDBDispatcherHost::IndexedDBDispatcherHost( 36 IndexedDBDispatcherHost::IndexedDBDispatcherHost(
33 IPC::Message::Sender* sender, WebKitContext* webkit_context) 37 IPC::Message::Sender* sender, WebKitContext* webkit_context)
34 : sender_(sender), 38 : sender_(sender),
35 webkit_context_(webkit_context), 39 webkit_context_(webkit_context),
36 ALLOW_THIS_IN_INITIALIZER_LIST(database_dispatcher_host_( 40 ALLOW_THIS_IN_INITIALIZER_LIST(database_dispatcher_host_(
37 new DatabaseDispatcherHost(this))), 41 new DatabaseDispatcherHost(this))),
38 ALLOW_THIS_IN_INITIALIZER_LIST(index_dispatcher_host_( 42 ALLOW_THIS_IN_INITIALIZER_LIST(index_dispatcher_host_(
39 new IndexDispatcherHost(this))), 43 new IndexDispatcherHost(this))),
40 ALLOW_THIS_IN_INITIALIZER_LIST(object_store_dispatcher_host_( 44 ALLOW_THIS_IN_INITIALIZER_LIST(object_store_dispatcher_host_(
41 new ObjectStoreDispatcherHost(this))), 45 new ObjectStoreDispatcherHost(this))),
46 ALLOW_THIS_IN_INITIALIZER_LIST(transaction_dispatcher_host_(
47 new TransactionDispatcherHost(this))),
42 process_handle_(0) { 48 process_handle_(0) {
43 DCHECK(sender_); 49 DCHECK(sender_);
44 DCHECK(webkit_context_.get()); 50 DCHECK(webkit_context_.get());
45 } 51 }
46 52
47 IndexedDBDispatcherHost::~IndexedDBDispatcherHost() { 53 IndexedDBDispatcherHost::~IndexedDBDispatcherHost() {
48 } 54 }
49 55
50 void IndexedDBDispatcherHost::Init(int process_id, 56 void IndexedDBDispatcherHost::Init(int process_id,
51 base::ProcessHandle process_handle) { 57 base::ProcessHandle process_handle) {
(...skipping 23 matching lines...) Expand all
75 database_dispatcher_host_.reset(); 81 database_dispatcher_host_.reset();
76 index_dispatcher_host_.reset(); 82 index_dispatcher_host_.reset();
77 } 83 }
78 84
79 bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { 85 bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) {
80 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); 86 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
81 DCHECK(process_handle_); 87 DCHECK(process_handle_);
82 88
83 switch (message.type()) { 89 switch (message.type()) {
84 case ViewHostMsg_IDBFactoryOpen::ID: 90 case ViewHostMsg_IDBFactoryOpen::ID:
91 case ViewHostMsg_IDBFactoryAbortPendingTransactions::ID:
85 case ViewHostMsg_IDBDatabaseName::ID: 92 case ViewHostMsg_IDBDatabaseName::ID:
86 case ViewHostMsg_IDBDatabaseDescription::ID: 93 case ViewHostMsg_IDBDatabaseDescription::ID:
87 case ViewHostMsg_IDBDatabaseVersion::ID: 94 case ViewHostMsg_IDBDatabaseVersion::ID:
88 case ViewHostMsg_IDBDatabaseObjectStores::ID: 95 case ViewHostMsg_IDBDatabaseObjectStores::ID:
89 case ViewHostMsg_IDBDatabaseCreateObjectStore::ID: 96 case ViewHostMsg_IDBDatabaseCreateObjectStore::ID:
90 case ViewHostMsg_IDBDatabaseObjectStore::ID: 97 case ViewHostMsg_IDBDatabaseObjectStore::ID:
91 case ViewHostMsg_IDBDatabaseRemoveObjectStore::ID: 98 case ViewHostMsg_IDBDatabaseRemoveObjectStore::ID:
99 case ViewHostMsg_IDBDatabaseTransaction::ID:
92 case ViewHostMsg_IDBDatabaseDestroyed::ID: 100 case ViewHostMsg_IDBDatabaseDestroyed::ID:
93 case ViewHostMsg_IDBIndexName::ID: 101 case ViewHostMsg_IDBIndexName::ID:
94 case ViewHostMsg_IDBIndexKeyPath::ID: 102 case ViewHostMsg_IDBIndexKeyPath::ID:
95 case ViewHostMsg_IDBIndexUnique::ID: 103 case ViewHostMsg_IDBIndexUnique::ID:
96 case ViewHostMsg_IDBIndexDestroyed::ID: 104 case ViewHostMsg_IDBIndexDestroyed::ID:
97 case ViewHostMsg_IDBObjectStoreName::ID: 105 case ViewHostMsg_IDBObjectStoreName::ID:
98 case ViewHostMsg_IDBObjectStoreKeyPath::ID: 106 case ViewHostMsg_IDBObjectStoreKeyPath::ID:
99 case ViewHostMsg_IDBObjectStoreIndexNames::ID: 107 case ViewHostMsg_IDBObjectStoreIndexNames::ID:
100 case ViewHostMsg_IDBObjectStoreGet::ID: 108 case ViewHostMsg_IDBObjectStoreGet::ID:
101 case ViewHostMsg_IDBObjectStorePut::ID: 109 case ViewHostMsg_IDBObjectStorePut::ID:
102 case ViewHostMsg_IDBObjectStoreRemove::ID: 110 case ViewHostMsg_IDBObjectStoreRemove::ID:
103 case ViewHostMsg_IDBObjectStoreCreateIndex::ID: 111 case ViewHostMsg_IDBObjectStoreCreateIndex::ID:
104 case ViewHostMsg_IDBObjectStoreIndex::ID: 112 case ViewHostMsg_IDBObjectStoreIndex::ID:
105 case ViewHostMsg_IDBObjectStoreRemoveIndex::ID: 113 case ViewHostMsg_IDBObjectStoreRemoveIndex::ID:
106 case ViewHostMsg_IDBObjectStoreDestroyed::ID: 114 case ViewHostMsg_IDBObjectStoreDestroyed::ID:
115 case ViewHostMsg_IDBTransactionDestroyed::ID:
107 break; 116 break;
108 default: 117 default:
109 return false; 118 return false;
110 } 119 }
111 120
112 bool success = ChromeThread::PostTask( 121 bool success = ChromeThread::PostTask(
113 ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod( 122 ChromeThread::WEBKIT, FROM_HERE, NewRunnableMethod(
114 this, &IndexedDBDispatcherHost::OnMessageReceivedWebKit, message)); 123 this, &IndexedDBDispatcherHost::OnMessageReceivedWebKit, message));
115 DCHECK(success); 124 DCHECK(success);
116 return true; 125 return true;
(...skipping 23 matching lines...) Expand all
140 149
141 void IndexedDBDispatcherHost::OnMessageReceivedWebKit( 150 void IndexedDBDispatcherHost::OnMessageReceivedWebKit(
142 const IPC::Message& message) { 151 const IPC::Message& message) {
143 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); 152 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
144 DCHECK(process_handle_); 153 DCHECK(process_handle_);
145 154
146 bool msg_is_ok = true; 155 bool msg_is_ok = true;
147 bool handled = 156 bool handled =
148 database_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) || 157 database_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
149 index_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) || 158 index_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
150 object_store_dispatcher_host_->OnMessageReceived(message, &msg_is_ok); 159 object_store_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
160 transaction_dispatcher_host_->OnMessageReceived(message, &msg_is_ok);
151 161
152 if (!handled) { 162 if (!handled) {
153 handled = true; 163 handled = true;
154 DCHECK(msg_is_ok); 164 DCHECK(msg_is_ok);
155 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, msg_is_ok) 165 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, msg_is_ok)
156 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBFactoryOpen, 166 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBFactoryOpen,
157 OnIDBFactoryOpen) 167 OnIDBFactoryOpen)
168 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBFactoryAbortPendingTransactions,
169 OnIDBFactoryAbortPendingTransactions)
158 IPC_MESSAGE_UNHANDLED(handled = false) 170 IPC_MESSAGE_UNHANDLED(handled = false)
159 IPC_END_MESSAGE_MAP() 171 IPC_END_MESSAGE_MAP()
160 } 172 }
161 173
162 DCHECK(handled); 174 DCHECK(handled);
163 if (!msg_is_ok) { 175 if (!msg_is_ok) {
164 BrowserRenderProcessHost::BadMessageTerminateProcess(message.type(), 176 BrowserRenderProcessHost::BadMessageTerminateProcess(message.type(),
165 process_handle_); 177 process_handle_);
166 } 178 }
167 } 179 }
168 180
169 int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database) { 181 int32 IndexedDBDispatcherHost::Add(WebIDBDatabase* idb_database) {
170 return database_dispatcher_host_->map_.Add(idb_database); 182 return database_dispatcher_host_->map_.Add(idb_database);
171 } 183 }
172 184
173 int32 IndexedDBDispatcherHost::Add(WebIDBIndex* idb_index) { 185 int32 IndexedDBDispatcherHost::Add(WebIDBIndex* idb_index) {
174 return index_dispatcher_host_->map_.Add(idb_index); 186 return index_dispatcher_host_->map_.Add(idb_index);
175 } 187 }
176 188
177 int32 IndexedDBDispatcherHost::Add(WebIDBObjectStore* idb_object_store) { 189 int32 IndexedDBDispatcherHost::Add(WebIDBObjectStore* idb_object_store) {
178 return object_store_dispatcher_host_->map_.Add(idb_object_store); 190 return object_store_dispatcher_host_->map_.Add(idb_object_store);
179 } 191 }
180 192
193 void IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction) {
194 transaction_dispatcher_host_->map_.AddWithID(
195 idb_transaction, idb_transaction->id());
196 }
197
181 void IndexedDBDispatcherHost::OnIDBFactoryOpen( 198 void IndexedDBDispatcherHost::OnIDBFactoryOpen(
182 const ViewHostMsg_IDBFactoryOpen_Params& params) { 199 const ViewHostMsg_IDBFactoryOpen_Params& params) {
183 // TODO(jorlow): Check the content settings map and use params.routing_id_ 200 // TODO(jorlow): Check the content settings map and use params.routing_id_
184 // if it's necessary to ask the user for permission. 201 // if it's necessary to ask the user for permission.
185 202
186 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); 203 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
187 Context()->GetIDBFactory()->open( 204 Context()->GetIDBFactory()->open(
188 params.name_, params.description_, 205 params.name_, params.description_,
189 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id_), 206 new IndexedDBCallbacks<WebIDBDatabase>(this, params.response_id_),
190 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin_), NULL); 207 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin_), NULL);
191 } 208 }
192 209
210 void IndexedDBDispatcherHost::OnIDBFactoryAbortPendingTransactions(
211 const std::vector<int32>& ids) {
212 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
213
214 WebVector<int32> pendingIDs = ids;
215 Context()->GetIDBFactory()->abortPendingTransactions(pendingIDs);
216 }
217
193 ////////////////////////////////////////////////////////////////////// 218 //////////////////////////////////////////////////////////////////////
194 // Helper templates. 219 // Helper templates.
195 // 220 //
196 221
197 template <typename ObjectType> 222 template <typename ObjectType>
198 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess( 223 ObjectType* IndexedDBDispatcherHost::GetOrTerminateProcess(
199 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id, 224 IDMap<ObjectType, IDMapOwnPointer>* map, int32 return_object_id,
200 IPC::Message* reply_msg, uint32 message_type) { 225 IPC::Message* reply_msg, uint32 message_type) {
201 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); 226 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
202 ObjectType* return_object = map->Lookup(return_object_id); 227 ObjectType* return_object = map->Lookup(return_object_id);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 OnDescription) 279 OnDescription)
255 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseVersion, OnVersion) 280 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseVersion, OnVersion)
256 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseObjectStores, 281 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseObjectStores,
257 OnObjectStores) 282 OnObjectStores)
258 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseCreateObjectStore, 283 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseCreateObjectStore,
259 OnCreateObjectStore) 284 OnCreateObjectStore)
260 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseObjectStore, 285 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseObjectStore,
261 OnObjectStore) 286 OnObjectStore)
262 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseRemoveObjectStore, 287 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseRemoveObjectStore,
263 OnRemoveObjectStore) 288 OnRemoveObjectStore)
289 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseTransaction,
290 OnTransaction)
264 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseDestroyed, OnDestroyed) 291 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseDestroyed, OnDestroyed)
265 IPC_MESSAGE_UNHANDLED(handled = false) 292 IPC_MESSAGE_UNHANDLED(handled = false)
266 IPC_END_MESSAGE_MAP() 293 IPC_END_MESSAGE_MAP()
267 return handled; 294 return handled;
268 } 295 }
269 296
270 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( 297 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send(
271 IPC::Message* message) { 298 IPC::Message* message) {
272 // The macro magic in OnMessageReceived requires this to link, but it should 299 // The macro magic in OnMessageReceived requires this to link, but it should
273 // never actually be called. 300 // never actually be called.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); 372 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
346 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( 373 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
347 &map_, idb_database_id, NULL, 374 &map_, idb_database_id, NULL,
348 ViewHostMsg_IDBDatabaseRemoveObjectStore::ID); 375 ViewHostMsg_IDBDatabaseRemoveObjectStore::ID);
349 if (!idb_database) 376 if (!idb_database)
350 return; 377 return;
351 idb_database->removeObjectStore( 378 idb_database->removeObjectStore(
352 name, new IndexedDBCallbacks<WebIDBObjectStore>(parent_, response_id)); 379 name, new IndexedDBCallbacks<WebIDBObjectStore>(parent_, response_id));
353 } 380 }
354 381
382 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
383 int32 idb_database_id, const std::vector<string16>& names,
384 int32 mode, int32 timeout, IPC::Message* reply_msg) {
385 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
386 &map_, idb_database_id, reply_msg,
387 ViewHostMsg_IDBDatabaseTransaction::ID);
388 if (!database)
389 return;
390
391 WebDOMStringList object_stores;
392 for (std::vector<string16>::const_iterator it = names.begin();
393 it != names.end(); ++it) {
394 object_stores.append(*it);
395 }
396
397 WebIDBTransaction* transaction = database->transaction(
398 object_stores, mode, timeout);
399 transaction->setCallbacks(
400 new IndexedDBTransactionCallbacks(parent_, transaction->id()));
401 parent_->Add(transaction);
402 ViewHostMsg_IDBDatabaseTransaction::WriteReplyParams(
403 reply_msg, transaction->id());
404 parent_->Send(reply_msg);
405 }
406
355 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed( 407 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed(
356 int32 object_id) { 408 int32 object_id) {
357 parent_->DestroyObject(&map_, object_id, 409 parent_->DestroyObject(&map_, object_id,
358 ViewHostMsg_IDBDatabaseDestroyed::ID); 410 ViewHostMsg_IDBDatabaseDestroyed::ID);
359 } 411 }
360 412
361 413
362 ////////////////////////////////////////////////////////////////////// 414 //////////////////////////////////////////////////////////////////////
363 // IndexedDBDispatcherHost::IndexDispatcherHost 415 // IndexedDBDispatcherHost::IndexDispatcherHost
364 // 416 //
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 return; 615 return;
564 idb_object_store->removeIndex( 616 idb_object_store->removeIndex(
565 name, new IndexedDBCallbacks<void>(parent_, response_id)); 617 name, new IndexedDBCallbacks<void>(parent_, response_id));
566 } 618 }
567 619
568 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed( 620 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed(
569 int32 object_id) { 621 int32 object_id) {
570 parent_->DestroyObject( 622 parent_->DestroyObject(
571 &map_, object_id, ViewHostMsg_IDBObjectStoreDestroyed::ID); 623 &map_, object_id, ViewHostMsg_IDBObjectStoreDestroyed::ID);
572 } 624 }
625
626 //////////////////////////////////////////////////////////////////////
627 // IndexedDBDispatcherHost::TransactionDispatcherHost
628 //
629
630 IndexedDBDispatcherHost::TransactionDispatcherHost::TransactionDispatcherHost(
631 IndexedDBDispatcherHost* parent)
632 : parent_(parent) {
633 }
634
635 IndexedDBDispatcherHost::TransactionDispatcherHost::
jorlow 2010/08/19 13:05:34 I've been told to do the following in such cases:
636 ~TransactionDispatcherHost() {
637 }
638
639 bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived(
640 const IPC::Message& message, bool* msg_is_ok) {
641 bool handled = true;
642 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::TransactionDispatcherHost,
643 message, *msg_is_ok)
644 IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionDestroyed, OnDestroyed)
645 IPC_MESSAGE_UNHANDLED(handled = false)
646 IPC_END_MESSAGE_MAP()
647 return handled;
648 }
649
650 void IndexedDBDispatcherHost::TransactionDispatcherHost::Send(
651 IPC::Message* message) {
652 // The macro magic in OnMessageReceived requires this to link, but it should
653 // never actually be called.
654 NOTREACHED();
655 parent_->Send(message);
656 }
657
658 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
659 int32 object_id) {
660 parent_->DestroyObject(
661 &map_, object_id, ViewHostMsg_IDBTransactionDestroyed::ID);
662 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698