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

Unified Diff: content/gpu/gpu_watchdog_thread.cc

Issue 179923006: Attempting to resolve a race condition with PowerMonitor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
Index: content/gpu/gpu_watchdog_thread.cc
diff --git a/content/gpu/gpu_watchdog_thread.cc b/content/gpu/gpu_watchdog_thread.cc
index 940d07e72ac43ae0cb6f36e1b160ab48c6bd7f24..ff2d2ad447deb3fc8119ad17e82b37336c8aaa07 100644
--- a/content/gpu/gpu_watchdog_thread.cc
+++ b/content/gpu/gpu_watchdog_thread.cc
@@ -114,9 +114,7 @@ GpuWatchdogThread::~GpuWatchdogThread() {
CloseHandle(watched_thread_handle_);
#endif
- base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
- if (power_monitor)
- power_monitor->RemoveObserver(this);
+ base::PowerMonitor::RemoveObserverThreadSafe(this);
#if defined(OS_CHROMEOS)
if (tty_file_)
@@ -266,9 +264,7 @@ void GpuWatchdogThread::AddPowerObserver() {
}
void GpuWatchdogThread::OnAddPowerObserver() {
- base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
- DCHECK(power_monitor);
- power_monitor->AddObserver(this);
+ DCHECK(base::PowerMonitor::AddObserverThreadSafe(this));
}
void GpuWatchdogThread::OnSuspend() {

Powered by Google App Engine
This is Rietveld 408576698