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

Unified Diff: net/url_request/url_request_job.cc

Issue 226263008: Revert of Attempting to resolve a race condition with PowerMonitor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « net/http/http_network_layer.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 13326691f7238ffbc41bb5b0a7bc7cb315ab91fd..31a0d508e043eb0642936eeade8d7ad900d7407c 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -36,7 +36,9 @@
deferred_redirect_status_code_(-1),
network_delegate_(network_delegate),
weak_factory_(this) {
- base::PowerMonitor::AddObserver(this);
+ base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
+ if (power_monitor)
+ power_monitor->AddObserver(this);
}
void URLRequestJob::SetUpload(UploadDataStream* upload) {
@@ -244,7 +246,11 @@
void URLRequestJob::NotifyURLRequestDestroyed() {
}
-URLRequestJob::~URLRequestJob() { base::PowerMonitor::RemoveObserver(this); }
+URLRequestJob::~URLRequestJob() {
+ base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
+ if (power_monitor)
+ power_monitor->RemoveObserver(this);
+}
void URLRequestJob::NotifyCertificateRequested(
SSLCertRequestInfo* cert_request_info) {
« no previous file with comments | « net/http/http_network_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698