| 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::AddObserverThreadSafe(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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() { |
| 246 base::PowerMonitor* power_monitor = base::PowerMonitor::Get(); | 244 base::PowerMonitor::RemoveObserverThreadSafe(this); |
| 247 if (power_monitor) | |
| 248 power_monitor->RemoveObserver(this); | |
| 249 } | 245 } |
| 250 | 246 |
| 251 void URLRequestJob::NotifyCertificateRequested( | 247 void URLRequestJob::NotifyCertificateRequested( |
| 252 SSLCertRequestInfo* cert_request_info) { | 248 SSLCertRequestInfo* cert_request_info) { |
| 253 if (!request_) | 249 if (!request_) |
| 254 return; // The request was destroyed, so there is no more work to do. | 250 return; // The request was destroyed, so there is no more work to do. |
| 255 | 251 |
| 256 request_->NotifyCertificateRequested(cert_request_info); | 252 request_->NotifyCertificateRequested(cert_request_info); |
| 257 } | 253 } |
| 258 | 254 |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 } | 750 } |
| 755 | 751 |
| 756 bool URLRequestJob::FilterHasData() { | 752 bool URLRequestJob::FilterHasData() { |
| 757 return filter_.get() && filter_->stream_data_len(); | 753 return filter_.get() && filter_->stream_data_len(); |
| 758 } | 754 } |
| 759 | 755 |
| 760 void URLRequestJob::UpdatePacketReadTimes() { | 756 void URLRequestJob::UpdatePacketReadTimes() { |
| 761 } | 757 } |
| 762 | 758 |
| 763 } // namespace net | 759 } // namespace net |
| OLD | NEW |