| OLD | NEW |
| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 if (argc < 2) | 263 if (argc < 2) |
| 264 return MasterCode(); | 264 return MasterCode(); |
| 265 | 265 |
| 266 logging::SetLogAssertHandler(CrashHandler); | 266 logging::SetLogAssertHandler(CrashHandler); |
| 267 logging::SetLogMessageHandler(MessageHandler); | 267 logging::SetLogMessageHandler(MessageHandler); |
| 268 | 268 |
| 269 #if defined(OS_WIN) | 269 #if defined(OS_WIN) |
| 270 logging::LogEventProvider::Initialize(kStressCacheTraceProviderName); | 270 logging::LogEventProvider::Initialize(kStressCacheTraceProviderName); |
| 271 #else | 271 #else |
| 272 CommandLine::Init(argc, argv); | 272 CommandLine::Init(argc, argv); |
| 273 logging::InitLogging(NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 273 logging::LoggingSettings settings; |
| 274 logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE, | 274 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 275 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 275 logging::InitLogging(settings); |
| 276 #endif | 276 #endif |
| 277 | 277 |
| 278 // Some time for the memory manager to flush stuff. | 278 // Some time for the memory manager to flush stuff. |
| 279 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(3)); | 279 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(3)); |
| 280 base::MessageLoop message_loop(base::MessageLoop::TYPE_IO); | 280 base::MessageLoop message_loop(base::MessageLoop::TYPE_IO); |
| 281 | 281 |
| 282 char* end; | 282 char* end; |
| 283 long int iteration = strtol(argv[1], &end, 0); | 283 long int iteration = strtol(argv[1], &end, 0); |
| 284 | 284 |
| 285 if (!StartCrashThread()) { | 285 if (!StartCrashThread()) { |
| 286 printf("failed to start thread\n"); | 286 printf("failed to start thread\n"); |
| 287 return kError; | 287 return kError; |
| 288 } | 288 } |
| 289 | 289 |
| 290 StressTheCache(iteration); | 290 StressTheCache(iteration); |
| 291 return 0; | 291 return 0; |
| 292 } | 292 } |
| OLD | NEW |