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

Side by Side Diff: content/child/web_url_loader_impl.cc

Issue 2823173003: Improve error handling in FtpDirectoryListingResponseDelegate. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « content/child/ftp_directory_listing_response_delegate.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 const base::TimeTicks& completion_time, 863 const base::TimeTicks& completion_time,
864 int64_t total_transfer_size, 864 int64_t total_transfer_size,
865 int64_t encoded_body_size) { 865 int64_t encoded_body_size) {
866 if (stream_override_ && stream_override_->stream_url.is_empty()) { 866 if (stream_override_ && stream_override_->stream_url.is_empty()) {
867 // TODO(kinuko|scottmg|jam): This is wrong. https://crbug.com/705744. 867 // TODO(kinuko|scottmg|jam): This is wrong. https://crbug.com/705744.
868 total_transfer_size = stream_override_->total_transferred; 868 total_transfer_size = stream_override_->total_transferred;
869 encoded_body_size = stream_override_->total_transferred; 869 encoded_body_size = stream_override_->total_transferred;
870 } 870 }
871 871
872 if (ftp_listing_delegate_) { 872 if (ftp_listing_delegate_) {
873 ftp_listing_delegate_->OnCompletedRequest(); 873 ftp_listing_delegate_->OnCompletedRequest(error_code);
874 ftp_listing_delegate_.reset(NULL); 874 ftp_listing_delegate_.reset();
875 } 875 }
876 876
877 if (body_stream_writer_ && error_code != net::OK) 877 if (body_stream_writer_ && error_code != net::OK)
878 body_stream_writer_->Fail(); 878 body_stream_writer_->Fail();
879 body_stream_writer_.reset(); 879 body_stream_writer_.reset();
880 880
881 if (client_) { 881 if (client_) {
882 TRACE_EVENT_WITH_FLOW0( 882 TRACE_EVENT_WITH_FLOW0(
883 "loading", "WebURLLoaderImpl::Context::OnCompletedRequest", 883 "loading", "WebURLLoaderImpl::Context::OnCompletedRequest",
884 this, TRACE_EVENT_FLAG_FLOW_IN); 884 this, TRACE_EVENT_FLAG_FLOW_IN);
(...skipping 18 matching lines...) Expand all
903 WebURLLoaderImpl::Context::~Context() { 903 WebURLLoaderImpl::Context::~Context() {
904 // We must be already cancelled at this point. 904 // We must be already cancelled at this point.
905 DCHECK_LT(request_id_, 0); 905 DCHECK_LT(request_id_, 0);
906 } 906 }
907 907
908 void WebURLLoaderImpl::Context::CancelBodyStreaming() { 908 void WebURLLoaderImpl::Context::CancelBodyStreaming() {
909 scoped_refptr<Context> protect(this); 909 scoped_refptr<Context> protect(this);
910 910
911 // Notify renderer clients that the request is canceled. 911 // Notify renderer clients that the request is canceled.
912 if (ftp_listing_delegate_) { 912 if (ftp_listing_delegate_) {
913 ftp_listing_delegate_->OnCompletedRequest(); 913 ftp_listing_delegate_->OnCompletedRequest(net::OK);
914 ftp_listing_delegate_.reset(NULL); 914 ftp_listing_delegate_.reset();
915 } 915 }
916 916
917 if (body_stream_writer_) { 917 if (body_stream_writer_) {
918 body_stream_writer_->Fail(); 918 body_stream_writer_->Fail();
919 body_stream_writer_.reset(); 919 body_stream_writer_.reset();
920 } 920 }
921 if (client_) { 921 if (client_) {
922 // TODO(yhirano): Set |stale_copy_in_cache| appropriately if possible. 922 // TODO(yhirano): Set |stale_copy_in_cache| appropriately if possible.
923 client_->DidFail(CreateWebURLError(request_.Url(), false, net::ERR_ABORTED), 923 client_->DidFail(CreateWebURLError(request_.Url(), false, net::ERR_ABORTED),
924 WebURLLoaderClient::kUnknownEncodedDataLength, 0); 924 WebURLLoaderClient::kUnknownEncodedDataLength, 0);
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 int intra_priority_value) { 1276 int intra_priority_value) {
1277 context_->DidChangePriority(new_priority, intra_priority_value); 1277 context_->DidChangePriority(new_priority, intra_priority_value);
1278 } 1278 }
1279 1279
1280 void WebURLLoaderImpl::SetLoadingTaskRunner( 1280 void WebURLLoaderImpl::SetLoadingTaskRunner(
1281 base::SingleThreadTaskRunner* loading_task_runner) { 1281 base::SingleThreadTaskRunner* loading_task_runner) {
1282 context_->SetTaskRunner(loading_task_runner); 1282 context_->SetTaskRunner(loading_task_runner);
1283 } 1283 }
1284 1284
1285 } // namespace content 1285 } // namespace content
OLDNEW
« no previous file with comments | « content/child/ftp_directory_listing_response_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698