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

Side by Side Diff: net/url_request/url_request_job.cc

Issue 10959020: SystemMonitor refactoring: move power state monitor into a separate class called PowerMonitor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update patch per vandebo's comments Created 8 years, 2 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
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.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 16 matching lines...) Expand all
27 prefilter_bytes_read_(0), 27 prefilter_bytes_read_(0),
28 postfilter_bytes_read_(0), 28 postfilter_bytes_read_(0),
29 filter_input_byte_count_(0), 29 filter_input_byte_count_(0),
30 filter_needs_more_output_space_(false), 30 filter_needs_more_output_space_(false),
31 filtered_read_buffer_len_(0), 31 filtered_read_buffer_len_(0),
32 has_handled_response_(false), 32 has_handled_response_(false),
33 expected_content_size_(-1), 33 expected_content_size_(-1),
34 deferred_redirect_status_code_(-1), 34 deferred_redirect_status_code_(-1),
35 network_delegate_(network_delegate), 35 network_delegate_(network_delegate),
36 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 36 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
37 base::SystemMonitor* system_monitor = base::SystemMonitor::Get(); 37 base::PowerMonitor::GetInstance()->AddObserver(this);
38 if (system_monitor)
39 base::SystemMonitor::Get()->AddPowerObserver(this);
40 } 38 }
41 39
42 void URLRequestJob::SetUpload(UploadData* upload) { 40 void URLRequestJob::SetUpload(UploadData* upload) {
43 } 41 }
44 42
45 void URLRequestJob::SetExtraRequestHeaders(const HttpRequestHeaders& headers) { 43 void URLRequestJob::SetExtraRequestHeaders(const HttpRequestHeaders& headers) {
46 } 44 }
47 45
48 void URLRequestJob::Kill() { 46 void URLRequestJob::Kill() {
49 weak_factory_.InvalidateWeakPtrs(); 47 weak_factory_.InvalidateWeakPtrs();
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 211 }
214 212
215 void URLRequestJob::OnSuspend() { 213 void URLRequestJob::OnSuspend() {
216 Kill(); 214 Kill();
217 } 215 }
218 216
219 void URLRequestJob::NotifyURLRequestDestroyed() { 217 void URLRequestJob::NotifyURLRequestDestroyed() {
220 } 218 }
221 219
222 URLRequestJob::~URLRequestJob() { 220 URLRequestJob::~URLRequestJob() {
223 base::SystemMonitor* system_monitor = base::SystemMonitor::Get(); 221 base::PowerMonitor::GetInstance()->RemoveObserver(this);
224 if (system_monitor)
225 base::SystemMonitor::Get()->RemovePowerObserver(this);
226 } 222 }
227 223
228 void URLRequestJob::NotifyCertificateRequested( 224 void URLRequestJob::NotifyCertificateRequested(
229 SSLCertRequestInfo* cert_request_info) { 225 SSLCertRequestInfo* cert_request_info) {
230 if (!request_) 226 if (!request_)
231 return; // The request was destroyed, so there is no more work to do. 227 return; // The request was destroyed, so there is no more work to do.
232 228
233 request_->NotifyCertificateRequested(cert_request_info); 229 request_->NotifyCertificateRequested(cert_request_info);
234 } 230 }
235 231
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 } 695 }
700 696
701 bool URLRequestJob::FilterHasData() { 697 bool URLRequestJob::FilterHasData() {
702 return filter_.get() && filter_->stream_data_len(); 698 return filter_.get() && filter_->stream_data_len();
703 } 699 }
704 700
705 void URLRequestJob::UpdatePacketReadTimes() { 701 void URLRequestJob::UpdatePacketReadTimes() {
706 } 702 }
707 703
708 } // namespace net 704 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698