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

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

Issue 188653003: ThreadWatcher: fixes Start/StopWatchingAll. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 months 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 | « no previous file | 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
diff --git a/chrome/browser/metrics/thread_watcher.h b/chrome/browser/metrics/thread_watcher.h
index 2c4b027dcf609e48366401e5795571296e376ffa..94d5248cf6d9bd32276657175a5daa274a591df5 100644
--- a/chrome/browser/metrics/thread_watcher.h
+++ b/chrome/browser/metrics/thread_watcher.h
@@ -406,12 +406,14 @@ class ThreadWatcherList {
private:
// Allow tests to access our innards for testing purposes.
friend class CustomThreadWatcher;
+ friend class ThreadWatcherListTest;
friend class ThreadWatcherTest;
+ FRIEND_TEST_ALL_PREFIXES(ThreadWatcherAndroidTest,
+ ApplicationStatusNotification);
+ FRIEND_TEST_ALL_PREFIXES(ThreadWatcherListTest, Restart);
FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, ThreadNamesOnlyArgs);
FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, ThreadNamesAndLiveThresholdArgs);
FRIEND_TEST_ALL_PREFIXES(ThreadWatcherTest, CrashOnHangThreadsAllArgs);
- FRIEND_TEST_ALL_PREFIXES(ThreadWatcherAndroidTest,
- ApplicationStatusNotification);
// This singleton holds the global list of registered ThreadWatchers.
ThreadWatcherList();
@@ -464,10 +466,19 @@ class ThreadWatcherList {
// already registered, or to retrieve a pointer to it from the global map.
static ThreadWatcher* Find(const content::BrowserThread::ID& thread_id);
+ // Sets |g_stopped_| on the WatchDogThread. This is necessary to reflect the
+ // state between the delayed |StartWatchingAll| and the immediate
+ // |StopWatchingAll|.
+ static void SetStopped(bool stopped);
+
// The singleton of this class and is used to keep track of information about
// threads that are being watched.
static ThreadWatcherList* g_thread_watcher_list_;
+ // StartWatchingAll() is delayed in relation to StopWatchingAll(), so if
+ // a Stop comes first, prevent further initialization.
+ static bool g_stopped_;
+
// This is the wait time between ping messages.
static const int kSleepSeconds;
« no previous file with comments | « no previous file | chrome/browser/metrics/thread_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698