From e7df39152ff45e8abdbfbab57a5dcec0c09ae34f Mon Sep 17 00:00:00 2001 From: "jsbell@chromium.org" Date: Mon, 25 Nov 2013 21:13:13 +0000 Subject: IndexedDB: Don't re-send WebIDBDatabase pointer Originally, the WebIDBDatabase impl pointer was handed off from Chrome to WebKit in an onSuccess() callback. When "upgradeneeded" support was added, which fires earlier and needs to deliver the connection object to script, the same WebIDBDatabase impl pointer was sent in both onUpgradeNeeded() and onSuccess(). This violates the "pointer is a transfer of ownership" contract with the API and required extra plumbing on both sides of the API. The blink public API has been cleaned up so this is no longer necessary; don't re-send the pointer in onSuccess() if it was previously sent in onUpgradeNeeded(). R=alecflett@chromium.org BUG=234277 Review URL: https://codereview.chromium.org/86053002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237142 0039d316-1c4b-4281-b951-d872f2087c98 --- content/child/indexed_db/indexed_db_dispatcher.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/child/indexed_db/indexed_db_dispatcher.cc b/content/child/indexed_db/indexed_db_dispatcher.cc index 9c7bcc4..39f1fae 100644 --- a/content/child/indexed_db/indexed_db_dispatcher.cc +++ b/content/child/indexed_db/indexed_db_dispatcher.cc @@ -458,11 +458,12 @@ void IndexedDBDispatcher::OnSuccessIDBDatabase( return; WebIDBMetadata metadata(ConvertMetadata(idb_metadata)); // If an upgrade was performed, count will be non-zero. + WebIDBDatabase* database = NULL; if (!databases_.count(ipc_object_id)) - databases_[ipc_object_id] = new RendererWebIDBDatabaseImpl( + database = databases_[ipc_object_id] = new RendererWebIDBDatabaseImpl( ipc_object_id, ipc_database_callbacks_id, thread_safe_sender_.get()); DCHECK_EQ(databases_.count(ipc_object_id), 1u); - callbacks->onSuccess(databases_[ipc_object_id], metadata); + callbacks->onSuccess(database, metadata); pending_callbacks_.Remove(ipc_callbacks_id); } -- cgit v1.1