Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 } | 261 } |
| 262 | 262 |
| 263 // Generates the files for insertion and removals on heavy loaded caches. | 263 // Generates the files for insertion and removals on heavy loaded caches. |
| 264 int LoadOperations(const base::FilePath& path, RankCrashes action, | 264 int LoadOperations(const base::FilePath& path, RankCrashes action, |
| 265 base::Thread* cache_thread) { | 265 base::Thread* cache_thread) { |
| 266 DCHECK(action >= disk_cache::INSERT_LOAD_1); | 266 DCHECK(action >= disk_cache::INSERT_LOAD_1); |
| 267 | 267 |
| 268 // Work with a tiny index table (16 entries). | 268 // Work with a tiny index table (16 entries). |
| 269 disk_cache::BackendImpl* cache = new disk_cache::BackendImpl( | 269 disk_cache::BackendImpl* cache = new disk_cache::BackendImpl( |
| 270 path, 0xf, cache_thread->message_loop_proxy().get(), NULL); | 270 path, 0xf, cache_thread->message_loop_proxy().get(), NULL); |
| 271 if (!cache || !cache->SetMaxSize(0x100000)) | 271 if (!cache->SetMaxSize(0x100000)) |
|
rvargas (doing something else)
2013/09/03 19:01:06
Can we leave this as it was? This is a tool, not p
Nico
2013/09/03 19:17:33
Have you checked that new actually returns null on
rvargas (doing something else)
2013/10/16 19:01:23
As of vs2010 this also crashes with C++ exceptions
| |
| 272 return GENERIC; | 272 return GENERIC; |
| 273 | 273 |
| 274 // No experiments and use a simple LRU. | 274 // No experiments and use a simple LRU. |
| 275 cache->SetFlags(disk_cache::kNoRandom); | 275 cache->SetFlags(disk_cache::kNoRandom); |
| 276 net::TestCompletionCallback cb; | 276 net::TestCompletionCallback cb; |
| 277 int rv = cache->Init(cb.callback()); | 277 int rv = cache->Init(cb.callback()); |
| 278 if (cb.GetResult(rv) != net::OK || cache->GetEntryCount()) | 278 if (cb.GetResult(rv) != net::OK || cache->GetEntryCount()) |
| 279 return GENERIC; | 279 return GENERIC; |
| 280 | 280 |
| 281 int seed = static_cast<int>(Time::Now().ToInternalValue()); | 281 int seed = static_cast<int>(Time::Now().ToInternalValue()); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 | 373 |
| 374 base::FilePath path; | 374 base::FilePath path; |
| 375 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 375 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 376 path = path.AppendASCII("net"); | 376 path = path.AppendASCII("net"); |
| 377 path = path.AppendASCII("data"); | 377 path = path.AppendASCII("data"); |
| 378 path = path.AppendASCII("cache_tests"); | 378 path = path.AppendASCII("cache_tests"); |
| 379 path = path.AppendASCII("new_crashes"); | 379 path = path.AppendASCII("new_crashes"); |
| 380 | 380 |
| 381 return SlaveCode(path, action); | 381 return SlaveCode(path, action); |
| 382 } | 382 } |
| OLD | NEW |