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

Side by Side Diff: content/browser/appcache/appcache_request_handler.h

Issue 2956373002: Add support for subresource request loads in AppCache for the network service. (Closed)
Patch Set: Address review comments 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 14 matching lines...) Expand all
25 class NetworkDelegate; 25 class NetworkDelegate;
26 class URLRequest; 26 class URLRequest;
27 } // namespace net 27 } // namespace net
28 28
29 namespace content { 29 namespace content {
30 class AppCacheJob; 30 class AppCacheJob;
31 class AppCacheNavigationHandleCore; 31 class AppCacheNavigationHandleCore;
32 class AppCacheRequest; 32 class AppCacheRequest;
33 class AppCacheRequestHandlerTest; 33 class AppCacheRequestHandlerTest;
34 class AppCacheURLRequestJob; 34 class AppCacheURLRequestJob;
35 struct ResourceRequest; 35 class AppCacheHost;
36 struct SubresourceLoadInfo;
36 37
37 // An instance is created for each net::URLRequest. The instance survives all 38 // An instance is created for each net::URLRequest. The instance survives all
38 // http transactions involved in the processing of its net::URLRequest, and is 39 // http transactions involved in the processing of its net::URLRequest, and is
39 // given the opportunity to hijack the request along the way. Callers 40 // given the opportunity to hijack the request along the way. Callers
40 // should use AppCacheHost::CreateRequestHandler to manufacture instances 41 // should use AppCacheHost::CreateRequestHandler to manufacture instances
41 // that can retrieve resources for a particular host. 42 // that can retrieve resources for a particular host.
42 class CONTENT_EXPORT AppCacheRequestHandler 43 class CONTENT_EXPORT AppCacheRequestHandler
43 : public base::SupportsUserData::Data, 44 : public base::SupportsUserData::Data,
44 public AppCacheHost::Observer, 45 public AppCacheHost::Observer,
45 public AppCacheServiceImpl::Observer, 46 public AppCacheServiceImpl::Observer,
(...skipping 27 matching lines...) Expand all
73 return IsResourceTypeFrame(type) || 74 return IsResourceTypeFrame(type) ||
74 type == RESOURCE_TYPE_SHARED_WORKER; 75 type == RESOURCE_TYPE_SHARED_WORKER;
75 } 76 }
76 77
77 static std::unique_ptr<AppCacheRequestHandler> 78 static std::unique_ptr<AppCacheRequestHandler>
78 InitializeForNavigationNetworkService( 79 InitializeForNavigationNetworkService(
79 const ResourceRequest& request, 80 const ResourceRequest& request,
80 AppCacheNavigationHandleCore* appcache_handle_core, 81 AppCacheNavigationHandleCore* appcache_handle_core,
81 URLLoaderFactoryGetter* url_loader_factory_getter); 82 URLLoaderFactoryGetter* url_loader_factory_getter);
82 83
84 // The following setters only apply for the network service code.
85 void set_network_url_loader_factory_getter(
86 URLLoaderFactoryGetter* url_loader_factory_getter) {
87 network_url_loader_factory_getter_ = url_loader_factory_getter;
88 }
89
90 void SetSubresourceRequestLoadInfo(
91 std::unique_ptr<SubresourceLoadInfo> subresource_load_info);
92
83 private: 93 private:
84 friend class AppCacheHost; 94 friend class AppCacheHost;
85 95
86 // Callers should use AppCacheHost::CreateRequestHandler. 96 // Callers should use AppCacheHost::CreateRequestHandler.
87 AppCacheRequestHandler(AppCacheHost* host, 97 AppCacheRequestHandler(AppCacheHost* host,
88 ResourceType resource_type, 98 ResourceType resource_type,
89 bool should_reset_appcache, 99 bool should_reset_appcache,
90 std::unique_ptr<AppCacheRequest> request); 100 std::unique_ptr<AppCacheRequest> request);
91 101
92 // AppCacheHost::Observer override 102 // AppCacheHost::Observer override
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 155
146 // AppCacheHost::Observer override 156 // AppCacheHost::Observer override
147 void OnCacheSelectionComplete(AppCacheHost* host) override; 157 void OnCacheSelectionComplete(AppCacheHost* host) override;
148 158
149 // URLLoaderRequestHandler override 159 // URLLoaderRequestHandler override
150 void MaybeCreateLoader(const ResourceRequest& resource_request, 160 void MaybeCreateLoader(const ResourceRequest& resource_request,
151 ResourceContext* resource_context, 161 ResourceContext* resource_context,
152 LoaderCallback callback) override; 162 LoaderCallback callback) override;
153 mojom::URLLoaderFactoryPtr MaybeCreateSubresourceFactory() override; 163 mojom::URLLoaderFactoryPtr MaybeCreateSubresourceFactory() override;
154 164
155 void set_network_url_loader_factory_getter(
156 URLLoaderFactoryGetter* url_loader_factory_getter) {
157 network_url_loader_factory_getter_ = url_loader_factory_getter;
158 }
159
160 // Data members ----------------------------------------------- 165 // Data members -----------------------------------------------
161 166
162 // What host we're servicing a request for. 167 // What host we're servicing a request for.
163 AppCacheHost* host_; 168 AppCacheHost* host_;
164 169
165 // Frame vs subresource vs sharedworker loads are somewhat different. 170 // Frame vs subresource vs sharedworker loads are somewhat different.
166 ResourceType resource_type_; 171 ResourceType resource_type_;
167 172
168 // True if corresponding AppCache group should be resetted before load. 173 // True if corresponding AppCache group should be resetted before load.
169 bool should_reset_appcache_; 174 bool should_reset_appcache_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // Cached information about the response being currently served by the 215 // Cached information about the response being currently served by the
211 // AppCache, if there is one. 216 // AppCache, if there is one.
212 int cache_id_; 217 int cache_id_;
213 GURL manifest_url_; 218 GURL manifest_url_;
214 219
215 // Backptr to the central service object. 220 // Backptr to the central service object.
216 AppCacheServiceImpl* service_; 221 AppCacheServiceImpl* service_;
217 222
218 std::unique_ptr<AppCacheRequest> request_; 223 std::unique_ptr<AppCacheRequest> request_;
219 224
225 // Network service related members.
226
220 // In the network service world we are queried via the URLLoaderRequestHandler 227 // In the network service world we are queried via the URLLoaderRequestHandler
221 // interface to see if the navigation request can be handled via the 228 // interface to see if the navigation request can be handled via the
222 // AppCache. We hold onto the AppCache job created here until the client 229 // AppCache. We hold onto the AppCache job created here until the client
223 // binds to it (Serviced via AppCache). If the request cannot be handled via 230 // binds to it (Serviced via AppCache). If the request cannot be handled via
224 // the AppCache, we delete the job. 231 // the AppCache, we delete the job.
225 std::unique_ptr<AppCacheJob> navigation_request_job_; 232 std::unique_ptr<AppCacheJob> navigation_request_job_;
226 233
227 // In the network service world, points to the getter for the network URL 234 // In the network service world, points to the getter for the network URL
228 // loader. 235 // loader.
229 scoped_refptr<URLLoaderFactoryGetter> network_url_loader_factory_getter_; 236 scoped_refptr<URLLoaderFactoryGetter> network_url_loader_factory_getter_;
230 237
231 friend class content::AppCacheRequestHandlerTest; 238 friend class content::AppCacheRequestHandlerTest;
232 239
240 // Subresource load information.
241 std::unique_ptr<SubresourceLoadInfo> subresource_load_info_;
242
243 // The AppCache host instance. We pass this to the
244 // AppCacheSubresourceURLFactory instance on creation.
245 base::WeakPtr<AppCacheHost> appcache_host_;
246
233 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); 247 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler);
234 }; 248 };
235 249
236 } // namespace content 250 } // namespace content
237 251
238 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ 252 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_host.cc ('k') | content/browser/appcache/appcache_request_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698