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

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

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix installation_validator_unittest Created 4 years, 6 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
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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 #endif 407 #endif
408 408
409 int main(int argc, const char* argv[]) { 409 int main(int argc, const char* argv[]) {
410 // Setup an AtExitManager so Singleton objects will be destructed. 410 // Setup an AtExitManager so Singleton objects will be destructed.
411 base::AtExitManager at_exit_manager; 411 base::AtExitManager at_exit_manager;
412 412
413 if (argc < 2) 413 if (argc < 2)
414 return MasterCode(); 414 return MasterCode();
415 415
416 logging::SetLogAssertHandler(CrashHandler); 416 logging::SetLogAssertHandler(CrashHandler);
417 logging::SetLogMessageHandler(MessageHandler); 417 logging::PushLogMessageHandler(MessageHandler);
418 418
419 #if defined(OS_WIN) 419 #if defined(OS_WIN)
420 logging::LogEventProvider::Initialize(kStressCacheTraceProviderName); 420 logging::LogEventProvider::Initialize(kStressCacheTraceProviderName);
421 #else 421 #else
422 base::CommandLine::Init(argc, argv); 422 base::CommandLine::Init(argc, argv);
423 logging::LoggingSettings settings; 423 logging::LoggingSettings settings;
424 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 424 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
425 logging::InitLogging(settings); 425 logging::InitLogging(settings);
426 #endif 426 #endif
427 427
428 // Some time for the memory manager to flush stuff. 428 // Some time for the memory manager to flush stuff.
429 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(3)); 429 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(3));
430 base::MessageLoopForIO message_loop; 430 base::MessageLoopForIO message_loop;
431 431
432 char* end; 432 char* end;
433 long int iteration = strtol(argv[1], &end, 0); 433 long int iteration = strtol(argv[1], &end, 0);
434 434
435 if (!StartCrashThread()) { 435 if (!StartCrashThread()) {
436 printf("failed to start thread\n"); 436 printf("failed to start thread\n");
437 return kError; 437 return kError;
438 } 438 }
439 439
440 StressTheCache(iteration); 440 StressTheCache(iteration);
441 return 0; 441 return 0;
442 } 442 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698