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

Side by Side Diff: net/tools/crash_cache/crash_cache.cc

Issue 261045: Start migrating the disk cache to using FilePath. (Closed)
Patch Set: rebase Created 11 years, 2 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 unified diff | Download patch
« no previous file with comments | « net/disk_cache/stress_cache.cc ('k') | net/tools/dump_cache/upgrade.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This command-line program generates the set of files needed for the crash- 5 // This command-line program generates the set of files needed for the crash-
6 // cache unit tests (DiskCacheTest,CacheBackend_Recover*). This program only 6 // cache unit tests (DiskCacheTest,CacheBackend_Recover*). This program only
7 // works properly on debug mode, because the crash functionality is not compiled 7 // works properly on debug mode, because the crash functionality is not compiled
8 // on release builds of the cache. 8 // on release builds of the cache.
9 9
10 #include <string> 10 #include <string>
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 entry->Close(); 207 entry->Close();
208 208
209 return NOT_REACHED; 209 return NOT_REACHED;
210 } 210 }
211 211
212 // Generates the files for insertion and removals on heavy loaded caches. 212 // Generates the files for insertion and removals on heavy loaded caches.
213 int LoadOperations(const std::wstring& path, RankCrashes action) { 213 int LoadOperations(const std::wstring& path, RankCrashes action) {
214 DCHECK(action >= disk_cache::INSERT_LOAD_1); 214 DCHECK(action >= disk_cache::INSERT_LOAD_1);
215 215
216 // Work with a tiny index table (16 entries) 216 // Work with a tiny index table (16 entries)
217 disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(path, 0xf); 217 disk_cache::BackendImpl* cache =
218 new disk_cache::BackendImpl(FilePath::FromWStringHack(path), 0xf);
218 if (!cache || !cache->SetMaxSize(0x100000) || !cache->Init() || 219 if (!cache || !cache->SetMaxSize(0x100000) || !cache->Init() ||
219 cache->GetEntryCount()) 220 cache->GetEntryCount())
220 return GENERIC; 221 return GENERIC;
221 222
222 int seed = static_cast<int>(Time::Now().ToInternalValue()); 223 int seed = static_cast<int>(Time::Now().ToInternalValue());
223 srand(seed); 224 srand(seed);
224 225
225 disk_cache::Entry* entry; 226 disk_cache::Entry* entry;
226 for (int i = 0; i < 100; i++) { 227 for (int i = 0; i < 100; i++) {
227 std::string key = GenerateKey(true); 228 std::string key = GenerateKey(true);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 303
303 FilePath path; 304 FilePath path;
304 PathService::Get(base::DIR_SOURCE_ROOT, &path); 305 PathService::Get(base::DIR_SOURCE_ROOT, &path);
305 path = path.AppendASCII("net"); 306 path = path.AppendASCII("net");
306 path = path.AppendASCII("data"); 307 path = path.AppendASCII("data");
307 path = path.AppendASCII("cache_tests"); 308 path = path.AppendASCII("cache_tests");
308 path = path.AppendASCII("new_crashes"); 309 path = path.AppendASCII("new_crashes");
309 310
310 return SlaveCode(path.ToWStringHack(), action); 311 return SlaveCode(path.ToWStringHack(), action);
311 } 312 }
OLDNEW
« no previous file with comments | « net/disk_cache/stress_cache.cc ('k') | net/tools/dump_cache/upgrade.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698