| Index: chrome/browser/metrics/thread_watcher.cc
|
| ===================================================================
|
| --- chrome/browser/metrics/thread_watcher.cc (revision 111993)
|
| +++ chrome/browser/metrics/thread_watcher.cc (working copy)
|
| @@ -590,7 +590,8 @@
|
| BrowserThread::PostTask(
|
| BrowserThread::UI,
|
| FROM_HERE,
|
| - base::Bind(StartupTimeBomb::Disarm));
|
| + base::Bind(&StartupTimeBomb::Disarm,
|
| + base::Unretained(StartupTimeBomb::g_startup_timebomb_)));
|
| }
|
|
|
| // static
|
| @@ -828,9 +829,19 @@
|
| // StartupTimeBomb methods and members.
|
| //
|
| // static
|
| -base::Watchdog* StartupTimeBomb::startup_watchdog_ = NULL;
|
| +StartupTimeBomb* StartupTimeBomb::g_startup_timebomb_ = NULL;
|
|
|
| -// static
|
| +StartupTimeBomb::StartupTimeBomb() : startup_watchdog_(NULL) {
|
| + CHECK(!g_startup_timebomb_);
|
| + g_startup_timebomb_ = this;
|
| +}
|
| +
|
| +StartupTimeBomb::~StartupTimeBomb() {
|
| + DCHECK(this == g_startup_timebomb_);
|
| + Disarm();
|
| + g_startup_timebomb_ = NULL;
|
| +}
|
| +
|
| void StartupTimeBomb::Arm(const base::TimeDelta& duration) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DCHECK(!startup_watchdog_);
|
| @@ -838,9 +849,8 @@
|
| startup_watchdog_->Arm();
|
| }
|
|
|
| -// static
|
| void StartupTimeBomb::Disarm() {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + // This could be disarm'ed during shutdown when we are not on UI thread.
|
| if (startup_watchdog_) {
|
| startup_watchdog_->Disarm();
|
| // Allow the watchdog thread to shutdown on UI. Watchdog thread shutdowns
|
|
|