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

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

Issue 10917099: Chromium side of "consolidate two-phase connection to avoid race conditions". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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) 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 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
235 235
236 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore 236 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore
237 // created) if this origin is already over quota. 237 // created) if this origin is already over quota.
238 Context()->GetIDBFactory()->open( 238 Context()->GetIDBFactory()->open(
239 params.name, 239 params.name,
240 params.version, 240 params.version,
241 new IndexedDBCallbacksDatabase(this, params.thread_id, 241 new IndexedDBCallbacksDatabase(this, params.thread_id,
242 params.response_id, origin_url), 242 params.response_id, origin_url),
243 new IndexedDBDatabaseCallbacks(this, params.thread_id,
jsbell 2012/09/05 22:35:09 So... how about those awesome class names?
244 params.database_response_id),
243 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); 245 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path));
244 } 246 }
245 247
246 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( 248 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase(
247 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { 249 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) {
248 FilePath indexed_db_path = indexed_db_context_->data_path(); 250 FilePath indexed_db_path = indexed_db_context_->data_path();
249 251
250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
251 Context()->GetIDBFactory()->deleteDatabase( 253 Context()->GetIDBFactory()->deleteDatabase(
252 params.name, 254 params.name,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, 315 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost,
314 message, *msg_is_ok) 316 message, *msg_is_ok)
315 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata) 317 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata)
316 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, 318 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore,
317 OnCreateObjectStore) 319 OnCreateObjectStore)
318 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, 320 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore,
319 OnDeleteObjectStore) 321 OnDeleteObjectStore)
320 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetVersion, OnSetVersion) 322 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetVersion, OnSetVersion)
321 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction) 323 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction)
322 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) 324 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose)
323 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseOpen, OnOpen)
324 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) 325 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed)
325 IPC_MESSAGE_UNHANDLED(handled = false) 326 IPC_MESSAGE_UNHANDLED(handled = false)
326 IPC_END_MESSAGE_MAP() 327 IPC_END_MESSAGE_MAP()
327 return handled; 328 return handled;
328 } 329 }
329 330
330 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( 331 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send(
331 IPC::Message* message) { 332 IPC::Message* message) {
332 parent_->Send(message); 333 parent_->Send(message);
333 } 334 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 446
446 *ec = 0; 447 *ec = 0;
447 WebIDBTransaction* transaction = database->transaction( 448 WebIDBTransaction* transaction = database->transaction(
448 object_stores, mode, *ec); 449 object_stores, mode, *ec);
449 DCHECK(!transaction != !*ec); 450 DCHECK(!transaction != !*ec);
450 *idb_transaction_id = 451 *idb_transaction_id =
451 *ec ? 0 : parent_->Add(transaction, thread_id, 452 *ec ? 0 : parent_->Add(transaction, thread_id,
452 database_url_map_[idb_database_id]); 453 database_url_map_[idb_database_id]);
453 } 454 }
454 455
455 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen(
456 int32 idb_database_id, int32 thread_id, int32 response_id) {
457 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
458 &map_, idb_database_id);
459 if (!database)
460 return;
461 database->open(new IndexedDBDatabaseCallbacks(parent_, thread_id,
462 response_id));
463 }
464
465 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose( 456 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnClose(
466 int32 idb_database_id) { 457 int32 idb_database_id) {
467 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 458 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
468 &map_, idb_database_id); 459 &map_, idb_database_id);
469 if (!database) 460 if (!database)
470 return; 461 return;
471 database->close(); 462 database->close();
472 } 463 }
473 464
474 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed( 465 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed(
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 } 1099 }
1109 1100
1110 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1101 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1111 int32 object_id) { 1102 int32 object_id) {
1112 // TODO(dgrogan): This doesn't seem to be happening with some version change 1103 // TODO(dgrogan): This doesn't seem to be happening with some version change
1113 // transactions. Possibly introduced with integer version support. 1104 // transactions. Possibly introduced with integer version support.
1114 transaction_size_map_.erase(object_id); 1105 transaction_size_map_.erase(object_id);
1115 transaction_url_map_.erase(object_id); 1106 transaction_url_map_.erase(object_id);
1116 parent_->DestroyObject(&map_, object_id); 1107 parent_->DestroyObject(&map_, object_id);
1117 } 1108 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_dispatcher_host.h ('k') | content/common/indexed_db/indexed_db_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698