| 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 ce9d8029d60a87f1de70d48064c9dbf8d20cc7c4..ca8bb31f9c268c71ae1eb582204a27ad0cbc4c6e 100644
|
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc
|
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
|
| @@ -804,21 +804,21 @@ DownloadInterruptReason ResourceDispatcherHostImpl::BeginDownload(
|
| storage::BlobProtocolHandler::SetRequestedBlobDataHandle(
|
| request.get(),
|
| blob_context->context()->GetBlobDataFromPublicURL(request->url()));
|
| }
|
|
|
| // From this point forward, the |DownloadResourceHandler| is responsible for
|
| // |started_callback|.
|
| scoped_ptr<ResourceHandler> handler(CreateResourceHandlerForDownload(
|
| request.get(), is_content_initiated, true));
|
|
|
| - BeginRequestInternal(std::move(request), std::move(handler));
|
| + BeginRequestInternal(std::move(request), std::move(handler), nullptr);
|
|
|
| return DOWNLOAD_INTERRUPT_REASON_NONE;
|
| }
|
|
|
| void ResourceDispatcherHostImpl::ClearLoginDelegateForRequest(
|
| net::URLRequest* request) {
|
| ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
|
| if (info) {
|
| ResourceLoader* loader = GetLoader(info->GetGlobalRequestID());
|
| if (loader)
|
| @@ -1617,21 +1617,22 @@ void ResourceDispatcherHostImpl::BeginRequest(
|
| 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 (handler)
|
| - BeginRequestInternal(std::move(new_request), std::move(handler));
|
| + BeginRequestInternal(std::move(new_request), std::move(handler),
|
| + resource_context);
|
| }
|
|
|
| scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler(
|
| net::URLRequest* request,
|
| const ResourceHostMsg_Request& request_data,
|
| IPC::Message* sync_result,
|
| int route_id,
|
| int process_type,
|
| int child_id,
|
| ResourceContext* resource_context) {
|
| @@ -1937,21 +1938,21 @@ void ResourceDispatcherHostImpl::BeginSaveFile(const GURL& url,
|
| // Since we're just saving some resources we need, disallow downloading.
|
| ResourceRequestInfoImpl* extra_info =
|
| CreateRequestInfo(child_id, render_view_route_id,
|
| render_frame_route_id, false, context);
|
| extra_info->AssociateWithRequest(request.get()); // Request takes ownership.
|
|
|
| scoped_ptr<ResourceHandler> handler(new SaveFileResourceHandler(
|
| request.get(), save_item_id, save_package_id, child_id,
|
| render_frame_route_id, url, save_file_manager_.get()));
|
|
|
| - BeginRequestInternal(std::move(request), std::move(handler));
|
| + BeginRequestInternal(std::move(request), std::move(handler), nullptr);
|
| }
|
|
|
| void ResourceDispatcherHostImpl::MarkAsTransferredNavigation(
|
| const GlobalRequestID& id) {
|
| GetLoader(id)->MarkAsTransferring();
|
| }
|
|
|
| void ResourceDispatcherHostImpl::CancelTransferringNavigation(
|
| const GlobalRequestID& id) {
|
| // Request should still exist and be in the middle of a transfer.
|
| @@ -2326,21 +2327,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));
|
|
|
| - BeginRequestInternal(std::move(new_request), std::move(handler));
|
| + BeginRequestInternal(std::move(new_request), std::move(handler),
|
| + resource_context);
|
| }
|
|
|
| void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() {
|
| if (!async_revalidation_manager_)
|
| async_revalidation_manager_.reset(new AsyncRevalidationManager);
|
| }
|
|
|
| // static
|
| int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(
|
| net::URLRequest* request) {
|
| @@ -2352,21 +2354,22 @@ int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(
|
| request->referrer().size() +
|
| request->method().size();
|
|
|
| // Note that this expression will typically be dominated by:
|
| // |kAvgBytesPerOutstandingRequest|.
|
| return kAvgBytesPerOutstandingRequest + strings_cost;
|
| }
|
|
|
| void ResourceDispatcherHostImpl::BeginRequestInternal(
|
| scoped_ptr<net::URLRequest> request,
|
| - scoped_ptr<ResourceHandler> handler) {
|
| + scoped_ptr<ResourceHandler> handler,
|
| + ResourceContext* resource_context) {
|
| DCHECK(!request->is_pending());
|
| ResourceRequestInfoImpl* info =
|
| ResourceRequestInfoImpl::ForRequest(request.get());
|
|
|
| if ((TimeTicks::Now() - last_user_gesture_time_) <
|
| TimeDelta::FromMilliseconds(kUserGestureWindowMs)) {
|
| request->SetLoadFlags(
|
| request->load_flags() | net::LOAD_MAYBE_USER_GESTURE);
|
| }
|
|
|
| @@ -2389,21 +2392,22 @@ void ResourceDispatcherHostImpl::BeginRequestInternal(
|
| }
|
|
|
| IncrementOutstandingRequestsMemory(-1, *info);
|
|
|
| // A ResourceHandler must not outlive its associated URLRequest.
|
| handler.reset();
|
| return;
|
| }
|
|
|
| scoped_ptr<ResourceLoader> loader(
|
| - new ResourceLoader(std::move(request), std::move(handler), this));
|
| + new ResourceLoader(std::move(request), std::move(handler), this,
|
| + delegate_, resource_context));
|
|
|
| GlobalFrameRoutingId id(info->GetChildID(), info->GetRenderFrameID());
|
| BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.find(id);
|
| if (iter != blocked_loaders_map_.end()) {
|
| // The request should be blocked.
|
| iter->second->push_back(std::move(loader));
|
| return;
|
| }
|
|
|
| StartLoading(info, std::move(loader));
|
|
|