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

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

Issue 179923006: Attempting to resolve a race condition with PowerMonitor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win64 fixes 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* 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 return HostPortPair(); 237 return HostPortPair();
240 } 238 }
241 239
242 void URLRequestJob::OnSuspend() { 240 void URLRequestJob::OnSuspend() {
243 Kill(); 241 Kill();
244 } 242 }
245 243
246 void URLRequestJob::NotifyURLRequestDestroyed() { 244 void URLRequestJob::NotifyURLRequestDestroyed() {
247 } 245 }
248 246
249 URLRequestJob::~URLRequestJob() { 247 URLRequestJob::~URLRequestJob() { base::PowerMonitor::RemoveObserver(this); }
250 base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
251 if (power_monitor)
252 power_monitor->RemoveObserver(this);
253 }
254 248
255 void URLRequestJob::NotifyCertificateRequested( 249 void URLRequestJob::NotifyCertificateRequested(
256 SSLCertRequestInfo* cert_request_info) { 250 SSLCertRequestInfo* cert_request_info) {
257 if (!request_) 251 if (!request_)
258 return; // The request was destroyed, so there is no more work to do. 252 return; // The request was destroyed, so there is no more work to do.
259 253
260 request_->NotifyCertificateRequested(cert_request_info); 254 request_->NotifyCertificateRequested(cert_request_info);
261 } 255 }
262 256
263 void URLRequestJob::NotifySSLCertificateError(const SSLInfo& ssl_info, 257 void URLRequestJob::NotifySSLCertificateError(const SSLInfo& ssl_info,
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 } 761 }
768 762
769 bool URLRequestJob::FilterHasData() { 763 bool URLRequestJob::FilterHasData() {
770 return filter_.get() && filter_->stream_data_len(); 764 return filter_.get() && filter_->stream_data_len();
771 } 765 }
772 766
773 void URLRequestJob::UpdatePacketReadTimes() { 767 void URLRequestJob::UpdatePacketReadTimes() {
774 } 768 }
775 769
776 } // namespace net 770 } // 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