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

Side by Side Diff: chrome/browser/metrics/thread_watcher.h

Issue 2289333002: ThreadWatcher: fix use-after-free bug. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file defines a WatchDog thread that monitors the responsiveness of other 5 // This file defines a WatchDog thread that monitors the responsiveness of other
6 // browser threads like UI, IO, DB, FILE and CACHED threads. It also defines 6 // browser threads like UI, IO, DB, FILE and CACHED threads. It also defines
7 // ThreadWatcher class which performs health check on threads that would like to 7 // ThreadWatcher class which performs health check on threads that would like to
8 // be watched. This file also defines ThreadWatcherList class that has list of 8 // be watched. This file also defines ThreadWatcherList class that has list of
9 // all active ThreadWatcher objects. 9 // all active ThreadWatcher objects.
10 // 10 //
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 class StartupTimeBomb; 71 class StartupTimeBomb;
72 class ThreadWatcherList; 72 class ThreadWatcherList;
73 class ThreadWatcherObserver; 73 class ThreadWatcherObserver;
74 74
75 // This class performs health check on threads that would like to be watched. 75 // This class performs health check on threads that would like to be watched.
76 class ThreadWatcher { 76 class ThreadWatcher {
77 public: 77 public:
78 // base::Bind supports methods with up to 6 parameters. WatchingParams is used 78 // base::Bind supports methods with up to 6 parameters. WatchingParams is used
79 // as a workaround that limitation for invoking ThreadWatcher::StartWatching. 79 // as a workaround that limitation for invoking ThreadWatcher::StartWatching.
80 struct WatchingParams { 80 struct WatchingParams {
81 const content::BrowserThread::ID& thread_id; 81 content::BrowserThread::ID thread_id;
82 const std::string& thread_name; 82 std::string thread_name;
83 const base::TimeDelta& sleep_time; 83 base::TimeDelta sleep_time;
84 const base::TimeDelta& unresponsive_time; 84 base::TimeDelta unresponsive_time;
85 uint32_t unresponsive_threshold; 85 uint32_t unresponsive_threshold;
86 bool crash_on_hang; 86 bool crash_on_hang;
87 uint32_t live_threads_threshold; 87 uint32_t live_threads_threshold;
88 88
89 WatchingParams(const content::BrowserThread::ID& thread_id_in, 89 WatchingParams(const content::BrowserThread::ID& thread_id_in,
90 const std::string& thread_name_in, 90 const std::string& thread_name_in,
91 const base::TimeDelta& sleep_time_in, 91 const base::TimeDelta& sleep_time_in,
92 const base::TimeDelta& unresponsive_time_in, 92 const base::TimeDelta& unresponsive_time_in,
93 uint32_t unresponsive_threshold_in, 93 uint32_t unresponsive_threshold_in,
94 bool crash_on_hang_in, 94 bool crash_on_hang_in,
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 // shutdown_watchdog_ watches for hangs during shutdown. 687 // shutdown_watchdog_ watches for hangs during shutdown.
688 base::Watchdog* shutdown_watchdog_; 688 base::Watchdog* shutdown_watchdog_;
689 689
690 // The |thread_id_| on which this object is constructed. 690 // The |thread_id_| on which this object is constructed.
691 const base::PlatformThreadId thread_id_; 691 const base::PlatformThreadId thread_id_;
692 692
693 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper); 693 DISALLOW_COPY_AND_ASSIGN(ShutdownWatcherHelper);
694 }; 694 };
695 695
696 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_ 696 #endif // CHROME_BROWSER_METRICS_THREAD_WATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698