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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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/spdy/spdy_websocket_stream_spdy3_unittest.cc ('k') | net/tools/fetch/fetch_client.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) 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 cb.GetResult(rv); // Ignore the result; 133 cb.GetResult(rv); // Ignore the result;
134 } 134 }
135 135
136 bool CreateCache(const FilePath& path, 136 bool CreateCache(const FilePath& path,
137 base::Thread* thread, 137 base::Thread* thread,
138 disk_cache::Backend** cache, 138 disk_cache::Backend** cache,
139 net::TestCompletionCallback* cb) { 139 net::TestCompletionCallback* cb) {
140 int size = 1024 * 1024; 140 int size = 1024 * 1024;
141 int rv = disk_cache::BackendImpl::CreateBackend( 141 int rv = disk_cache::BackendImpl::CreateBackend(
142 path, false, size, net::DISK_CACHE, disk_cache::kNoRandom, 142 path, false, size, net::DISK_CACHE, disk_cache::kNoRandom,
143 thread->message_loop_proxy(), NULL, cache, cb->callback()); 143 thread->message_loop_proxy().get(), NULL, cache, cb->callback());
144 144
145 return (cb->GetResult(rv) == net::OK && !(*cache)->GetEntryCount()); 145 return (cb->GetResult(rv) == net::OK && !(*cache)->GetEntryCount());
146 } 146 }
147 147
148 // Generates the files for an empty and one item cache. 148 // Generates the files for an empty and one item cache.
149 int SimpleInsert(const FilePath& path, RankCrashes action, 149 int SimpleInsert(const FilePath& path, RankCrashes action,
150 base::Thread* cache_thread) { 150 base::Thread* cache_thread) {
151 net::TestCompletionCallback cb; 151 net::TestCompletionCallback cb;
152 disk_cache::Backend* cache; 152 disk_cache::Backend* cache;
153 if (!CreateCache(path, cache_thread, &cache, &cb)) 153 if (!CreateCache(path, cache_thread, &cache, &cb))
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return NOT_REACHED; 255 return NOT_REACHED;
256 } 256 }
257 257
258 // Generates the files for insertion and removals on heavy loaded caches. 258 // Generates the files for insertion and removals on heavy loaded caches.
259 int LoadOperations(const FilePath& path, RankCrashes action, 259 int LoadOperations(const FilePath& path, RankCrashes action,
260 base::Thread* cache_thread) { 260 base::Thread* cache_thread) {
261 DCHECK(action >= disk_cache::INSERT_LOAD_1); 261 DCHECK(action >= disk_cache::INSERT_LOAD_1);
262 262
263 // Work with a tiny index table (16 entries). 263 // Work with a tiny index table (16 entries).
264 disk_cache::BackendImpl* cache = new disk_cache::BackendImpl( 264 disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(
265 path, 0xf, cache_thread->message_loop_proxy(), NULL); 265 path, 0xf, cache_thread->message_loop_proxy().get(), NULL);
266 if (!cache || !cache->SetMaxSize(0x100000)) 266 if (!cache || !cache->SetMaxSize(0x100000))
267 return GENERIC; 267 return GENERIC;
268 268
269 // No experiments and use a simple LRU. 269 // No experiments and use a simple LRU.
270 cache->SetFlags(disk_cache::kNoRandom); 270 cache->SetFlags(disk_cache::kNoRandom);
271 net::TestCompletionCallback cb; 271 net::TestCompletionCallback cb;
272 int rv = cache->Init(cb.callback()); 272 int rv = cache->Init(cb.callback());
273 if (cb.GetResult(rv) != net::OK || cache->GetEntryCount()) 273 if (cb.GetResult(rv) != net::OK || cache->GetEntryCount())
274 return GENERIC; 274 return GENERIC;
275 275
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 368
369 FilePath path; 369 FilePath path;
370 PathService::Get(base::DIR_SOURCE_ROOT, &path); 370 PathService::Get(base::DIR_SOURCE_ROOT, &path);
371 path = path.AppendASCII("net"); 371 path = path.AppendASCII("net");
372 path = path.AppendASCII("data"); 372 path = path.AppendASCII("data");
373 path = path.AppendASCII("cache_tests"); 373 path = path.AppendASCII("cache_tests");
374 path = path.AppendASCII("new_crashes"); 374 path = path.AppendASCII("new_crashes");
375 375
376 return SlaveCode(path, action); 376 return SlaveCode(path, action);
377 } 377 }
OLDNEW
« no previous file with comments | « net/spdy/spdy_websocket_stream_spdy3_unittest.cc ('k') | net/tools/fetch/fetch_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698