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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2501343003: PlzNavigate: AppCache support. (Closed)
Patch Set: Address review comments Created 4 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 16 matching lines...) Expand all
27 #include "base/message_loop/message_loop.h" 27 #include "base/message_loop/message_loop.h"
28 #include "base/metrics/field_trial.h" 28 #include "base/metrics/field_trial.h"
29 #include "base/metrics/histogram_macros.h" 29 #include "base/metrics/histogram_macros.h"
30 #include "base/metrics/sparse_histogram.h" 30 #include "base/metrics/sparse_histogram.h"
31 #include "base/profiler/scoped_tracker.h" 31 #include "base/profiler/scoped_tracker.h"
32 #include "base/stl_util.h" 32 #include "base/stl_util.h"
33 #include "base/strings/string_util.h" 33 #include "base/strings/string_util.h"
34 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 34 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
35 #include "base/timer/timer.h" 35 #include "base/timer/timer.h"
36 #include "content/browser/appcache/appcache_interceptor.h" 36 #include "content/browser/appcache/appcache_interceptor.h"
37 #include "content/browser/appcache/appcache_navigation_handle_core.h"
37 #include "content/browser/appcache/chrome_appcache_service.h" 38 #include "content/browser/appcache/chrome_appcache_service.h"
38 #include "content/browser/bad_message.h" 39 #include "content/browser/bad_message.h"
39 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 40 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
40 #include "content/browser/child_process_security_policy_impl.h" 41 #include "content/browser/child_process_security_policy_impl.h"
41 #include "content/browser/frame_host/frame_tree.h" 42 #include "content/browser/frame_host/frame_tree.h"
42 #include "content/browser/frame_host/navigation_handle_impl.h" 43 #include "content/browser/frame_host/navigation_handle_impl.h"
43 #include "content/browser/frame_host/navigation_request_info.h" 44 #include "content/browser/frame_host/navigation_request_info.h"
44 #include "content/browser/frame_host/navigator.h" 45 #include "content/browser/frame_host/navigator.h"
45 #include "content/browser/loader/async_resource_handler.h" 46 #include "content/browser/loader/async_resource_handler.h"
46 #include "content/browser/loader/async_revalidation_manager.h" 47 #include "content/browser/loader/async_revalidation_manager.h"
(...skipping 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 net::URLRequest* request) { 2085 net::URLRequest* request) {
2085 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); 2086 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
2086 IncrementOutstandingRequestsCount(-1, info); 2087 IncrementOutstandingRequestsCount(-1, info);
2087 } 2088 }
2088 2089
2089 void ResourceDispatcherHostImpl::BeginNavigationRequest( 2090 void ResourceDispatcherHostImpl::BeginNavigationRequest(
2090 ResourceContext* resource_context, 2091 ResourceContext* resource_context,
2091 const NavigationRequestInfo& info, 2092 const NavigationRequestInfo& info,
2092 std::unique_ptr<NavigationUIData> navigation_ui_data, 2093 std::unique_ptr<NavigationUIData> navigation_ui_data,
2093 NavigationURLLoaderImplCore* loader, 2094 NavigationURLLoaderImplCore* loader,
2094 ServiceWorkerNavigationHandleCore* service_worker_handle_core) { 2095 ServiceWorkerNavigationHandleCore* service_worker_handle_core,
2096 AppCacheNavigationHandleCore* appcache_handle_core) {
2095 // PlzNavigate: BeginNavigationRequest currently should only be used for the 2097 // PlzNavigate: BeginNavigationRequest currently should only be used for the
2096 // browser-side navigations project. 2098 // browser-side navigations project.
2097 CHECK(IsBrowserSideNavigationEnabled()); 2099 CHECK(IsBrowserSideNavigationEnabled());
2098 2100
2099 ResourceType resource_type = info.is_main_frame ? 2101 ResourceType resource_type = info.is_main_frame ?
2100 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; 2102 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME;
2101 2103
2102 // Do not allow browser plugin guests to navigate to non-web URLs, since they 2104 // Do not allow browser plugin guests to navigate to non-web URLs, since they
2103 // cannot swap processes or grant bindings. Do not check external protocols 2105 // cannot swap processes or grant bindings. Do not check external protocols
2104 // here because they're checked in 2106 // here because they're checked in
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 2245
2244 RequestContextFrameType frame_type = 2246 RequestContextFrameType frame_type =
2245 info.is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL 2247 info.is_main_frame ? REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL
2246 : REQUEST_CONTEXT_FRAME_TYPE_NESTED; 2248 : REQUEST_CONTEXT_FRAME_TYPE_NESTED;
2247 ServiceWorkerRequestHandler::InitializeForNavigation( 2249 ServiceWorkerRequestHandler::InitializeForNavigation(
2248 new_request.get(), service_worker_handle_core, blob_context, 2250 new_request.get(), service_worker_handle_core, blob_context,
2249 info.begin_params.skip_service_worker, resource_type, 2251 info.begin_params.skip_service_worker, resource_type,
2250 info.begin_params.request_context_type, frame_type, 2252 info.begin_params.request_context_type, frame_type,
2251 info.are_ancestors_secure, info.common_params.post_data); 2253 info.are_ancestors_secure, info.common_params.post_data);
2252 2254
2253 // TODO(davidben): Attach AppCacheInterceptor. 2255 // Have the appcache associate its extra info with the request.
2256 if (appcache_handle_core) {
2257 AppCacheInterceptor::SetExtraRequestInfoForHost(
2258 new_request.get(), appcache_handle_core->host(), resource_type, false);
2259 }
2254 2260
2255 std::unique_ptr<ResourceHandler> handler( 2261 std::unique_ptr<ResourceHandler> handler(
2256 new NavigationResourceHandler(new_request.get(), loader, delegate())); 2262 new NavigationResourceHandler(new_request.get(), loader, delegate()));
2257 2263
2258 // TODO(davidben): Pass in the appropriate appcache_service. Also fix the 2264 // TODO(davidben): Fix the dependency on child_id/route_id. Those are used
2259 // dependency on child_id/route_id. Those are used by the ResourceScheduler; 2265 // by the ResourceScheduler. currently it's a no-op.
2260 // currently it's a no-op. 2266 handler = AddStandardHandlers(
2261 handler = 2267 new_request.get(),
2262 AddStandardHandlers(new_request.get(), resource_type, resource_context, 2268 resource_type,
2263 info.begin_params.request_context_type, 2269 resource_context,
2264 nullptr, // appcache_service 2270 info.begin_params.request_context_type,
2265 -1, // child_id 2271 appcache_handle_core ?
2266 -1, // route_id 2272 appcache_handle_core->GetAppCacheService() : nullptr,
2267 std::move(handler)); 2273 -1, // child_id
2274 -1, // route_id
2275 std::move(handler));
2268 2276
2269 BeginRequestInternal(std::move(new_request), std::move(handler)); 2277 BeginRequestInternal(std::move(new_request), std::move(handler));
2270 } 2278 }
2271 2279
2272 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { 2280 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() {
2273 if (!async_revalidation_manager_) 2281 if (!async_revalidation_manager_)
2274 async_revalidation_manager_.reset(new AsyncRevalidationManager); 2282 async_revalidation_manager_.reset(new AsyncRevalidationManager);
2275 } 2283 }
2276 2284
2277 void ResourceDispatcherHostImpl::SetLoaderDelegate( 2285 void ResourceDispatcherHostImpl::SetLoaderDelegate(
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 &throttles); 2808 &throttles);
2801 if (!throttles.empty()) { 2809 if (!throttles.empty()) {
2802 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2810 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2803 std::move(throttles))); 2811 std::move(throttles)));
2804 } 2812 }
2805 } 2813 }
2806 return handler; 2814 return handler;
2807 } 2815 }
2808 2816
2809 } // namespace content 2817 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698