| Index: chrome/browser/metrics/thread_watcher.cc
|
| diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc
|
| index 1737593f294129536d4f1593a5b71b42241bea4a..8246b3eaafb963e7d66c6a2cdeef3d013f86b31b 100644
|
| --- a/chrome/browser/metrics/thread_watcher.cc
|
| +++ b/chrome/browser/metrics/thread_watcher.cc
|
| @@ -409,6 +409,8 @@ bool ThreadWatcher::IsVeryUnresponsive() {
|
| // static
|
| ThreadWatcherList* ThreadWatcherList::g_thread_watcher_list_ = NULL;
|
| // static
|
| +bool ThreadWatcherList::g_stopped_ = false;
|
| +// static
|
| const int ThreadWatcherList::kSleepSeconds = 1;
|
| // static
|
| const int ThreadWatcherList::kUnresponsiveSeconds = 2;
|
| @@ -443,6 +445,10 @@ void ThreadWatcherList::StartWatchingAll(const CommandLine& command_line) {
|
| ThreadWatcherObserver::SetupNotifications(
|
| base::TimeDelta::FromSeconds(kSleepSeconds * unresponsive_threshold));
|
|
|
| + WatchDogThread::PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&ThreadWatcherList::SetStopped, false));
|
| +
|
| WatchDogThread::PostDelayedTask(
|
| FROM_HERE,
|
| base::Bind(&ThreadWatcherList::InitializeAndStartWatching,
|
| @@ -635,6 +641,12 @@ void ThreadWatcherList::InitializeAndStartWatching(
|
| const CrashOnHangThreadMap& crash_on_hang_threads) {
|
| DCHECK(WatchDogThread::CurrentlyOnWatchDogThread());
|
|
|
| + // This method is deferred in relationship to its StopWatchingAll()
|
| + // counterpart. If a previous initialization has already happened, or if
|
| + // stop has been called, there's nothing left to do here.
|
| + if (g_thread_watcher_list_ || g_stopped_)
|
| + return;
|
| +
|
| ThreadWatcherList* thread_watcher_list = new ThreadWatcherList();
|
| CHECK(thread_watcher_list);
|
|
|
| @@ -700,6 +712,9 @@ void ThreadWatcherList::DeleteAll() {
|
| }
|
|
|
| DCHECK(WatchDogThread::CurrentlyOnWatchDogThread());
|
| +
|
| + SetStopped(true);
|
| +
|
| if (!g_thread_watcher_list_)
|
| return;
|
|
|
| @@ -725,6 +740,12 @@ ThreadWatcher* ThreadWatcherList::Find(const BrowserThread::ID& thread_id) {
|
| return it->second;
|
| }
|
|
|
| +// static
|
| +void ThreadWatcherList::SetStopped(bool stopped) {
|
| + DCHECK(WatchDogThread::CurrentlyOnWatchDogThread());
|
| + g_stopped_ = stopped;
|
| +}
|
| +
|
| // ThreadWatcherObserver methods and members.
|
| //
|
| // static
|
|
|