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

Unified Diff: net/url_request/url_request_job.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
« base/power_monitor/power_monitor.h ('K') | « content/gpu/gpu_watchdog_thread.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_job.cc
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc
index 78f704a3a15f54f612c96ba4f4313be633198e19..a3348c69cf8fa684de3290b7f8e5d0d725ec2a7a 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -36,9 +36,7 @@ URLRequestJob::URLRequestJob(URLRequest* request,
deferred_redirect_status_code_(-1),
network_delegate_(network_delegate),
weak_factory_(this) {
- base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
- if (power_monitor)
- power_monitor->AddObserver(this);
+ base::PowerMonitor::AddObserverThreadSafe(this);
}
void URLRequestJob::SetUpload(UploadDataStream* upload) {
@@ -243,9 +241,7 @@ void URLRequestJob::NotifyURLRequestDestroyed() {
}
URLRequestJob::~URLRequestJob() {
- base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
- if (power_monitor)
- power_monitor->RemoveObserver(this);
+ base::PowerMonitor::RemoveObserverThreadSafe(this);
}
void URLRequestJob::NotifyCertificateRequested(
« base/power_monitor/power_monitor.h ('K') | « content/gpu/gpu_watchdog_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698