diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-15 07:01:46 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-15 07:01:46 +0000 |
commit | 2aaadde0f6760c4a3419e5e9af964a6ff8ee9968 (patch) | |
tree | dfada47bf76e88692cf0a141c5247f8aab24889d /webkit/appcache/appcache_unittest.cc | |
parent | 324e5a301a76ec8597503f7cb139149a26f4c5ff (diff) | |
download | chromium_src-2aaadde0f6760c4a3419e5e9af964a6ff8ee9968.zip chromium_src-2aaadde0f6760c4a3419e5e9af964a6ff8ee9968.tar.gz chromium_src-2aaadde0f6760c4a3419e5e9af964a6ff8ee9968.tar.bz2 |
Fix dependency on scoped_ptr::reset sequencing in appcache.
scoped_ptr<T>::reset() currently guarantees that it deletes the old
stored pointer before assigning its argument to the stored pointer.
This is unsafe, because getting the deleter may result in the
destruction of the scoped_ptr<T> itself. unique_ptr<T> addresses this by
assigning its argument to the stored pointer before deleting the old
value of the stored pointer.
Unfortunately, this breaks code that assumes that the value of the
scoped_ptr will not change during scoped_ptr::reset() before destruction
of the old value is complete.
BUG=176091
Review URL: https://chromiumcodereview.appspot.com/12260032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182636 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_unittest.cc')
-rw-r--r-- | webkit/appcache/appcache_unittest.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/webkit/appcache/appcache_unittest.cc b/webkit/appcache/appcache_unittest.cc index a00d599..2fbf607 100644 --- a/webkit/appcache/appcache_unittest.cc +++ b/webkit/appcache/appcache_unittest.cc @@ -16,10 +16,10 @@ class AppCacheTest : public testing::Test { TEST(AppCacheTest, CleanupUnusedCache) { MockAppCacheService service; AppCacheFrontendImpl frontend; - scoped_refptr<AppCache> cache(new AppCache(&service, 111)); + scoped_refptr<AppCache> cache(new AppCache(service.storage(), 111)); cache->set_complete(true); scoped_refptr<AppCacheGroup> group( - new AppCacheGroup(&service, GURL("http://blah/manifest"), 111)); + new AppCacheGroup(service.storage(), GURL("http://blah/manifest"), 111)); group->AddCache(cache); AppCacheHost host1(1, &frontend, &service); @@ -34,7 +34,7 @@ TEST(AppCacheTest, CleanupUnusedCache) { TEST(AppCacheTest, AddModifyRemoveEntry) { MockAppCacheService service; - scoped_refptr<AppCache> cache(new AppCache(&service, 111)); + scoped_refptr<AppCache> cache(new AppCache(service.storage(), 111)); EXPECT_TRUE(cache->entries().empty()); EXPECT_EQ(0L, cache->cache_size()); @@ -79,7 +79,7 @@ TEST(AppCacheTest, AddModifyRemoveEntry) { TEST(AppCacheTest, InitializeWithManifest) { MockAppCacheService service; - scoped_refptr<AppCache> cache(new AppCache(&service, 1234)); + scoped_refptr<AppCache> cache(new AppCache(service.storage(), 1234)); EXPECT_TRUE(cache->fallback_namespaces_.empty()); EXPECT_TRUE(cache->online_whitelist_namespaces_.empty()); EXPECT_FALSE(cache->online_whitelist_all_); @@ -162,7 +162,7 @@ TEST(AppCacheTest, FindResponseForRequest) { kInterceptNamespaceEntry)); // Create a cache with some namespaces and entries. - scoped_refptr<AppCache> cache(new AppCache(&service, 1234)); + scoped_refptr<AppCache> cache(new AppCache(service.storage(), 1234)); cache->InitializeWithManifest(&manifest); cache->AddEntry( kFallbackEntryUrl1, @@ -341,8 +341,8 @@ TEST(AppCacheTest, ToFromDatabaseRecords) { "*\r"); MockAppCacheService service; scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, kManifestUrl, kGroupId); - scoped_refptr<AppCache> cache(new AppCache(&service, kCacheId)); + new AppCacheGroup(service.storage(), kManifestUrl, kGroupId); + scoped_refptr<AppCache> cache(new AppCache(service.storage(), kCacheId)); Manifest manifest; EXPECT_TRUE( ParseManifest(kManifestUrl, kData.c_str(), kData.length(), manifest)); @@ -377,7 +377,7 @@ TEST(AppCacheTest, ToFromDatabaseRecords) { cache = NULL; // Create a new AppCache and populate it with those records and verify. - cache = new AppCache(&service, kCacheId); + cache = new AppCache(service.storage(), kCacheId); cache->InitializeWithDatabaseRecords( cache_record, entries, intercepts, fallbacks, whitelists); |