| 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 bffd3d6f4f93af729c7da4a72ca24fc02e6a0fb9..e70e82464158a372673363cd097d48f5a60e0fb9 100644
|
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc
|
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
|
| @@ -36,6 +36,7 @@
|
| #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_request_info.h"
|
| #include "content/browser/frame_host/navigator.h"
|
| #include "content/browser/loader/async_resource_handler.h"
|
| @@ -566,7 +567,7 @@ void ResourceDispatcherHostImpl::CancelRequestsForContext(
|
| i != blocked_loaders_map_.end();) {
|
| BlockedLoadersList* loaders = i->second;
|
| if (loaders->empty()) {
|
| - // This can happen if BlockRequestsForRoute() has been called for a route,
|
| + // This can happen if BlockRequestsForFrame() has been called for a route,
|
| // but we haven't blocked any matching requests yet.
|
| ++i;
|
| continue;
|
| @@ -1051,19 +1052,19 @@ void ResourceDispatcherHostImpl::OnShutdown() {
|
|
|
| // Clear blocked requests if any left.
|
| // Note that we have to do this in 2 passes as we cannot call
|
| - // CancelBlockedRequestsForRoute while iterating over
|
| + // CancelBlockedRequestsForFrame while iterating over
|
| // blocked_loaders_map_, as it modifies it.
|
| - std::set<GlobalRoutingID> ids;
|
| + std::set<GlobalFrameRoutingID> ids;
|
| for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin();
|
| iter != blocked_loaders_map_.end(); ++iter) {
|
| - std::pair<std::set<GlobalRoutingID>::iterator, bool> result =
|
| + std::pair<std::set<GlobalFrameRoutingID>::iterator, bool> result =
|
| ids.insert(iter->first);
|
| // We should not have duplicates.
|
| DCHECK(result.second);
|
| }
|
| - for (std::set<GlobalRoutingID>::const_iterator iter = ids.begin();
|
| + for (std::set<GlobalFrameRoutingID>::const_iterator iter = ids.begin();
|
| iter != ids.end(); ++iter) {
|
| - CancelBlockedRequestsForRoute(iter->child_id, iter->route_id);
|
| + CancelBlockedRequestsForFrame(iter->child_id, iter->route_id);
|
| }
|
|
|
| scheduler_.reset();
|
| @@ -1157,11 +1158,11 @@ void ResourceDispatcherHostImpl::UpdateRequestForTransfer(
|
| const ResourceHostMsg_Request& request_data,
|
| const linked_ptr<ResourceLoader>& loader) {
|
| ResourceRequestInfoImpl* info = loader->GetRequestInfo();
|
| - GlobalRoutingID old_routing_id(
|
| - request_data.transferred_request_child_id, info->GetRouteID());
|
| + GlobalFrameRoutingID old_routing_id(request_data.transferred_request_child_id,
|
| + info->GetRenderFrameID());
|
| GlobalRequestID old_request_id(request_data.transferred_request_child_id,
|
| request_data.transferred_request_request_id);
|
| - GlobalRoutingID new_routing_id(child_id, route_id);
|
| + GlobalFrameRoutingID new_routing_id(child_id, request_data.render_frame_id);
|
| GlobalRequestID new_request_id(child_id, request_id);
|
|
|
| // Clear out data that depends on |info| before updating it.
|
| @@ -1178,7 +1179,8 @@ void ResourceDispatcherHostImpl::UpdateRequestForTransfer(
|
| // ResourceRequestInfo rather than caching it locally. This lets us update
|
| // the info object when a transfer occurs.
|
| info->UpdateForTransfer(child_id, route_id, request_data.origin_pid,
|
| - request_id, request_data.parent_render_frame_id,
|
| + request_id, request_data.render_frame_id,
|
| + request_data.parent_render_frame_id,
|
| filter_->GetWeakPtr());
|
|
|
| // Update maps that used the old IDs, if necessary. Some transfers in tests
|
| @@ -1728,6 +1730,11 @@ ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo(
|
| std::string()); // original_headers
|
| }
|
|
|
| +void ResourceDispatcherHostImpl::OnRenderFrameHostDeleted(int child_id,
|
| + int route_id) {
|
| + CancelRequestsForFrame(child_id, route_id);
|
| +}
|
| +
|
| void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id,
|
| int route_id,
|
| bool is_visible,
|
| @@ -1735,11 +1742,9 @@ void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id,
|
| scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible);
|
| }
|
|
|
| -void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(
|
| - int child_id,
|
| - int route_id) {
|
| +void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(int child_id,
|
| + int route_id) {
|
| scheduler_->OnClientDeleted(child_id, route_id);
|
| - CancelRequestsForRoute(child_id, route_id);
|
| }
|
|
|
| void ResourceDispatcherHostImpl::OnRenderViewHostSetIsLoading(int child_id,
|
| @@ -1848,11 +1853,11 @@ void ResourceDispatcherHostImpl::ResumeDeferredNavigation(
|
| // for downloads and detachable resources, which belong to the browser process
|
| // even if initiated via a renderer.
|
| void ResourceDispatcherHostImpl::CancelRequestsForProcess(int child_id) {
|
| - CancelRequestsForRoute(child_id, -1 /* cancel all */);
|
| + CancelRequestsForFrame(child_id, -1 /* cancel all */);
|
| registered_temp_files_.erase(child_id);
|
| }
|
|
|
| -void ResourceDispatcherHostImpl::CancelRequestsForRoute(int child_id,
|
| +void ResourceDispatcherHostImpl::CancelRequestsForFrame(int child_id,
|
| int route_id) {
|
| // Since pending_requests_ is a map, we first build up a list of all of the
|
| // matching requests to be cancelled, and then we cancel them. Since there
|
| @@ -1878,7 +1883,7 @@ void ResourceDispatcherHostImpl::CancelRequestsForRoute(int child_id,
|
| info->detachable_handler()->Detach();
|
| } else if (!info->IsDownload() && !info->is_stream() &&
|
| !IsTransferredNavigation(id) &&
|
| - (route_id == -1 || route_id == info->GetRouteID())) {
|
| + (route_id == -1 || route_id == info->GetRenderFrameID())) {
|
| matching_requests.push_back(id);
|
| }
|
| }
|
| @@ -1909,15 +1914,15 @@ void ResourceDispatcherHostImpl::CancelRequestsForRoute(int child_id,
|
|
|
| // Now deal with blocked requests if any.
|
| if (route_id != -1) {
|
| - if (blocked_loaders_map_.find(GlobalRoutingID(child_id, route_id)) !=
|
| + if (blocked_loaders_map_.find(GlobalFrameRoutingID(child_id, route_id)) !=
|
| blocked_loaders_map_.end()) {
|
| - CancelBlockedRequestsForRoute(child_id, route_id);
|
| + CancelBlockedRequestsForFrame(child_id, route_id);
|
| }
|
| } else {
|
| // We have to do all render views for the process |child_id|.
|
| // Note that we have to do this in 2 passes as we cannot call
|
| - // CancelBlockedRequestsForRoute while iterating over
|
| - // blocked_loaders_map_, as it modifies it.
|
| + // CancelBlockedRequestsForFrame while iterating over
|
| + // blocked_loaders_map_, as blocking requests modifies the map.
|
| std::set<int> route_ids;
|
| for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin();
|
| iter != blocked_loaders_map_.end(); ++iter) {
|
| @@ -1926,7 +1931,7 @@ void ResourceDispatcherHostImpl::CancelRequestsForRoute(int child_id,
|
| }
|
| for (std::set<int>::const_iterator iter = route_ids.begin();
|
| iter != route_ids.end(); ++iter) {
|
| - CancelBlockedRequestsForRoute(child_id, *iter);
|
| + CancelBlockedRequestsForFrame(child_id, *iter);
|
| }
|
| }
|
| }
|
| @@ -2273,7 +2278,7 @@ void ResourceDispatcherHostImpl::BeginRequestInternal(
|
| linked_ptr<ResourceLoader> loader(
|
| new ResourceLoader(request.Pass(), handler.Pass(), this));
|
|
|
| - GlobalRoutingID id(info->GetGlobalRoutingID());
|
| + 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.
|
| @@ -2395,31 +2400,31 @@ void ResourceDispatcherHostImpl::UpdateLoadInfo() {
|
| base::Passed(&info_map)));
|
| }
|
|
|
| -void ResourceDispatcherHostImpl::BlockRequestsForRoute(int child_id,
|
| +void ResourceDispatcherHostImpl::BlockRequestsForFrame(int child_id,
|
| int route_id) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| - GlobalRoutingID key(child_id, route_id);
|
| - DCHECK(blocked_loaders_map_.find(key) == blocked_loaders_map_.end()) <<
|
| - "BlockRequestsForRoute called multiple time for the same RVH";
|
| + GlobalFrameRoutingID key(child_id, route_id);
|
| + DCHECK(blocked_loaders_map_.find(key) == blocked_loaders_map_.end())
|
| + << "BlockRequestsForFrame called multiple time for the same RVH";
|
| blocked_loaders_map_[key] = new BlockedLoadersList();
|
| }
|
|
|
| -void ResourceDispatcherHostImpl::ResumeBlockedRequestsForRoute(int child_id,
|
| +void ResourceDispatcherHostImpl::ResumeBlockedRequestsForFrame(int child_id,
|
| int route_id) {
|
| - ProcessBlockedRequestsForRoute(child_id, route_id, false);
|
| + ProcessBlockedRequestsForFrame(child_id, route_id, false);
|
| }
|
|
|
| -void ResourceDispatcherHostImpl::CancelBlockedRequestsForRoute(int child_id,
|
| +void ResourceDispatcherHostImpl::CancelBlockedRequestsForFrame(int child_id,
|
| int route_id) {
|
| - ProcessBlockedRequestsForRoute(child_id, route_id, true);
|
| + ProcessBlockedRequestsForFrame(child_id, route_id, true);
|
| }
|
|
|
| -void ResourceDispatcherHostImpl::ProcessBlockedRequestsForRoute(
|
| +void ResourceDispatcherHostImpl::ProcessBlockedRequestsForFrame(
|
| int child_id,
|
| int route_id,
|
| bool cancel_requests) {
|
| - BlockedLoadersMap::iterator iter = blocked_loaders_map_.find(
|
| - GlobalRoutingID(child_id, route_id));
|
| + BlockedLoadersMap::iterator iter =
|
| + blocked_loaders_map_.find(GlobalFrameRoutingID(child_id, route_id));
|
| if (iter == blocked_loaders_map_.end()) {
|
| // It's possible to reach here if the renderer crashed while an interstitial
|
| // page was showing.
|
|
|