Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1552)

Unified Diff: chrome/browser/metrics/thread_watcher.h

Issue 8728035: Disarm StartupTimeBomb when it is deleted (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/metrics/thread_watcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/thread_watcher.h
===================================================================
--- chrome/browser/metrics/thread_watcher.h (revision 111993)
+++ chrome/browser/metrics/thread_watcher.h (working copy)
@@ -56,6 +56,7 @@
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/synchronization/lock.h"
+#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
#include "base/threading/watchdog.h"
#include "base/time.h"
@@ -493,19 +494,35 @@
// startup.
class StartupTimeBomb {
public:
+ // This singleton is instantiated when the browser process is launched.
+ StartupTimeBomb();
+
+ // Destructor disarm's startup_watchdog_ (if it is arm'ed) so that alarm
+ // doesn't go off.
+ ~StartupTimeBomb();
+
// Constructs |startup_watchdog_| which spawns a thread and starts timer.
// |duration| specifies how long |startup_watchdog_| will wait before it
// calls alarm.
- static void Arm(const base::TimeDelta& duration);
+ void Arm(const base::TimeDelta& duration);
// Disarms |startup_watchdog_| thread and then deletes it which stops the
// Watchdog thread.
- static void Disarm();
+ void Disarm();
+ // Disarms |g_startup_timebomb_|.
+ static void DisarmStartupTimeBomb();
+
private:
+ // The singleton of this class.
+ static StartupTimeBomb* g_startup_timebomb_;
+
// Watches for hangs during startup until it is disarm'ed.
- static base::Watchdog* startup_watchdog_;
+ base::Watchdog* startup_watchdog_;
+ // The |thread_id_| on which this object is constructed.
+ const base::PlatformThreadId thread_id_;
+
DISALLOW_COPY_AND_ASSIGN(StartupTimeBomb);
};
@@ -526,6 +543,9 @@
// shutdown_watchdog_ watches for hangs during shutdown.
base::Watchdog* shutdown_watchdog_;
+ // The |thread_id_| on which this object is constructed.
+ const base::PlatformThreadId thread_id_;
+
DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper);
};
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/metrics/thread_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698