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

Unified Diff: net/tools/crash_cache/crash_cache.cc

Issue 2819032: Revert 51312 - Disk cache: Switch the disk cache to use the cache_thread.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 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/net.gyp ('k') | net/tools/dump_cache/upgrade.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/crash_cache/crash_cache.cc
===================================================================
--- net/tools/crash_cache/crash_cache.cc (revision 51324)
+++ net/tools/crash_cache/crash_cache.cc (working copy)
@@ -118,14 +118,6 @@
return file_util::CreateDirectory(*full_path);
}
-// Makes sure that any pending task is processed.
-void FlushQueue(disk_cache::Backend* cache) {
- TestCompletionCallback cb;
- int rv =
- reinterpret_cast<disk_cache::BackendImpl*>(cache)->FlushQueueForTest(&cb);
- cb.GetResult(rv); // Ignore the result;
-}
-
// Generates the files for an empty and one item cache.
int SimpleInsert(const FilePath& path, RankCrashes action,
base::Thread* cache_thread) {
@@ -150,7 +142,6 @@
return GENERIC;
entry->Close();
- FlushQueue(cache);
DCHECK(action <= disk_cache::INSERT_ONE_3);
g_rankings_crash = action;
@@ -171,8 +162,7 @@
TestCompletionCallback cb;
disk_cache::Backend* cache;
- // Use a simple LRU for eviction.
- int rv = disk_cache::CreateCacheBackend(net::MEDIA_CACHE, path, 0, false,
+ int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, path, 0, false,
cache_thread->message_loop_proxy(),
&cache, &cb);
if (cb.GetResult(rv) != net::OK || cache->GetEntryCount())
@@ -184,7 +174,6 @@
return GENERIC;
entry->Close();
- FlushQueue(cache);
if (action >= disk_cache::REMOVE_TAIL_1) {
rv = cache->CreateEntry("some other key", &entry, &cb);
@@ -192,7 +181,6 @@
return GENERIC;
entry->Close();
- FlushQueue(cache);
}
rv = cache->OpenEntry(kCrashEntryName, &entry, &cb);
@@ -202,7 +190,6 @@
g_rankings_crash = action;
entry->Doom();
entry->Close();
- FlushQueue(cache);
return NOT_REACHED;
}
@@ -214,8 +201,7 @@
TestCompletionCallback cb;
disk_cache::Backend* cache;
- // Use a simple LRU for eviction.
- int rv = disk_cache::CreateCacheBackend(net::MEDIA_CACHE, path, 0, false,
+ int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, path, 0, false,
cache_thread->message_loop_proxy(),
&cache, &cb);
if (cb.GetResult(rv) != net::OK || cache->GetEntryCount())
@@ -227,13 +213,11 @@
return GENERIC;
entry->Close();
- FlushQueue(cache);
rv = cache->CreateEntry(kCrashEntryName, &entry, &cb);
if (cb.GetResult(rv) != net::OK)
return GENERIC;
entry->Close();
- FlushQueue(cache);
rv = cache->OpenEntry(kCrashEntryName, &entry, &cb);
if (cb.GetResult(rv) != net::OK)
@@ -242,7 +226,6 @@
g_rankings_crash = action;
entry->Doom();
entry->Close();
- FlushQueue(cache);
return NOT_REACHED;
}
@@ -258,14 +241,14 @@
if (!cache || !cache->SetMaxSize(0x100000))
return GENERIC;
- TestCompletionCallback cb;
- int rv = cache->Init(&cb);
- if (cb.GetResult(rv) != net::OK || cache->GetEntryCount())
+ if (!cache->Init() || cache->GetEntryCount())
return GENERIC;
int seed = static_cast<int>(Time::Now().ToInternalValue());
srand(seed);
+ TestCompletionCallback cb;
+ int rv;
disk_cache::Entry* entry;
for (int i = 0; i < 100; i++) {
std::string key = GenerateKey(true);
@@ -273,13 +256,11 @@
if (cb.GetResult(rv) != net::OK)
return GENERIC;
entry->Close();
- FlushQueue(cache);
if (50 == i && action >= disk_cache::REMOVE_LOAD_1) {
rv = cache->CreateEntry(kCrashEntryName, &entry, &cb);
if (cb.GetResult(rv) != net::OK)
return GENERIC;
entry->Close();
- FlushQueue(cache);
}
}
@@ -299,7 +280,6 @@
entry->Doom();
entry->Close();
- FlushQueue(cache);
return NOT_REACHED;
}
Property changes on: net\tools\crash_cache\crash_cache.cc
___________________________________________________________________
Added: svn:mergeinfo
« no previous file with comments | « net/net.gyp ('k') | net/tools/dump_cache/upgrade.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698