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

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

Issue 1372213003: Revert of Small fix for URLRequestJobs when entering suspending mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | net/url_request/url_request_unittest.cc » ('j') | 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/location.h" 9 #include "base/location.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 int URLRequestJob::GetResponseCode() const { 273 int URLRequestJob::GetResponseCode() const {
274 return -1; 274 return -1;
275 } 275 }
276 276
277 HostPortPair URLRequestJob::GetSocketAddress() const { 277 HostPortPair URLRequestJob::GetSocketAddress() const {
278 return HostPortPair(); 278 return HostPortPair();
279 } 279 }
280 280
281 void URLRequestJob::OnSuspend() { 281 void URLRequestJob::OnSuspend() {
282 // Most errors generated by the Job come as the result of the one current 282 Kill();
283 // operation the job is waiting on returning an error. This event is unusual
284 // in that the Job may have another operation ongoing, or the Job may be idle
285 // and waiting on the next call.
286 //
287 // Need to cancel through the request to make sure everything is notified
288 // of the failure (Particularly that the NetworkDelegate, which the Job may be
289 // waiting on, is notified synchronously) and torn down correctly.
290 //
291 // TODO(mmenke): This should probably fail the request with
292 // NETWORK_IO_SUSPENDED instead.
293 request_->Cancel();
294 } 283 }
295 284
296 void URLRequestJob::NotifyURLRequestDestroyed() { 285 void URLRequestJob::NotifyURLRequestDestroyed() {
297 } 286 }
298 287
299 void URLRequestJob::GetConnectionAttempts(ConnectionAttempts* out) const { 288 void URLRequestJob::GetConnectionAttempts(ConnectionAttempts* out) const {
300 out->clear(); 289 out->clear();
301 } 290 }
302 291
303 // static 292 // static
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 int64_t total_received_bytes = GetTotalReceivedBytes(); 940 int64_t total_received_bytes = GetTotalReceivedBytes();
952 DCHECK_GE(total_received_bytes, last_notified_total_received_bytes_); 941 DCHECK_GE(total_received_bytes, last_notified_total_received_bytes_);
953 if (total_received_bytes > last_notified_total_received_bytes_) { 942 if (total_received_bytes > last_notified_total_received_bytes_) {
954 network_delegate_->NotifyNetworkBytesReceived( 943 network_delegate_->NotifyNetworkBytesReceived(
955 *request_, total_received_bytes - last_notified_total_received_bytes_); 944 *request_, total_received_bytes - last_notified_total_received_bytes_);
956 } 945 }
957 last_notified_total_received_bytes_ = total_received_bytes; 946 last_notified_total_received_bytes_ = total_received_bytes;
958 } 947 }
959 948
960 } // namespace net 949 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698