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 #include "chrome/browser/metrics/thread_watcher.h" | 5 #include "chrome/browser/metrics/thread_watcher.h" |
6 | 6 |
7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 339 } |
340 | 340 |
341 ThreadWatcherList::CrashDataThresholds::CrashDataThresholds() | 341 ThreadWatcherList::CrashDataThresholds::CrashDataThresholds() |
342 : live_threads_threshold(kLiveThreadsThreshold), | 342 : live_threads_threshold(kLiveThreadsThreshold), |
343 unresponsive_threshold(kUnresponsiveCount) { | 343 unresponsive_threshold(kUnresponsiveCount) { |
344 } | 344 } |
345 | 345 |
346 // static | 346 // static |
347 void ThreadWatcherList::StartWatchingAll( | 347 void ThreadWatcherList::StartWatchingAll( |
348 const base::CommandLine& command_line) { | 348 const base::CommandLine& command_line) { |
349 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 349 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
350 uint32 unresponsive_threshold; | 350 uint32 unresponsive_threshold; |
351 CrashOnHangThreadMap crash_on_hang_threads; | 351 CrashOnHangThreadMap crash_on_hang_threads; |
352 ParseCommandLine(command_line, | 352 ParseCommandLine(command_line, |
353 &unresponsive_threshold, | 353 &unresponsive_threshold, |
354 &crash_on_hang_threads); | 354 &crash_on_hang_threads); |
355 | 355 |
356 ThreadWatcherObserver::SetupNotifications( | 356 ThreadWatcherObserver::SetupNotifications( |
357 base::TimeDelta::FromSeconds(kSleepSeconds * unresponsive_threshold)); | 357 base::TimeDelta::FromSeconds(kSleepSeconds * unresponsive_threshold)); |
358 | 358 |
359 WatchDogThread::PostTask( | 359 WatchDogThread::PostTask( |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 | 921 |
922 #if defined(OS_WIN) | 922 #if defined(OS_WIN) |
923 // On Windows XP, give twice the time for shutdown. | 923 // On Windows XP, give twice the time for shutdown. |
924 if (base::win::GetVersion() <= base::win::VERSION_XP) | 924 if (base::win::GetVersion() <= base::win::VERSION_XP) |
925 actual_duration *= 2; | 925 actual_duration *= 2; |
926 #endif | 926 #endif |
927 | 927 |
928 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 928 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
929 shutdown_watchdog_->Arm(); | 929 shutdown_watchdog_->Arm(); |
930 } | 930 } |
OLD | NEW |