Index: chrome/browser/metrics/thread_watcher.cc |
diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc |
index b4f54b8eb1442941950f4e1401187b3e65373f16..5badf2b6bbd2f87909e2d941cfb5f6059c39a8ee 100644 |
--- a/chrome/browser/metrics/thread_watcher.cc |
+++ b/chrome/browser/metrics/thread_watcher.cc |
@@ -439,7 +439,7 @@ ThreadWatcherList::CrashDataThresholds::CrashDataThresholds() |
// static |
void ThreadWatcherList::StartWatchingAll(const CommandLine& command_line) { |
- // TODO(rtenneti): Enable ThreadWatcher. |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
uint32 unresponsive_threshold; |
CrashOnHangThreadMap crash_on_hang_threads; |
ParseCommandLine(command_line, |
@@ -453,12 +453,16 @@ void ThreadWatcherList::StartWatchingAll(const CommandLine& command_line) { |
FROM_HERE, |
base::Bind(&ThreadWatcherList::SetStopped, false)); |
- WatchDogThread::PostDelayedTask( |
- FROM_HERE, |
- base::Bind(&ThreadWatcherList::InitializeAndStartWatching, |
- unresponsive_threshold, |
- crash_on_hang_threads), |
- base::TimeDelta::FromSeconds(g_initialize_delay_seconds)); |
+ if (!WatchDogThread::PostDelayedTask( |
+ FROM_HERE, |
+ base::Bind(&ThreadWatcherList::InitializeAndStartWatching, |
+ unresponsive_threshold, |
+ crash_on_hang_threads), |
+ base::TimeDelta::FromSeconds(g_initialize_delay_seconds))) { |
+ // Disarm() the startup timebomb, if we couldn't post the task to start the |
+ // ThreadWatcher (becasue WatchDog thread is not running). |
+ StartupTimeBomb::DisarmStartupTimeBomb(); |
+ } |
} |
// static |