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

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

Issue 2295983002: Fix memory leak in ThreadWatcher. (Closed)
Patch Set: Cleanup ThreadWatcher initialization logic. Created 4 years, 4 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') | chrome/browser/metrics/thread_watcher.cc » ('J')
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 6bf8d15cd1fccf0abf0abe431b6906861587f506..4ed6aa26ac1b15dc546383623f0eb180666c77f5 100644
--- a/chrome/browser/metrics/thread_watcher.h
+++ b/chrome/browser/metrics/thread_watcher.h
@@ -138,14 +138,14 @@ class ThreadWatcher {
// Returns |ping_sequence_number_| (used by unit tests).
uint64_t ping_sequence_number() const { return ping_sequence_number_; }
+ virtual ~ThreadWatcher();
Ilya Sherman 2016/08/31 03:54:42 nit: Please move this to the top of the class defi
Joshua LeVasseur 2016/08/31 19:06:50 Done.
+
protected:
// Construct a ThreadWatcher for the given |thread_id|. |sleep_time| is the
// wait time between ping messages. |unresponsive_time| is the wait time after
// ping message is sent, to check if we have received pong message or not.
explicit ThreadWatcher(const WatchingParams& params);
- virtual ~ThreadWatcher();
-
// This method activates the thread watching which starts ping/pong messaging.
virtual void ActivateThreadWatching();
@@ -394,10 +394,9 @@ class ThreadWatcherList {
static void StopWatchingAll();
// Register() stores a pointer to the given ThreadWatcher in a global map.
- static void Register(ThreadWatcher* watcher);
-
- // This method returns true if the ThreadWatcher object is registerd.
- static bool IsRegistered(const content::BrowserThread::ID thread_id);
+ // It takes ownership of the ThreadWatcher. Returns true if it was
Ilya Sherman 2016/08/31 03:54:42 nit: No need to document the ownership transfer --
Joshua LeVasseur 2016/08/31 19:06:50 Done.
+ // successfully registered.
+ static bool Register(std::unique_ptr<ThreadWatcher> watcher);
// This method returns number of responsive and unresponsive watched threads.
static void GetStatusOfThreads(uint32_t* responding_thread_count,
« no previous file with comments | « no previous file | chrome/browser/metrics/thread_watcher.cc » ('j') | chrome/browser/metrics/thread_watcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698