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

Unified Diff: net/disk_cache/disk_cache_perftest.cc

Issue 20737002: Change the API of disk_cache::CreateCacheBackend to use scoped_ptr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new test Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/disk_cache.h ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/disk_cache_perftest.cc
diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc
index a2474daae3c5d07c8ad9c11606d52a28e3c13e15..f7a1b5969c6058c910bb0cae6e8a93b8b7d5d041 100644
--- a/net/disk_cache/disk_cache_perftest.cc
+++ b/net/disk_cache/disk_cache_perftest.cc
@@ -165,7 +165,7 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) {
ASSERT_TRUE(CleanupCacheDir());
net::TestCompletionCallback cb;
- disk_cache::Backend* cache;
+ scoped_ptr<disk_cache::Backend> cache;
int rv = disk_cache::CreateCacheBackend(
net::DISK_CACHE, net::CACHE_BACKEND_BLOCKFILE, cache_path_, 0, false,
cache_thread.message_loop_proxy().get(), NULL, &cache, cb.callback());
@@ -178,10 +178,10 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) {
TestEntries entries;
int num_entries = 1000;
- EXPECT_TRUE(TimeWrite(num_entries, cache, &entries));
+ EXPECT_TRUE(TimeWrite(num_entries, cache.get(), &entries));
base::MessageLoop::current()->RunUntilIdle();
- delete cache;
+ cache.reset();
ASSERT_TRUE(file_util::EvictFileFromSystemCache(
cache_path_.AppendASCII("index")));
@@ -199,12 +199,11 @@ TEST_F(DiskCacheTest, CacheBackendPerformance) {
cache_thread.message_loop_proxy().get(), NULL, &cache, cb.callback());
ASSERT_EQ(net::OK, cb.GetResult(rv));
- EXPECT_TRUE(TimeRead(num_entries, cache, entries, true));
+ EXPECT_TRUE(TimeRead(num_entries, cache.get(), entries, true));
- EXPECT_TRUE(TimeRead(num_entries, cache, entries, false));
+ EXPECT_TRUE(TimeRead(num_entries, cache.get(), entries, false));
base::MessageLoop::current()->RunUntilIdle();
- delete cache;
}
// Creating and deleting "entries" on a block-file is something quite frequent
« no previous file with comments | « net/disk_cache/disk_cache.h ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698