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

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

Issue 2519843002: Update ResourceResponse::encodedDataLength when response is completed (Closed)
Patch Set: Update ResourceResponse::encodedDataLength when response is completed Created 4 years, 1 month 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 | content/child/web_url_loader_impl_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 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 if (body_stream_writer_ && error_code != net::OK) 848 if (body_stream_writer_ && error_code != net::OK)
849 body_stream_writer_->Fail(); 849 body_stream_writer_->Fail();
850 body_stream_writer_.reset(); 850 body_stream_writer_.reset();
851 851
852 if (client_) { 852 if (client_) {
853 TRACE_EVENT_WITH_FLOW0( 853 TRACE_EVENT_WITH_FLOW0(
854 "loading", "WebURLLoaderImpl::Context::OnCompletedRequest", 854 "loading", "WebURLLoaderImpl::Context::OnCompletedRequest",
855 this, TRACE_EVENT_FLAG_FLOW_IN); 855 this, TRACE_EVENT_FLAG_FLOW_IN);
856 856
857 if (error_code != net::OK) { 857 if (error_code != net::OK) {
858 client_->didFail( 858 client_->didFail(loader_,
859 loader_, 859 CreateWebURLError(request_.url(), stale_copy_in_cache,
860 CreateWebURLError(request_.url(), stale_copy_in_cache, error_code, 860 error_code, was_ignored_by_handler),
861 was_ignored_by_handler)); 861 total_transfer_size);
862 } else { 862 } else {
863 client_->didFinishLoading(loader_, 863 client_->didFinishLoading(loader_,
864 (completion_time - TimeTicks()).InSecondsF(), 864 (completion_time - TimeTicks()).InSecondsF(),
865 total_transfer_size); 865 total_transfer_size);
866 } 866 }
867 } 867 }
868 } 868 }
869 869
870 WebURLLoaderImpl::Context::~Context() { 870 WebURLLoaderImpl::Context::~Context() {
871 // We must be already cancelled at this point. 871 // We must be already cancelled at this point.
872 DCHECK_LT(request_id_, 0); 872 DCHECK_LT(request_id_, 0);
873 } 873 }
874 874
875 void WebURLLoaderImpl::Context::CancelBodyStreaming() { 875 void WebURLLoaderImpl::Context::CancelBodyStreaming() {
876 scoped_refptr<Context> protect(this); 876 scoped_refptr<Context> protect(this);
877 877
878 // Notify renderer clients that the request is canceled. 878 // Notify renderer clients that the request is canceled.
879 if (ftp_listing_delegate_) { 879 if (ftp_listing_delegate_) {
880 ftp_listing_delegate_->OnCompletedRequest(); 880 ftp_listing_delegate_->OnCompletedRequest();
881 ftp_listing_delegate_.reset(NULL); 881 ftp_listing_delegate_.reset(NULL);
882 } 882 }
883 883
884 if (body_stream_writer_) { 884 if (body_stream_writer_) {
885 body_stream_writer_->Fail(); 885 body_stream_writer_->Fail();
886 body_stream_writer_.reset(); 886 body_stream_writer_.reset();
887 } 887 }
888 if (client_) { 888 if (client_) {
889 // TODO(yhirano): Set |stale_copy_in_cache| appropriately if possible. 889 // TODO(yhirano): Set |stale_copy_in_cache| appropriately if possible.
890 client_->didFail( 890 client_->didFail(loader_,
891 loader_, CreateWebURLError(request_.url(), false, net::ERR_ABORTED)); 891 CreateWebURLError(request_.url(), false, net::ERR_ABORTED),
892 WebURLLoaderClient::kUnknownEncodedDataLength);
892 } 893 }
893 894
894 // Notify the browser process that the request is canceled. 895 // Notify the browser process that the request is canceled.
895 Cancel(); 896 Cancel();
896 } 897 }
897 898
898 bool WebURLLoaderImpl::Context::CanHandleDataURLRequestLocally() const { 899 bool WebURLLoaderImpl::Context::CanHandleDataURLRequestLocally() const {
899 GURL url = request_.url(); 900 GURL url = request_.url();
900 if (!url.SchemeIs(url::kDataScheme)) 901 if (!url.SchemeIs(url::kDataScheme))
901 return false; 902 return false;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 int intra_priority_value) { 1250 int intra_priority_value) {
1250 context_->DidChangePriority(new_priority, intra_priority_value); 1251 context_->DidChangePriority(new_priority, intra_priority_value);
1251 } 1252 }
1252 1253
1253 void WebURLLoaderImpl::setLoadingTaskRunner( 1254 void WebURLLoaderImpl::setLoadingTaskRunner(
1254 base::SingleThreadTaskRunner* loading_task_runner) { 1255 base::SingleThreadTaskRunner* loading_task_runner) {
1255 context_->SetTaskRunner(loading_task_runner); 1256 context_->SetTaskRunner(loading_task_runner);
1256 } 1257 }
1257 1258
1258 } // namespace content 1259 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/child/web_url_loader_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698