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

Side by Side Diff: net/disk_cache/stress_cache.cc

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/stats_histogram.cc ('k') | net/http/http_cache_transaction.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 is a simple application that stress-tests the crash recovery of the disk 5 // This is a simple application that stress-tests the crash recovery of the disk
6 // cache. The main application starts a copy of itself on a loop, checking the 6 // cache. The main application starts a copy of itself on a loop, checking the
7 // exit code of the child process. When the child dies in an unexpected way, 7 // exit code of the child process. When the child dies in an unexpected way,
8 // the main application quits. 8 // the main application quits.
9 9
10 // The child application has two threads: one to exercise the cache in an 10 // The child application has two threads: one to exercise the cache in an
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 #endif 123 #endif
124 const int kNumEntries = 30; 124 const int kNumEntries = 30;
125 std::string keys[kNumKeys]; 125 std::string keys[kNumKeys];
126 disk_cache::Entry* entries[kNumEntries] = {0}; 126 disk_cache::Entry* entries[kNumEntries] = {0};
127 127
128 for (int i = 0; i < kNumKeys; i++) { 128 for (int i = 0; i < kNumKeys; i++) {
129 keys[i] = GenerateKey(true); 129 keys[i] = GenerateKey(true);
130 } 130 }
131 131
132 const int kSize = 4000; 132 const int kSize = 4000;
133 scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); 133 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize));
134 memset(buffer->data(), 'k', kSize); 134 memset(buffer->data(), 'k', kSize);
135 135
136 for (int i = 0;; i++) { 136 for (int i = 0;; i++) {
137 int slot = rand() % kNumEntries; 137 int slot = rand() % kNumEntries;
138 int key = rand() % kNumKeys; 138 int key = rand() % kNumKeys;
139 bool truncate = rand() % 2 ? false : true; 139 bool truncate = rand() % 2 ? false : true;
140 int size = kSize - (rand() % 4) * kSize / 4; 140 int size = kSize - (rand() % 4) * kSize / 4;
141 141
142 if (entries[slot]) 142 if (entries[slot])
143 entries[slot]->Close(); 143 entries[slot]->Close();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 long int iteration = strtol(argv[1], &end, 0); 235 long int iteration = strtol(argv[1], &end, 0);
236 236
237 if (!StartCrashThread()) { 237 if (!StartCrashThread()) {
238 printf("failed to start thread\n"); 238 printf("failed to start thread\n");
239 return kError; 239 return kError;
240 } 240 }
241 241
242 StressTheCache(iteration); 242 StressTheCache(iteration);
243 return 0; 243 return 0;
244 } 244 }
OLDNEW
« no previous file with comments | « net/disk_cache/stats_histogram.cc ('k') | net/http/http_cache_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698