OLD | NEW |
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 Loading... |
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* power_monitor = base::PowerMonitor::Get(); | 39 base::PowerMonitor::AddObserver(this); |
40 if (power_monitor) | |
41 power_monitor->AddObserver(this); | |
42 } | 40 } |
43 | 41 |
44 void URLRequestJob::SetUpload(UploadDataStream* upload) { | 42 void URLRequestJob::SetUpload(UploadDataStream* upload) { |
45 } | 43 } |
46 | 44 |
47 void URLRequestJob::SetExtraRequestHeaders(const HttpRequestHeaders& headers) { | 45 void URLRequestJob::SetExtraRequestHeaders(const HttpRequestHeaders& headers) { |
48 } | 46 } |
49 | 47 |
50 void URLRequestJob::SetPriority(RequestPriority priority) { | 48 void URLRequestJob::SetPriority(RequestPriority priority) { |
51 } | 49 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 return HostPortPair(); | 233 return HostPortPair(); |
236 } | 234 } |
237 | 235 |
238 void URLRequestJob::OnSuspend() { | 236 void URLRequestJob::OnSuspend() { |
239 Kill(); | 237 Kill(); |
240 } | 238 } |
241 | 239 |
242 void URLRequestJob::NotifyURLRequestDestroyed() { | 240 void URLRequestJob::NotifyURLRequestDestroyed() { |
243 } | 241 } |
244 | 242 |
245 URLRequestJob::~URLRequestJob() { | 243 URLRequestJob::~URLRequestJob() { base::PowerMonitor::RemoveObserver(this); } |
246 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); | |
247 if (power_monitor) | |
248 power_monitor->RemoveObserver(this); | |
249 } | |
250 | 244 |
251 void URLRequestJob::NotifyCertificateRequested( | 245 void URLRequestJob::NotifyCertificateRequested( |
252 SSLCertRequestInfo* cert_request_info) { | 246 SSLCertRequestInfo* cert_request_info) { |
253 if (!request_) | 247 if (!request_) |
254 return; // The request was destroyed, so there is no more work to do. | 248 return; // The request was destroyed, so there is no more work to do. |
255 | 249 |
256 request_->NotifyCertificateRequested(cert_request_info); | 250 request_->NotifyCertificateRequested(cert_request_info); |
257 } | 251 } |
258 | 252 |
259 void URLRequestJob::NotifySSLCertificateError(const SSLInfo& ssl_info, | 253 void URLRequestJob::NotifySSLCertificateError(const SSLInfo& ssl_info, |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 } | 756 } |
763 | 757 |
764 bool URLRequestJob::FilterHasData() { | 758 bool URLRequestJob::FilterHasData() { |
765 return filter_.get() && filter_->stream_data_len(); | 759 return filter_.get() && filter_->stream_data_len(); |
766 } | 760 } |
767 | 761 |
768 void URLRequestJob::UpdatePacketReadTimes() { | 762 void URLRequestJob::UpdatePacketReadTimes() { |
769 } | 763 } |
770 | 764 |
771 } // namespace net | 765 } // namespace net |
OLD | NEW |