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

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

Issue 1181573003: Set error on WebDataConsumerHandle while loading body. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-ipc-data-consumer
Patch Set: Created 5 years, 6 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/shared_memory_data_consumer_handle_unittest.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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 request_id_(-1) { 355 request_id_(-1) {
356 } 356 }
357 357
358 void WebURLLoaderImpl::Context::Cancel() { 358 void WebURLLoaderImpl::Context::Cancel() {
359 if (resource_dispatcher_ && // NULL in unittest. 359 if (resource_dispatcher_ && // NULL in unittest.
360 request_id_ != -1) { 360 request_id_ != -1) {
361 resource_dispatcher_->Cancel(request_id_); 361 resource_dispatcher_->Cancel(request_id_);
362 request_id_ = -1; 362 request_id_ = -1;
363 } 363 }
364 364
365 if (body_stream_writer_)
366 body_stream_writer_->Fail();
367
365 // Ensure that we do not notify the multipart delegate anymore as it has 368 // Ensure that we do not notify the multipart delegate anymore as it has
366 // its own pointer to the client. 369 // its own pointer to the client.
367 if (multipart_delegate_) 370 if (multipart_delegate_)
368 multipart_delegate_->Cancel(); 371 multipart_delegate_->Cancel();
369 // Ditto for the ftp delegate. 372 // Ditto for the ftp delegate.
370 if (ftp_listing_delegate_) 373 if (ftp_listing_delegate_)
371 ftp_listing_delegate_->Cancel(); 374 ftp_listing_delegate_->Cancel();
372 375
373 // Do not make any further calls to the client. 376 // Do not make any further calls to the client.
374 client_ = NULL; 377 client_ = NULL;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 scoped_refptr<Context> protect(this); 724 scoped_refptr<Context> protect(this);
722 725
723 if (ftp_listing_delegate_) { 726 if (ftp_listing_delegate_) {
724 ftp_listing_delegate_->OnCompletedRequest(); 727 ftp_listing_delegate_->OnCompletedRequest();
725 ftp_listing_delegate_.reset(NULL); 728 ftp_listing_delegate_.reset(NULL);
726 } else if (multipart_delegate_) { 729 } else if (multipart_delegate_) {
727 multipart_delegate_->OnCompletedRequest(); 730 multipart_delegate_->OnCompletedRequest();
728 multipart_delegate_.reset(NULL); 731 multipart_delegate_.reset(NULL);
729 } 732 }
730 733
731 if (request_.useStreamOnResponse()) { 734 if (body_stream_writer_ && error_code != net::OK)
732 // TODO(yhirano): Notify error. 735 body_stream_writer_->Fail();
733 body_stream_writer_.reset(); 736 body_stream_writer_.reset();
734 }
735 737
736 if (client_) { 738 if (client_) {
737 if (error_code != net::OK) { 739 if (error_code != net::OK) {
738 client_->didFail( 740 client_->didFail(
739 loader_, 741 loader_,
740 CreateWebURLError(request_.url(), stale_copy_in_cache, error_code)); 742 CreateWebURLError(request_.url(), stale_copy_in_cache, error_code));
741 } else { 743 } else {
742 client_->didFinishLoading(loader_, 744 client_->didFinishLoading(loader_,
743 (completion_time - TimeTicks()).InSecondsF(), 745 (completion_time - TimeTicks()).InSecondsF(),
744 total_transfer_size); 746 total_transfer_size);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 int intra_priority_value) { 1000 int intra_priority_value) {
999 context_->DidChangePriority(new_priority, intra_priority_value); 1001 context_->DidChangePriority(new_priority, intra_priority_value);
1000 } 1002 }
1001 1003
1002 bool WebURLLoaderImpl::attachThreadedDataReceiver( 1004 bool WebURLLoaderImpl::attachThreadedDataReceiver(
1003 blink::WebThreadedDataReceiver* threaded_data_receiver) { 1005 blink::WebThreadedDataReceiver* threaded_data_receiver) {
1004 return context_->AttachThreadedDataReceiver(threaded_data_receiver); 1006 return context_->AttachThreadedDataReceiver(threaded_data_receiver);
1005 } 1007 }
1006 1008
1007 } // namespace content 1009 } // namespace content
OLDNEW
« no previous file with comments | « content/child/shared_memory_data_consumer_handle_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698