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

Side by Side Diff: content/browser/appcache/appcache_url_loader_job.cc

Issue 2991443002: The Appcache subresource URL factory needs to inform the URLLoaderClient if there is a failure. (Closed)
Patch Set: Disable the test for Android Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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/browser/appcache/appcache_url_loader_job.h" 5 #include "content/browser/appcache/appcache_url_loader_job.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "content/browser/appcache/appcache_histograms.h" 8 #include "content/browser/appcache/appcache_histograms.h"
9 #include "content/browser/appcache/appcache_subresource_url_factory.h" 9 #include "content/browser/appcache/appcache_subresource_url_factory.h"
10 #include "content/browser/appcache/appcache_url_loader_request.h" 10 #include "content/browser/appcache/appcache_url_loader_request.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 DCHECK(false); 422 DCHECK(false);
423 NotifyCompleted(net::ERR_FAILED); 423 NotifyCompleted(net::ERR_FAILED);
424 } 424 }
425 ReadMore(); 425 ReadMore();
426 } 426 }
427 427
428 void AppCacheURLLoaderJob::NotifyCompleted(int error_code) { 428 void AppCacheURLLoaderJob::NotifyCompleted(int error_code) {
429 if (storage_.get()) 429 if (storage_.get())
430 storage_->CancelDelegateCallbacks(this); 430 storage_->CancelDelegateCallbacks(this);
431 431
432 const net::HttpResponseInfo* http_info = is_range_request() 432 const net::HttpResponseInfo* http_info =
433 ? range_response_info_.get() 433 is_range_request() ? range_response_info_.get()
434 : info_->http_response_info(); 434 : (info_ ? info_->http_response_info() : nullptr);
435 435
436 ResourceRequestCompletionStatus request_complete_data; 436 ResourceRequestCompletionStatus request_complete_data;
437 request_complete_data.error_code = error_code; 437 request_complete_data.error_code = error_code;
438 438
439 // TODO(ananta) 439 // TODO(ananta)
440 // Fill other details in the ResourceRequestCompletionStatus structure in 440 // Fill other details in the ResourceRequestCompletionStatus structure in
441 // case of an error. 441 // case of an error.
442 if (!request_complete_data.error_code) { 442 if (!request_complete_data.error_code) {
443 request_complete_data.exists_in_cache = http_info->was_cached; 443 request_complete_data.exists_in_cache = http_info->was_cached;
444 request_complete_data.completion_time = base::TimeTicks::Now(); 444 request_complete_data.completion_time = base::TimeTicks::Now();
445 request_complete_data.encoded_body_length = 445 request_complete_data.encoded_body_length =
446 is_range_request() ? range_response_info_->headers->GetContentLength() 446 is_range_request() ? range_response_info_->headers->GetContentLength()
447 : info_->response_data_size(); 447 : (info_ ? info_->response_data_size() : 0);
448 request_complete_data.decoded_body_length = 448 request_complete_data.decoded_body_length =
449 request_complete_data.encoded_body_length; 449 request_complete_data.encoded_body_length;
450 } 450 }
451 client_->OnComplete(request_complete_data); 451 client_->OnComplete(request_complete_data);
452 } 452 }
453 453
454 void AppCacheURLLoaderJob::DisconnectFromNetworkLoader() { 454 void AppCacheURLLoaderJob::DisconnectFromNetworkLoader() {
455 // Close the pipe to the network loader as we are delivering a fallback 455 // Close the pipe to the network loader as we are delivering a fallback
456 // response to the client. 456 // response to the client.
457 network_loader_client_binding_.Close(); 457 network_loader_client_binding_.Close();
458 network_loader_ = nullptr; 458 network_loader_ = nullptr;
459 } 459 }
460 460
461 } // namespace content 461 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_subresource_url_factory.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698