From 4fedd9ebdb7bb8f6b1b73d5292d5cf4b2312fcc8 Mon Sep 17 00:00:00 2001 From: "jsbell@chromium.org" Date: Wed, 18 Dec 2013 03:49:32 +0000 Subject: IndexedDB: Make deleteDatabase and getDatabaseNames close backing store The fix in r239298 was insufficient and the test had an incorrect expectation. Really-for-sure-this-time, when these IDBFactory methods are called, don't retain the backing store. BUG=325820 R=dgrogan,alecflett Review URL: https://codereview.chromium.org/114303003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241468 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/indexed_db/indexed_db_factory.cc | 3 +++ content/browser/indexed_db/indexed_db_factory_unittest.cc | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'content') diff --git a/content/browser/indexed_db/indexed_db_factory.cc b/content/browser/indexed_db/indexed_db_factory.cc index 7be451f..1a83332 100644 --- a/content/browser/indexed_db/indexed_db_factory.cc +++ b/content/browser/indexed_db/indexed_db_factory.cc @@ -131,6 +131,7 @@ void IndexedDBFactory::GetDatabaseNames( } callbacks->OnSuccess(backing_store->GetDatabaseNames()); + backing_store = NULL; ReleaseBackingStore(origin_url, false /* immediate */); } @@ -182,6 +183,8 @@ void IndexedDBFactory::DeleteDatabase( database_map_[unique_identifier] = database; database->DeleteDatabase(callbacks); database_map_.erase(unique_identifier); + database = NULL; + backing_store = NULL; ReleaseBackingStore(origin_url, false /* immediate */); } diff --git a/content/browser/indexed_db/indexed_db_factory_unittest.cc b/content/browser/indexed_db/indexed_db_factory_unittest.cc index 7d958e7..f99df63 100644 --- a/content/browser/indexed_db/indexed_db_factory_unittest.cc +++ b/content/browser/indexed_db/indexed_db_factory_unittest.cc @@ -316,7 +316,7 @@ TEST_F(IndexedDBFactoryTest, DeleteDatabaseClosesBackingStore) { temp_directory.path()); EXPECT_TRUE(factory->IsBackingStoreOpen(origin)); - EXPECT_FALSE(factory->IsBackingStorePendingClose(origin)); + EXPECT_TRUE(factory->IsBackingStorePendingClose(origin)); // Now simulate shutdown, which should stop the timer. factory->ContextDestroyed(); @@ -342,7 +342,7 @@ TEST_F(IndexedDBFactoryTest, GetDatabaseNamesClosesBackingStore) { temp_directory.path()); EXPECT_TRUE(factory->IsBackingStoreOpen(origin)); - EXPECT_FALSE(factory->IsBackingStorePendingClose(origin)); + EXPECT_TRUE(factory->IsBackingStorePendingClose(origin)); // Now simulate shutdown, which should stop the timer. factory->ContextDestroyed(); -- cgit v1.1