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

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

Issue 1366203004: Small fix for URLRequestJobs when entering suspending mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to comments, fix test name/description 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 Kill(); 282 // Most errors generated by the Job come as the result of the one current
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();
283 } 294 }
284 295
285 void URLRequestJob::NotifyURLRequestDestroyed() { 296 void URLRequestJob::NotifyURLRequestDestroyed() {
286 } 297 }
287 298
288 void URLRequestJob::GetConnectionAttempts(ConnectionAttempts* out) const { 299 void URLRequestJob::GetConnectionAttempts(ConnectionAttempts* out) const {
289 out->clear(); 300 out->clear();
290 } 301 }
291 302
292 // static 303 // static
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 int64_t total_received_bytes = GetTotalReceivedBytes(); 951 int64_t total_received_bytes = GetTotalReceivedBytes();
941 DCHECK_GE(total_received_bytes, last_notified_total_received_bytes_); 952 DCHECK_GE(total_received_bytes, last_notified_total_received_bytes_);
942 if (total_received_bytes > last_notified_total_received_bytes_) { 953 if (total_received_bytes > last_notified_total_received_bytes_) {
943 network_delegate_->NotifyNetworkBytesReceived( 954 network_delegate_->NotifyNetworkBytesReceived(
944 *request_, total_received_bytes - last_notified_total_received_bytes_); 955 *request_, total_received_bytes - last_notified_total_received_bytes_);
945 } 956 }
946 last_notified_total_received_bytes_ = total_received_bytes; 957 last_notified_total_received_bytes_ = total_received_bytes;
947 } 958 }
948 959
949 } // namespace net 960 } // 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