diff options
Diffstat (limited to 'net/tools/crash_cache')
-rw-r--r-- | net/tools/crash_cache/crash_cache.cc | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc index 1d11013..a26c873 100644 --- a/net/tools/crash_cache/crash_cache.cc +++ b/net/tools/crash_cache/crash_cache.cc @@ -118,14 +118,6 @@ bool CreateTargetFolder(const FilePath& path, RankCrashes action, 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 @@ int SimpleInsert(const FilePath& path, RankCrashes action, return GENERIC; entry->Close(); - FlushQueue(cache); DCHECK(action <= disk_cache::INSERT_ONE_3); g_rankings_crash = action; @@ -171,8 +162,7 @@ int SimpleRemove(const FilePath& path, RankCrashes action, 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 @@ int SimpleRemove(const FilePath& path, RankCrashes action, 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 @@ int SimpleRemove(const FilePath& path, RankCrashes action, return GENERIC; entry->Close(); - FlushQueue(cache); } rv = cache->OpenEntry(kCrashEntryName, &entry, &cb); @@ -202,7 +190,6 @@ int SimpleRemove(const FilePath& path, RankCrashes action, g_rankings_crash = action; entry->Doom(); entry->Close(); - FlushQueue(cache); return NOT_REACHED; } @@ -214,8 +201,7 @@ int HeadRemove(const FilePath& path, RankCrashes action, 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 @@ int HeadRemove(const FilePath& path, RankCrashes action, 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 @@ int HeadRemove(const FilePath& path, RankCrashes action, g_rankings_crash = action; entry->Doom(); entry->Close(); - FlushQueue(cache); return NOT_REACHED; } @@ -258,14 +241,14 @@ int LoadOperations(const FilePath& path, RankCrashes action, 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 @@ int LoadOperations(const FilePath& path, RankCrashes action, 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 @@ int LoadOperations(const FilePath& path, RankCrashes action, entry->Doom(); entry->Close(); - FlushQueue(cache); return NOT_REACHED; } |