| Index: content/browser/loader/resource_dispatcher_host_impl.cc
|
| diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
|
| index 8ac1fd77e194e675217509cad184c9f24174864a..74355ad1500bd59c3063c0b6c8c6dadf0f3e8f4f 100644
|
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc
|
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
|
| @@ -34,21 +34,23 @@
|
| #include "content/browser/appcache/appcache_interceptor.h"
|
| #include "content/browser/appcache/chrome_appcache_service.h"
|
| #include "content/browser/bad_message.h"
|
| #include "content/browser/cert_store_impl.h"
|
| #include "content/browser/child_process_security_policy_impl.h"
|
| #include "content/browser/download/download_resource_handler.h"
|
| #include "content/browser/download/save_file_manager.h"
|
| #include "content/browser/download/save_file_resource_handler.h"
|
| #include "content/browser/fileapi/chrome_blob_storage_context.h"
|
| #include "content/browser/frame_host/frame_tree.h"
|
| +#include "content/browser/frame_host/navigation_handle_impl.h"
|
| #include "content/browser/frame_host/navigation_request_info.h"
|
| +#include "content/browser/frame_host/navigation_user_data.h"
|
| #include "content/browser/frame_host/navigator.h"
|
| #include "content/browser/loader/async_resource_handler.h"
|
| #include "content/browser/loader/async_revalidation_manager.h"
|
| #include "content/browser/loader/cross_site_resource_handler.h"
|
| #include "content/browser/loader/detachable_resource_handler.h"
|
| #include "content/browser/loader/mime_type_resource_handler.h"
|
| #include "content/browser/loader/navigation_resource_handler.h"
|
| #include "content/browser/loader/navigation_resource_throttle.h"
|
| #include "content/browser/loader/navigation_url_loader_impl_core.h"
|
| #include "content/browser/loader/power_save_block_resource_throttle.h"
|
| @@ -367,25 +369,33 @@ void NotifyRedirectOnUI(int render_process_id,
|
| scoped_ptr<ResourceRedirectDetails> details) {
|
| RenderFrameHostImpl* host =
|
| RenderFrameHostImpl::FromID(render_process_id, render_frame_host);
|
| WebContentsImpl* web_contents =
|
| static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(host));
|
| if (!web_contents)
|
| return;
|
| web_contents->DidGetRedirectForResourceRequest(host, *details.get());
|
| }
|
|
|
| -void NotifyResponseOnUI(int render_process_id,
|
| - int render_frame_host,
|
| - scoped_ptr<ResourceRequestDetails> details) {
|
| +void NotifyResponseOnUI(
|
| + int render_process_id,
|
| + int render_frame_host,
|
| + scoped_ptr<ResourceRequestDetails> details,
|
| + scoped_ptr<NavigationSupportsUserData> navigation_supports_user_data) {
|
| RenderFrameHostImpl* host =
|
| RenderFrameHostImpl::FromID(render_process_id, render_frame_host);
|
| + if (navigation_supports_user_data.get()) {
|
| + // Change what thread owns |navigation_supports_user_data|.
|
| + navigation_supports_user_data->DetachUserDataThread();
|
| + host->navigation_handle()->SetNavigationSupportsUserData(
|
| + std::move(navigation_supports_user_data));
|
| + }
|
| WebContentsImpl* web_contents =
|
| static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(host));
|
| if (!web_contents)
|
| return;
|
| web_contents->DidGetResourceResponseStart(*details.get());
|
| }
|
|
|
| bool IsValidatedSCT(
|
| const net::SignedCertificateTimestampAndStatus& sct_status) {
|
| return sct_status.status == net::ct::SCT_STATUS_OK;
|
| @@ -1001,29 +1011,38 @@ void ResourceDispatcherHostImpl::DidReceiveResponse(ResourceLoader* loader) {
|
|
|
| int render_process_id, render_frame_host;
|
| if (!info->GetAssociatedRenderFrame(&render_process_id, &render_frame_host))
|
| return;
|
|
|
| // Don't notify WebContents observers for requests known to be
|
| // downloads; they aren't really associated with the Webcontents.
|
| // Note that not all downloads are known before content sniffing.
|
| if (info->IsDownload())
|
| return;
|
| -
|
| // Notify the observers on the UI thread.
|
| scoped_ptr<ResourceRequestDetails> detail(new ResourceRequestDetails(
|
| request, GetCertID(request, info->GetChildID())));
|
| +
|
| + NavigationUserData* navigation_user_data = static_cast<NavigationUserData*>(
|
| + request->GetUserData(kNavigationUserDataKey));
|
| + scoped_ptr<NavigationSupportsUserData> navigation_supports_user_data(nullptr);
|
| + if (navigation_user_data) {
|
| + navigation_supports_user_data =
|
| + navigation_user_data->take_own_navigation_supports_user_data();
|
| + request->RemoveUserData(kNavigationUserDataKey);
|
| + }
|
| +
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE,
|
| - base::Bind(
|
| - &NotifyResponseOnUI,
|
| - render_process_id, render_frame_host, base::Passed(&detail)));
|
| + base::Bind(&NotifyResponseOnUI, render_process_id, render_frame_host,
|
| + base::Passed(&detail),
|
| + base::Passed(&navigation_supports_user_data)));
|
| }
|
|
|
| void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) {
|
| ResourceRequestInfoImpl* info = loader->GetRequestInfo();
|
|
|
| // Record final result of all resource loads.
|
| if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME) {
|
| // This enumeration has "3" appended to its name to distinguish it from
|
| // older versions.
|
| UMA_HISTOGRAM_SPARSE_SLOWLY(
|
| @@ -1614,20 +1633,24 @@ void ResourceDispatcherHostImpl::BeginRequest(
|
| new_request.get(), filter_->appcache_service(), child_id,
|
| request_data.appcache_host_id, request_data.resource_type,
|
| request_data.should_reset_appcache);
|
|
|
| scoped_ptr<ResourceHandler> handler(
|
| CreateResourceHandler(
|
| new_request.get(),
|
| request_data, sync_result, route_id, process_type, child_id,
|
| resource_context));
|
|
|
| + if (IsResourceTypeFrame(request_data.resource_type)) {
|
| + new_request->SetUserData(kNavigationUserDataKey, new NavigationUserData());
|
| + }
|
| +
|
| if (handler)
|
| BeginRequestInternal(std::move(new_request), std::move(handler));
|
| }
|
|
|
| scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler(
|
| net::URLRequest* request,
|
| const ResourceHostMsg_Request& request_data,
|
| IPC::Message* sync_result,
|
| int route_id,
|
| int process_type,
|
| @@ -2324,20 +2347,22 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest(
|
| // TODO(davidben): Pass in the appropriate appcache_service. Also fix the
|
| // dependency on child_id/route_id. Those are used by the ResourceScheduler;
|
| // currently it's a no-op.
|
| handler =
|
| AddStandardHandlers(new_request.get(), resource_type, resource_context,
|
| nullptr, // appcache_service
|
| -1, // child_id
|
| -1, // route_id
|
| std::move(handler));
|
|
|
| + new_request->SetUserData(kNavigationUserDataKey, new NavigationUserData());
|
| +
|
| BeginRequestInternal(std::move(new_request), std::move(handler));
|
| }
|
|
|
| void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() {
|
| if (!async_revalidation_manager_)
|
| async_revalidation_manager_.reset(new AsyncRevalidationManager);
|
| }
|
|
|
| // static
|
| int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(
|
|
|