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

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

Issue 2841034: Disk cache: Switch the disk cache to use the cache_thread.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix tsan issues Created 10 years, 5 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 | Annotate | Revision Log
Property Changes:
Deleted: svn:mergeinfo
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 CHECK_EQ(kSize, cb.GetResult(rv)); 133 CHECK_EQ(kSize, cb.GetResult(rv));
134 134
135 if (rand() % 100 > 80) { 135 if (rand() % 100 > 80) {
136 key = rand() % kNumKeys; 136 key = rand() % kNumKeys;
137 rv = cache->DoomEntry(keys[key], &cb); 137 rv = cache->DoomEntry(keys[key], &cb);
138 cb.GetResult(rv); 138 cb.GetResult(rv);
139 } 139 }
140 140
141 if (!(i % 100)) 141 if (!(i % 100))
142 printf("Entries: %d \r", i); 142 printf("Entries: %d \r", i);
143 MessageLoop::current()->RunAllPending();
144 } 143 }
145 } 144 }
146 145
147 // We want to prevent the timer thread from killing the process while we are 146 // We want to prevent the timer thread from killing the process while we are
148 // waiting for the debugger to attach. 147 // waiting for the debugger to attach.
149 bool g_crashing = false; 148 bool g_crashing = false;
150 149
151 class CrashTask : public Task { 150 class CrashTask : public Task {
152 public: 151 public:
153 CrashTask() {} 152 CrashTask() {}
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 long int iteration = strtol(argv[1], &end, 0); 213 long int iteration = strtol(argv[1], &end, 0);
215 214
216 if (!StartCrashThread()) { 215 if (!StartCrashThread()) {
217 printf("failed to start thread\n"); 216 printf("failed to start thread\n");
218 return kError; 217 return kError;
219 } 218 }
220 219
221 StressTheCache(iteration); 220 StressTheCache(iteration);
222 return 0; 221 return 0;
223 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698