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

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: Refactored to a more explicitly singleton-like style. 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.cc ('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..da562cb033b3cabca8379e90029f1c525e6d0cf5 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::AddObserver(this);
}
void URLRequestJob::SetUpload(UploadDataStream* upload) {
@@ -242,11 +240,7 @@ void URLRequestJob::OnSuspend() {
void URLRequestJob::NotifyURLRequestDestroyed() {
}
-URLRequestJob::~URLRequestJob() {
- base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
- if (power_monitor)
- power_monitor->RemoveObserver(this);
-}
+URLRequestJob::~URLRequestJob() { base::PowerMonitor::RemoveObserver(this); }
void URLRequestJob::NotifyCertificateRequested(
SSLCertRequestInfo* cert_request_info) {
« base/power_monitor/power_monitor.cc ('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