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

Side by Side Diff: content/browser/appcache/appcache_subresource_url_factory.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 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_subresource_url_factory.h" 5 #include "content/browser/appcache/appcache_subresource_url_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/browser/appcache/appcache_host.h" 9 #include "content/browser/appcache/appcache_host.h"
10 #include "content/browser/appcache/appcache_request_handler.h" 10 #include "content/browser/appcache/appcache_request_handler.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 int32_t request_id, 56 int32_t request_id,
57 uint32_t options, 57 uint32_t options,
58 const ResourceRequest& request, 58 const ResourceRequest& request,
59 mojom::URLLoaderClientPtr client, 59 mojom::URLLoaderClientPtr client,
60 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { 60 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
61 DCHECK_CURRENTLY_ON(BrowserThread::IO); 61 DCHECK_CURRENTLY_ON(BrowserThread::IO);
62 DLOG(WARNING) << "Received request for loading : " << request.url.spec(); 62 DLOG(WARNING) << "Received request for loading : " << request.url.spec();
63 63
64 // If the host is invalid, it means that the renderer has probably died. 64 // If the host is invalid, it means that the renderer has probably died.
65 // (Frame has navigated elsewhere?) 65 // (Frame has navigated elsewhere?)
66 if (!appcache_host_.get()) 66 if (!appcache_host_.get()) {
67 NotifyError(std::move(client), net::ERR_FAILED);
67 return; 68 return;
69 }
68 70
69 std::unique_ptr<AppCacheRequestHandler> handler = 71 std::unique_ptr<AppCacheRequestHandler> handler =
70 appcache_host_->CreateRequestHandler( 72 appcache_host_->CreateRequestHandler(
71 AppCacheURLLoaderRequest::Create(request), request.resource_type, 73 AppCacheURLLoaderRequest::Create(request), request.resource_type,
72 request.should_reset_appcache); 74 request.should_reset_appcache);
73 if (!handler) { 75 if (!handler) {
74 ResourceRequestCompletionStatus request_result; 76 NotifyError(std::move(client), net::ERR_FAILED);
75 request_result.error_code = net::ERR_FAILED;
76 client->OnComplete(request_result);
77 return; 77 return;
78 } 78 }
79 79
80 handler->set_network_url_loader_factory_getter( 80 handler->set_network_url_loader_factory_getter(
81 default_url_loader_factory_getter_.get()); 81 default_url_loader_factory_getter_.get());
82 82
83 std::unique_ptr<SubresourceLoadInfo> load_info(new SubresourceLoadInfo()); 83 std::unique_ptr<SubresourceLoadInfo> load_info(new SubresourceLoadInfo());
84 load_info->url_loader_request = std::move(url_loader_request); 84 load_info->url_loader_request = std::move(url_loader_request);
85 load_info->routing_id = routing_id; 85 load_info->routing_id = routing_id;
86 load_info->request_id = request_id; 86 load_info->request_id = request_id;
(...skipping 15 matching lines...) Expand all
102 int32_t request_id, 102 int32_t request_id,
103 const ResourceRequest& request, 103 const ResourceRequest& request,
104 SyncLoadCallback callback) { 104 SyncLoadCallback callback) {
105 NOTREACHED(); 105 NOTREACHED();
106 } 106 }
107 107
108 void AppCacheSubresourceURLFactory::OnConnectionError() { 108 void AppCacheSubresourceURLFactory::OnConnectionError() {
109 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 109 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
110 } 110 }
111 111
112 void AppCacheSubresourceURLFactory::NotifyError(
113 mojom::URLLoaderClientPtr client,
114 int error_code) {
115 ResourceRequestCompletionStatus request_result;
116 request_result.error_code = error_code;
117 client->OnComplete(request_result);
118 }
119
112 } // namespace content 120 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_subresource_url_factory.h ('k') | content/browser/appcache/appcache_url_loader_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698