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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_network_layer.cc ('k') | 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 #include "net/url_request/url_request_job.h" 5 #include "net/url_request/url_request_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/power_monitor/power_monitor.h" 10 #include "base/power_monitor/power_monitor.h"
(...skipping 18 matching lines...) Expand all
29 prefilter_bytes_read_(0), 29 prefilter_bytes_read_(0),
30 postfilter_bytes_read_(0), 30 postfilter_bytes_read_(0),
31 filter_input_byte_count_(0), 31 filter_input_byte_count_(0),
32 filter_needs_more_output_space_(false), 32 filter_needs_more_output_space_(false),
33 filtered_read_buffer_len_(0), 33 filtered_read_buffer_len_(0),
34 has_handled_response_(false), 34 has_handled_response_(false),
35 expected_content_size_(-1), 35 expected_content_size_(-1),
36 deferred_redirect_status_code_(-1), 36 deferred_redirect_status_code_(-1),
37 network_delegate_(network_delegate), 37 network_delegate_(network_delegate),
38 weak_factory_(this) { 38 weak_factory_(this) {
39 base::PowerMonitor::AddObserver(this); 39 base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
40 if (power_monitor)
41 power_monitor->AddObserver(this);
40 } 42 }
41 43
42 void URLRequestJob::SetUpload(UploadDataStream* upload) { 44 void URLRequestJob::SetUpload(UploadDataStream* upload) {
43 } 45 }
44 46
45 void URLRequestJob::SetExtraRequestHeaders(const HttpRequestHeaders& headers) { 47 void URLRequestJob::SetExtraRequestHeaders(const HttpRequestHeaders& headers) {
46 } 48 }
47 49
48 void URLRequestJob::SetPriority(RequestPriority priority) { 50 void URLRequestJob::SetPriority(RequestPriority priority) {
49 } 51 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return HostPortPair(); 239 return HostPortPair();
238 } 240 }
239 241
240 void URLRequestJob::OnSuspend() { 242 void URLRequestJob::OnSuspend() {
241 Kill(); 243 Kill();
242 } 244 }
243 245
244 void URLRequestJob::NotifyURLRequestDestroyed() { 246 void URLRequestJob::NotifyURLRequestDestroyed() {
245 } 247 }
246 248
247 URLRequestJob::~URLRequestJob() { base::PowerMonitor::RemoveObserver(this); } 249 URLRequestJob::~URLRequestJob() {
250 base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
251 if (power_monitor)
252 power_monitor->RemoveObserver(this);
253 }
248 254
249 void URLRequestJob::NotifyCertificateRequested( 255 void URLRequestJob::NotifyCertificateRequested(
250 SSLCertRequestInfo* cert_request_info) { 256 SSLCertRequestInfo* cert_request_info) {
251 if (!request_) 257 if (!request_)
252 return; // The request was destroyed, so there is no more work to do. 258 return; // The request was destroyed, so there is no more work to do.
253 259
254 request_->NotifyCertificateRequested(cert_request_info); 260 request_->NotifyCertificateRequested(cert_request_info);
255 } 261 }
256 262
257 void URLRequestJob::NotifySSLCertificateError(const SSLInfo& ssl_info, 263 void URLRequestJob::NotifySSLCertificateError(const SSLInfo& ssl_info,
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 767 }
762 768
763 bool URLRequestJob::FilterHasData() { 769 bool URLRequestJob::FilterHasData() {
764 return filter_.get() && filter_->stream_data_len(); 770 return filter_.get() && filter_->stream_data_len();
765 } 771 }
766 772
767 void URLRequestJob::UpdatePacketReadTimes() { 773 void URLRequestJob::UpdatePacketReadTimes() {
768 } 774 }
769 775
770 } // namespace net 776 } // namespace net
OLDNEW
« 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