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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 532 |
533 // This method is deferred in relationship to its StopWatchingAll() | 533 // This method is deferred in relationship to its StopWatchingAll() |
534 // counterpart. If a previous initialization has already happened, or if | 534 // counterpart. If a previous initialization has already happened, or if |
535 // stop has been called, there's nothing left to do here. | 535 // stop has been called, there's nothing left to do here. |
536 if (g_thread_watcher_list_ || g_stopped_) | 536 if (g_thread_watcher_list_ || g_stopped_) |
537 return; | 537 return; |
538 | 538 |
539 ThreadWatcherList* thread_watcher_list = new ThreadWatcherList(); | 539 ThreadWatcherList* thread_watcher_list = new ThreadWatcherList(); |
540 CHECK(thread_watcher_list); | 540 CHECK(thread_watcher_list); |
541 | 541 |
| 542 // Disable ThreadWatcher in Canary channel. |
| 543 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 544 if (channel == chrome::VersionInfo::CHANNEL_CANARY || |
| 545 channel == chrome::VersionInfo::CHANNEL_UNKNOWN) { |
| 546 return; |
| 547 } |
| 548 |
542 const base::TimeDelta kSleepTime = | 549 const base::TimeDelta kSleepTime = |
543 base::TimeDelta::FromSeconds(kSleepSeconds); | 550 base::TimeDelta::FromSeconds(kSleepSeconds); |
544 const base::TimeDelta kUnresponsiveTime = | 551 const base::TimeDelta kUnresponsiveTime = |
545 base::TimeDelta::FromSeconds(kUnresponsiveSeconds); | 552 base::TimeDelta::FromSeconds(kUnresponsiveSeconds); |
546 | 553 |
547 StartWatching(BrowserThread::UI, "UI", kSleepTime, kUnresponsiveTime, | 554 StartWatching(BrowserThread::UI, "UI", kSleepTime, kUnresponsiveTime, |
548 unresponsive_threshold, crash_on_hang_threads); | 555 unresponsive_threshold, crash_on_hang_threads); |
549 StartWatching(BrowserThread::IO, "IO", kSleepTime, kUnresponsiveTime, | 556 StartWatching(BrowserThread::IO, "IO", kSleepTime, kUnresponsiveTime, |
550 unresponsive_threshold, crash_on_hang_threads); | 557 unresponsive_threshold, crash_on_hang_threads); |
551 StartWatching(BrowserThread::DB, "DB", kSleepTime, kUnresponsiveTime, | 558 StartWatching(BrowserThread::DB, "DB", kSleepTime, kUnresponsiveTime, |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 | 928 |
922 #if defined(OS_WIN) | 929 #if defined(OS_WIN) |
923 // On Windows XP, give twice the time for shutdown. | 930 // On Windows XP, give twice the time for shutdown. |
924 if (base::win::GetVersion() <= base::win::VERSION_XP) | 931 if (base::win::GetVersion() <= base::win::VERSION_XP) |
925 actual_duration *= 2; | 932 actual_duration *= 2; |
926 #endif | 933 #endif |
927 | 934 |
928 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 935 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
929 shutdown_watchdog_->Arm(); | 936 shutdown_watchdog_->Arm(); |
930 } | 937 } |
OLD | NEW |