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

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

Issue 983963002: Redefine base::Process:Terminate so that it can replace base::KillProcess (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add const Created 5 years, 9 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 | « content/browser/child_process_launcher.cc ('k') | win8/delegate_execute/delegate_execute.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // Keep trying to run. 197 // Keep trying to run.
198 RunSoon(base::MessageLoop::current()); 198 RunSoon(base::MessageLoop::current());
199 199
200 if (g_crashing) 200 if (g_crashing)
201 return; 201 return;
202 202
203 if (rand() % 100 > 30) { 203 if (rand() % 100 > 30) {
204 printf("sweet death...\n"); 204 printf("sweet death...\n");
205 #if defined(OS_WIN) 205 #if defined(OS_WIN)
206 // Windows does more work on _exit() than we would like. 206 // Windows does more work on _exit() than we would like.
207 base::Process::Current().Terminate(kExpectedCrash); 207 base::Process::Current().Terminate(kExpectedCrash, false);
208 #elif defined(OS_POSIX) 208 #elif defined(OS_POSIX)
209 // On POSIX, _exit() will terminate the process with minimal cleanup, 209 // On POSIX, _exit() will terminate the process with minimal cleanup,
210 // and it is cleaner than killing. 210 // and it is cleaner than killing.
211 _exit(kExpectedCrash); 211 _exit(kExpectedCrash);
212 #endif 212 #endif
213 } 213 }
214 } 214 }
215 215
216 void RunSoon(base::MessageLoop* target_loop) { 216 void RunSoon(base::MessageLoop* target_loop) {
217 const base::TimeDelta kTaskDelay = base::TimeDelta::FromSeconds(10); 217 const base::TimeDelta kTaskDelay = base::TimeDelta::FromSeconds(10);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 long int iteration = strtol(argv[1], &end, 0); 284 long int iteration = strtol(argv[1], &end, 0);
285 285
286 if (!StartCrashThread()) { 286 if (!StartCrashThread()) {
287 printf("failed to start thread\n"); 287 printf("failed to start thread\n");
288 return kError; 288 return kError;
289 } 289 }
290 290
291 StressTheCache(iteration); 291 StressTheCache(iteration);
292 return 0; 292 return 0;
293 } 293 }
OLDNEW
« no previous file with comments | « content/browser/child_process_launcher.cc ('k') | win8/delegate_execute/delegate_execute.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698