| 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 ServiceWorkerNavigationHandleCore* service_worker_handle_core) { | 2076 ServiceWorkerNavigationHandleCore* service_worker_handle_core) { |
| 2075 // PlzNavigate: BeginNavigationRequest currently should only be used for the | 2077 // PlzNavigate: BeginNavigationRequest currently should only be used for the |
| 2076 // browser-side navigations project. | 2078 // browser-side navigations project. |
| 2077 CHECK(IsBrowserSideNavigationEnabled()); | 2079 CHECK(IsBrowserSideNavigationEnabled()); |
| 2078 | 2080 |
| 2079 ResourceType resource_type = info.is_main_frame ? | 2081 ResourceType resource_type = info.is_main_frame ? |
| 2080 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; | 2082 RESOURCE_TYPE_MAIN_FRAME : RESOURCE_TYPE_SUB_FRAME; |
| 2081 | 2083 |
| 2082 if (is_shutdown_ || | 2084 if (is_shutdown_ || |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 // here. | 2186 // here. |
| 2185 // TODO(ricea): Make the feature work with stale-while-revalidate | 2187 // TODO(ricea): Make the feature work with stale-while-revalidate |
| 2186 // and clean this up. | 2188 // and clean this up. |
| 2187 std::string(), // original_headers | 2189 std::string(), // original_headers |
| 2188 info.common_params.post_data, | 2190 info.common_params.post_data, |
| 2189 // TODO(mek): Currently initiated_in_secure_context is only used for | 2191 // TODO(mek): Currently initiated_in_secure_context is only used for |
| 2190 // subresource requests, so it doesn't matter what value it gets here. | 2192 // subresource requests, so it doesn't matter what value it gets here. |
| 2191 // If in the future this changes this should be updated to somehow get a | 2193 // If in the future this changes this should be updated to somehow get a |
| 2192 // meaningful value. | 2194 // meaningful value. |
| 2193 false); // initiated_in_secure_context | 2195 false); // initiated_in_secure_context |
| 2196 extra_info->set_navigation_ui_data(std::move(navigation_ui_data)); |
| 2197 |
| 2194 // Request takes ownership. | 2198 // Request takes ownership. |
| 2195 extra_info->AssociateWithRequest(new_request.get()); | 2199 extra_info->AssociateWithRequest(new_request.get()); |
| 2196 | 2200 |
| 2197 if (new_request->url().SchemeIs(url::kBlobScheme)) { | 2201 if (new_request->url().SchemeIs(url::kBlobScheme)) { |
| 2198 // Hang on to a reference to ensure the blob is not released prior | 2202 // Hang on to a reference to ensure the blob is not released prior |
| 2199 // to the job being started. | 2203 // to the job being started. |
| 2200 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( | 2204 storage::BlobProtocolHandler::SetRequestedBlobDataHandle( |
| 2201 new_request.get(), | 2205 new_request.get(), |
| 2202 blob_context->GetBlobDataFromPublicURL(new_request->url())); | 2206 blob_context->GetBlobDataFromPublicURL(new_request->url())); |
| 2203 } | 2207 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2387 | 2391 |
| 2388 void ResourceDispatcherHostImpl::StartLoading( | 2392 void ResourceDispatcherHostImpl::StartLoading( |
| 2389 ResourceRequestInfoImpl* info, | 2393 ResourceRequestInfoImpl* info, |
| 2390 std::unique_ptr<ResourceLoader> loader) { | 2394 std::unique_ptr<ResourceLoader> loader) { |
| 2391 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456331 is fixed. | 2395 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456331 is fixed. |
| 2392 tracked_objects::ScopedTracker tracking_profile( | 2396 tracked_objects::ScopedTracker tracking_profile( |
| 2393 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 2397 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 2394 "456331 ResourceDispatcherHostImpl::StartLoading")); | 2398 "456331 ResourceDispatcherHostImpl::StartLoading")); |
| 2395 | 2399 |
| 2396 ResourceLoader* loader_ptr = loader.get(); | 2400 ResourceLoader* loader_ptr = loader.get(); |
| 2401 DCHECK(pending_loaders_[info->GetGlobalRequestID()] == nullptr); |
| 2397 pending_loaders_[info->GetGlobalRequestID()] = std::move(loader); | 2402 pending_loaders_[info->GetGlobalRequestID()] = std::move(loader); |
| 2398 | 2403 |
| 2399 loader_ptr->StartRequest(); | 2404 loader_ptr->StartRequest(); |
| 2400 } | 2405 } |
| 2401 | 2406 |
| 2402 void ResourceDispatcherHostImpl::OnUserGesture() { | 2407 void ResourceDispatcherHostImpl::OnUserGesture() { |
| 2403 last_user_gesture_time_ = TimeTicks::Now(); | 2408 last_user_gesture_time_ = TimeTicks::Now(); |
| 2404 } | 2409 } |
| 2405 | 2410 |
| 2406 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest( | 2411 net::URLRequest* ResourceDispatcherHostImpl::GetURLRequest( |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2720 &throttles); | 2725 &throttles); |
| 2721 if (!throttles.empty()) { | 2726 if (!throttles.empty()) { |
| 2722 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2727 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
| 2723 std::move(throttles))); | 2728 std::move(throttles))); |
| 2724 } | 2729 } |
| 2725 } | 2730 } |
| 2726 return handler; | 2731 return handler; |
| 2727 } | 2732 } |
| 2728 | 2733 |
| 2729 } // namespace content | 2734 } // namespace content |
| OLD | NEW |