OLD | NEW |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #include "content/common/navigation_params.h" | 71 #include "content/common/navigation_params.h" |
72 #include "content/common/net/url_request_service_worker_data.h" | 72 #include "content/common/net/url_request_service_worker_data.h" |
73 #include "content/common/resource_messages.h" | 73 #include "content/common/resource_messages.h" |
74 #include "content/common/resource_request.h" | 74 #include "content/common/resource_request.h" |
75 #include "content/common/resource_request_body_impl.h" | 75 #include "content/common/resource_request_body_impl.h" |
76 #include "content/common/resource_request_completion_status.h" | 76 #include "content/common/resource_request_completion_status.h" |
77 #include "content/common/site_isolation_policy.h" | 77 #include "content/common/site_isolation_policy.h" |
78 #include "content/common/view_messages.h" | 78 #include "content/common/view_messages.h" |
79 #include "content/public/browser/browser_thread.h" | 79 #include "content/public/browser/browser_thread.h" |
80 #include "content/public/browser/global_request_id.h" | 80 #include "content/public/browser/global_request_id.h" |
| 81 #include "content/public/browser/navigation_ui_data.h" |
81 #include "content/public/browser/plugin_service.h" | 82 #include "content/public/browser/plugin_service.h" |
82 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 83 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
83 #include "content/public/browser/resource_request_details.h" | 84 #include "content/public/browser/resource_request_details.h" |
84 #include "content/public/browser/resource_throttle.h" | 85 #include "content/public/browser/resource_throttle.h" |
85 #include "content/public/browser/stream_handle.h" | 86 #include "content/public/browser/stream_handle.h" |
86 #include "content/public/browser/stream_info.h" | 87 #include "content/public/browser/stream_info.h" |
87 #include "content/public/common/browser_side_navigation_policy.h" | 88 #include "content/public/common/browser_side_navigation_policy.h" |
88 #include "content/public/common/content_features.h" | 89 #include "content/public/common/content_features.h" |
89 #include "content/public/common/content_switches.h" | 90 #include "content/public/common/content_switches.h" |
90 #include "content/public/common/process_type.h" | 91 #include "content/public/common/process_type.h" |
(...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2063 | 2064 |
2064 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( | 2065 void ResourceDispatcherHostImpl::FinishedWithResourcesForRequest( |
2065 net::URLRequest* request) { | 2066 net::URLRequest* request) { |
2066 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 2067 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
2067 IncrementOutstandingRequestsCount(-1, info); | 2068 IncrementOutstandingRequestsCount(-1, info); |
2068 } | 2069 } |
2069 | 2070 |
2070 void ResourceDispatcherHostImpl::BeginNavigationRequest( | 2071 void ResourceDispatcherHostImpl::BeginNavigationRequest( |
2071 ResourceContext* resource_context, | 2072 ResourceContext* resource_context, |
2072 const NavigationRequestInfo& info, | 2073 const NavigationRequestInfo& info, |
| 2074 std::unique_ptr<NavigationUIData> navigation_ui_data, |
2073 NavigationURLLoaderImplCore* loader) { | 2075 NavigationURLLoaderImplCore* loader) { |
2074 // PlzNavigate: BeginNavigationRequest currently should only be used for the | 2076 // PlzNavigate: BeginNavigationRequest currently should only be used for the |
2075 // browser-side navigations project. | 2077 // browser-side navigations project. |
2076 CHECK(IsBrowserSideNavigationEnabled()); | 2078 CHECK(IsBrowserSideNavigationEnabled()); |
2077 | 2079 |
2078 ResourceType resource_type = info.is_main_frame ? | 2080 ResourceType resource_type = info.is_main_frame ? |
2079 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; | 2081 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; |
2080 | 2082 |
2081 if (is_shutdown_ || | 2083 if (is_shutdown_ || |
2082 // TODO(davidben): Check ShouldServiceRequest here. This is important; it | 2084 // TODO(davidben): Check ShouldServiceRequest here. This is important; it |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 // here. | 2185 // here. |
2184 // TODO(ricea): Make the feature work with stale-while-revalidate | 2186 // TODO(ricea): Make the feature work with stale-while-revalidate |
2185 // and clean this up. | 2187 // and clean this up. |
2186 std::string(), // original_headers | 2188 std::string(), // original_headers |
2187 info.common_params.post_data, | 2189 info.common_params.post_data, |
2188 // TODO(mek): Currently initiated_in_secure_context is only used for | 2190 // TODO(mek): Currently initiated_in_secure_context is only used for |
2189 // subresource requests, so it doesn't matter what value it gets here. | 2191 // subresource requests, so it doesn't matter what value it gets here. |
2190 // If in the future this changes this should be updated to somehow get a | 2192 // If in the future this changes this should be updated to somehow get a |
2191 // meaningful value. | 2193 // meaningful value. |
2192 false); // initiated_in_secure_context | 2194 false); // initiated_in_secure_context |
| 2195 extra_info->set_navigation_ui_data(std::move(navigation_ui_data)); |
| 2196 |
2193 // Request takes ownership. | 2197 // Request takes ownership. |
2194 extra_info->AssociateWithRequest(new_request.get()); | 2198 extra_info->AssociateWithRequest(new_request.get()); |
2195 | 2199 |
2196 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 2200 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
2197 // Hang on to a reference to ensure the blob is not released prior | 2201 // Hang on to a reference to ensure the blob is not released prior |
2198 // to the job being started. | 2202 // to the job being started. |
2199 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 2203 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
2200 new_request.get(), | 2204 new_request.get(), |
2201 blob_context->GetBlobDataFromPublicURL(new_request->url())); | 2205 blob_context->GetBlobDataFromPublicURL(new_request->url())); |
2202 } | 2206 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 | 2381 |
2378 void ResourceDispatcherHostImpl::StartLoading( | 2382 void ResourceDispatcherHostImpl::StartLoading( |
2379 ResourceRequestInfoImpl* info, | 2383 ResourceRequestInfoImpl* info, |
2380 std::unique_ptr<ResourceLoader> loader) { | 2384 std::unique_ptr<ResourceLoader> loader) { |
2381 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456331 is fixed. | 2385 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456331 is fixed. |
2382 tracked_objects::ScopedTracker tracking_profile( | 2386 tracked_objects::ScopedTracker tracking_profile( |
2383 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 2387 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
2384 "456331 ResourceDispatcherHostImpl::StartLoading")); | 2388 "456331 ResourceDispatcherHostImpl::StartLoading")); |
2385 | 2389 |
2386 ResourceLoader* loader_ptr = loader.get(); | 2390 ResourceLoader* loader_ptr = loader.get(); |
| 2391 DCHECK(pending_loaders_[info->GetGlobalRequestID()] == nullptr); |
2387 pending_loaders_[info->GetGlobalRequestID()] = std::move(loader); | 2392 pending_loaders_[info->GetGlobalRequestID()] = std::move(loader); |
2388 | 2393 |
2389 loader_ptr->StartRequest(); | 2394 loader_ptr->StartRequest(); |
2390 } | 2395 } |
2391 | 2396 |
2392 void ResourceDispatcherHostImpl::OnUserGesture() { | 2397 void ResourceDispatcherHostImpl::OnUserGesture() { |
2393 last_user_gesture_time_ = TimeTicks::Now(); | 2398 last_user_gesture_time_ = TimeTicks::Now(); |
2394 } | 2399 } |
2395 | 2400 |
2396 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest( | 2401 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest( |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 &throttles); | 2715 &throttles); |
2711 if (!throttles.empty()) { | 2716 if (!throttles.empty()) { |
2712 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2717 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2713 std::move(throttles))); | 2718 std::move(throttles))); |
2714 } | 2719 } |
2715 } | 2720 } |
2716 return handler; | 2721 return handler; |
2717 } | 2722 } |
2718 | 2723 |
2719 } // namespace content | 2724 } // namespace content |
OLD | NEW |