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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 BrowserThread::UI, | 529 BrowserThread::UI, |
530 FROM_HERE, | 530 FROM_HERE, |
531 base::Bind(&StartupTimeBomb::DisarmStartupTimeBomb)); | 531 base::Bind(&StartupTimeBomb::DisarmStartupTimeBomb)); |
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 // Disable ThreadWatcher in Canary channel. | |
540 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | |
541 if (channel == chrome::VersionInfo::CHANNEL_CANARY || | |
542 channel == chrome::VersionInfo::CHANNEL_UNKNOWN) | |
Alexei Svitkine (slow)
2015/04/28 16:38:38
Nit: {}'s
ramant (doing other things)
2015/04/28 17:06:35
Done.
| |
543 return; | |
544 | |
539 ThreadWatcherList* thread_watcher_list = new ThreadWatcherList(); | 545 ThreadWatcherList* thread_watcher_list = new ThreadWatcherList(); |
540 CHECK(thread_watcher_list); | 546 CHECK(thread_watcher_list); |
541 | 547 |
542 const base::TimeDelta kSleepTime = | 548 const base::TimeDelta kSleepTime = |
543 base::TimeDelta::FromSeconds(kSleepSeconds); | 549 base::TimeDelta::FromSeconds(kSleepSeconds); |
544 const base::TimeDelta kUnresponsiveTime = | 550 const base::TimeDelta kUnresponsiveTime = |
545 base::TimeDelta::FromSeconds(kUnresponsiveSeconds); | 551 base::TimeDelta::FromSeconds(kUnresponsiveSeconds); |
546 | 552 |
547 StartWatching(BrowserThread::UI, "UI", kSleepTime, kUnresponsiveTime, | 553 StartWatching(BrowserThread::UI, "UI", kSleepTime, kUnresponsiveTime, |
548 unresponsive_threshold, crash_on_hang_threads); | 554 unresponsive_threshold, crash_on_hang_threads); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
921 | 927 |
922 #if defined(OS_WIN) | 928 #if defined(OS_WIN) |
923 // On Windows XP, give twice the time for shutdown. | 929 // On Windows XP, give twice the time for shutdown. |
924 if (base::win::GetVersion() <= base::win::VERSION_XP) | 930 if (base::win::GetVersion() <= base::win::VERSION_XP) |
925 actual_duration *= 2; | 931 actual_duration *= 2; |
926 #endif | 932 #endif |
927 | 933 |
928 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 934 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
929 shutdown_watchdog_->Arm(); | 935 shutdown_watchdog_->Arm(); |
930 } | 936 } |
OLD | NEW |