Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 1542743002: [RDHI] Refactored blocked_loaders_map_ to key by render frame route id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just comments / minor restructuring (trybots previous) Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 18 matching lines...) Expand all
29 #include "base/time/time.h" 29 #include "base/time/time.h"
30 #include "content/browser/appcache/appcache_interceptor.h" 30 #include "content/browser/appcache/appcache_interceptor.h"
31 #include "content/browser/appcache/chrome_appcache_service.h" 31 #include "content/browser/appcache/chrome_appcache_service.h"
32 #include "content/browser/bad_message.h" 32 #include "content/browser/bad_message.h"
33 #include "content/browser/cert_store_impl.h" 33 #include "content/browser/cert_store_impl.h"
34 #include "content/browser/child_process_security_policy_impl.h" 34 #include "content/browser/child_process_security_policy_impl.h"
35 #include "content/browser/download/download_resource_handler.h" 35 #include "content/browser/download/download_resource_handler.h"
36 #include "content/browser/download/save_file_manager.h" 36 #include "content/browser/download/save_file_manager.h"
37 #include "content/browser/download/save_file_resource_handler.h" 37 #include "content/browser/download/save_file_resource_handler.h"
38 #include "content/browser/fileapi/chrome_blob_storage_context.h" 38 #include "content/browser/fileapi/chrome_blob_storage_context.h"
39 #include "content/browser/frame_host/frame_tree.h"
39 #include "content/browser/frame_host/navigation_request_info.h" 40 #include "content/browser/frame_host/navigation_request_info.h"
40 #include "content/browser/frame_host/navigator.h" 41 #include "content/browser/frame_host/navigator.h"
41 #include "content/browser/loader/async_resource_handler.h" 42 #include "content/browser/loader/async_resource_handler.h"
42 #include "content/browser/loader/async_revalidation_manager.h" 43 #include "content/browser/loader/async_revalidation_manager.h"
43 #include "content/browser/loader/cross_site_resource_handler.h" 44 #include "content/browser/loader/cross_site_resource_handler.h"
44 #include "content/browser/loader/detachable_resource_handler.h" 45 #include "content/browser/loader/detachable_resource_handler.h"
45 #include "content/browser/loader/mime_type_resource_handler.h" 46 #include "content/browser/loader/mime_type_resource_handler.h"
46 #include "content/browser/loader/navigation_resource_handler.h" 47 #include "content/browser/loader/navigation_resource_handler.h"
47 #include "content/browser/loader/navigation_resource_throttle.h" 48 #include "content/browser/loader/navigation_resource_throttle.h"
48 #include "content/browser/loader/navigation_url_loader_impl_core.h" 49 #include "content/browser/loader/navigation_url_loader_impl_core.h"
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 pending_loaders_.erase(i++); 560 pending_loaders_.erase(i++);
560 } else { 561 } else {
561 ++i; 562 ++i;
562 } 563 }
563 } 564 }
564 565
565 for (BlockedLoadersMap::iterator i = blocked_loaders_map_.begin(); 566 for (BlockedLoadersMap::iterator i = blocked_loaders_map_.begin();
566 i != blocked_loaders_map_.end();) { 567 i != blocked_loaders_map_.end();) {
567 BlockedLoadersList* loaders = i->second; 568 BlockedLoadersList* loaders = i->second;
568 if (loaders->empty()) { 569 if (loaders->empty()) {
569 // This can happen if BlockRequestsForRoute() has been called for a route, 570 // This can happen if BlockRequestsForFrame() has been called for a route,
570 // but we haven't blocked any matching requests yet. 571 // but we haven't blocked any matching requests yet.
571 ++i; 572 ++i;
572 continue; 573 continue;
573 } 574 }
574 ResourceRequestInfoImpl* info = loaders->front()->GetRequestInfo(); 575 ResourceRequestInfoImpl* info = loaders->front()->GetRequestInfo();
575 if (info->GetContext() == context) { 576 if (info->GetContext() == context) {
576 blocked_loaders_map_.erase(i++); 577 blocked_loaders_map_.erase(i++);
577 for (BlockedLoadersList::const_iterator it = loaders->begin(); 578 for (BlockedLoadersList::const_iterator it = loaders->begin();
578 it != loaders->end(); ++it) { 579 it != loaders->end(); ++it) {
579 linked_ptr<ResourceLoader> loader = *it; 580 linked_ptr<ResourceLoader> loader = *it;
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 is_shutdown_ = true; 1045 is_shutdown_ = true;
1045 pending_loaders_.clear(); 1046 pending_loaders_.clear();
1046 1047
1047 // Make sure we shutdown the timer now, otherwise by the time our destructor 1048 // Make sure we shutdown the timer now, otherwise by the time our destructor
1048 // runs if the timer is still running the Task is deleted twice (once by 1049 // runs if the timer is still running the Task is deleted twice (once by
1049 // the MessageLoop and the second time by RepeatingTimer). 1050 // the MessageLoop and the second time by RepeatingTimer).
1050 update_load_states_timer_.reset(); 1051 update_load_states_timer_.reset();
1051 1052
1052 // Clear blocked requests if any left. 1053 // Clear blocked requests if any left.
1053 // Note that we have to do this in 2 passes as we cannot call 1054 // Note that we have to do this in 2 passes as we cannot call
1054 // CancelBlockedRequestsForRoute while iterating over 1055 // CancelBlockedRequestsForFrame while iterating over
1055 // blocked_loaders_map_, as it modifies it. 1056 // blocked_loaders_map_, as it modifies it.
1056 std::set<GlobalRoutingID> ids; 1057 std::set<GlobalFrameRoutingID> ids;
1057 for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin(); 1058 for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin();
1058 iter != blocked_loaders_map_.end(); ++iter) { 1059 iter != blocked_loaders_map_.end(); ++iter) {
1059 std::pair<std::set<GlobalRoutingID>::iterator, bool> result = 1060 std::pair<std::set<GlobalFrameRoutingID>::iterator, bool> result =
1060 ids.insert(iter->first); 1061 ids.insert(iter->first);
1061 // We should not have duplicates. 1062 // We should not have duplicates.
1062 DCHECK(result.second); 1063 DCHECK(result.second);
1063 } 1064 }
1064 for (std::set<GlobalRoutingID>::const_iterator iter = ids.begin(); 1065 for (std::set<GlobalFrameRoutingID>::const_iterator iter = ids.begin();
1065 iter != ids.end(); ++iter) { 1066 iter != ids.end(); ++iter) {
1066 CancelBlockedRequestsForRoute(iter->child_id, iter->route_id); 1067 CancelBlockedRequestsForFrame(iter->child_id, iter->route_id);
1067 } 1068 }
1068 1069
1069 scheduler_.reset(); 1070 scheduler_.reset();
1070 } 1071 }
1071 1072
1072 bool ResourceDispatcherHostImpl::OnMessageReceived( 1073 bool ResourceDispatcherHostImpl::OnMessageReceived(
1073 const IPC::Message& message, 1074 const IPC::Message& message,
1074 ResourceMessageFilter* filter) { 1075 ResourceMessageFilter* filter) {
1075 filter_ = filter; 1076 filter_ = filter;
1076 bool handled = true; 1077 bool handled = true;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 sync_result->routing_id()); 1151 sync_result->routing_id());
1151 } 1152 }
1152 1153
1153 void ResourceDispatcherHostImpl::UpdateRequestForTransfer( 1154 void ResourceDispatcherHostImpl::UpdateRequestForTransfer(
1154 int child_id, 1155 int child_id,
1155 int route_id, 1156 int route_id,
1156 int request_id, 1157 int request_id,
1157 const ResourceHostMsg_Request& request_data, 1158 const ResourceHostMsg_Request& request_data,
1158 const linked_ptr<ResourceLoader>& loader) { 1159 const linked_ptr<ResourceLoader>& loader) {
1159 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); 1160 ResourceRequestInfoImpl* info = loader->GetRequestInfo();
1160 GlobalRoutingID old_routing_id( 1161 GlobalFrameRoutingID old_routing_id(request_data.transferred_request_child_id,
1161 request_data.transferred_request_child_id, info->GetRouteID()); 1162 info->GetRenderFrameID());
1162 GlobalRequestID old_request_id(request_data.transferred_request_child_id, 1163 GlobalRequestID old_request_id(request_data.transferred_request_child_id,
1163 request_data.transferred_request_request_id); 1164 request_data.transferred_request_request_id);
1164 GlobalRoutingID new_routing_id(child_id, route_id); 1165 GlobalFrameRoutingID new_routing_id(child_id, request_data.render_frame_id);
1165 GlobalRequestID new_request_id(child_id, request_id); 1166 GlobalRequestID new_request_id(child_id, request_id);
1166 1167
1167 // Clear out data that depends on |info| before updating it. 1168 // Clear out data that depends on |info| before updating it.
1168 // We always need to move the memory stats to the new process. In contrast, 1169 // We always need to move the memory stats to the new process. In contrast,
1169 // stats.num_requests is only tracked for some requests (those that require 1170 // stats.num_requests is only tracked for some requests (those that require
1170 // file descriptors for their shared memory buffer). 1171 // file descriptors for their shared memory buffer).
1171 IncrementOutstandingRequestsMemory(-1, *info); 1172 IncrementOutstandingRequestsMemory(-1, *info);
1172 bool should_update_count = info->counted_as_in_flight_request(); 1173 bool should_update_count = info->counted_as_in_flight_request();
1173 if (should_update_count) 1174 if (should_update_count)
1174 IncrementOutstandingRequestsCount(-1, info); 1175 IncrementOutstandingRequestsCount(-1, info);
1175 pending_loaders_.erase(old_request_id); 1176 pending_loaders_.erase(old_request_id);
1176 1177
1177 // ResourceHandlers should always get state related to the request from the 1178 // ResourceHandlers should always get state related to the request from the
1178 // ResourceRequestInfo rather than caching it locally. This lets us update 1179 // ResourceRequestInfo rather than caching it locally. This lets us update
1179 // the info object when a transfer occurs. 1180 // the info object when a transfer occurs.
1180 info->UpdateForTransfer(child_id, route_id, request_data.origin_pid, 1181 info->UpdateForTransfer(child_id, route_id, request_data.origin_pid,
1181 request_id, request_data.parent_render_frame_id, 1182 request_id, request_data.render_frame_id,
1183 request_data.parent_render_frame_id,
1182 filter_->GetWeakPtr()); 1184 filter_->GetWeakPtr());
1183 1185
1184 // Update maps that used the old IDs, if necessary. Some transfers in tests 1186 // Update maps that used the old IDs, if necessary. Some transfers in tests
1185 // do not actually use a different ID, so not all maps need to be updated. 1187 // do not actually use a different ID, so not all maps need to be updated.
1186 pending_loaders_[new_request_id] = loader; 1188 pending_loaders_[new_request_id] = loader;
1187 IncrementOutstandingRequestsMemory(1, *info); 1189 IncrementOutstandingRequestsMemory(1, *info);
1188 if (should_update_count) 1190 if (should_update_count)
1189 IncrementOutstandingRequestsCount(1, info); 1191 IncrementOutstandingRequestsCount(1, info);
1190 if (old_routing_id != new_routing_id) { 1192 if (old_routing_id != new_routing_id) {
1191 if (blocked_loaders_map_.find(old_routing_id) != 1193 if (blocked_loaders_map_.find(old_routing_id) !=
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 blink::WebReferrerPolicyDefault, 1723 blink::WebReferrerPolicyDefault,
1722 blink::WebPageVisibilityStateVisible, 1724 blink::WebPageVisibilityStateVisible,
1723 context, 1725 context,
1724 base::WeakPtr<ResourceMessageFilter>(), // filter 1726 base::WeakPtr<ResourceMessageFilter>(), // filter
1725 false, // report_raw_headers 1727 false, // report_raw_headers
1726 true, // is_async 1728 true, // is_async
1727 false, // is_using_lofi 1729 false, // is_using_lofi
1728 std::string()); // original_headers 1730 std::string()); // original_headers
1729 } 1731 }
1730 1732
1733 void ResourceDispatcherHostImpl::OnRenderFrameHostDeleted(int child_id,
1734 int route_id) {
1735 CancelRequestsForFrame(child_id, route_id);
1736 }
1737
1731 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, 1738 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id,
1732 int route_id, 1739 int route_id,
1733 bool is_visible, 1740 bool is_visible,
1734 bool is_audible) { 1741 bool is_audible) {
1735 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible); 1742 scheduler_->OnClientCreated(child_id, route_id, is_visible, is_audible);
1736 } 1743 }
1737 1744
1738 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted( 1745 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(int child_id,
1739 int child_id, 1746 int route_id) {
1740 int route_id) {
1741 scheduler_->OnClientDeleted(child_id, route_id); 1747 scheduler_->OnClientDeleted(child_id, route_id);
1742 CancelRequestsForRoute(child_id, route_id);
1743 } 1748 }
1744 1749
1745 void ResourceDispatcherHostImpl::OnRenderViewHostSetIsLoading(int child_id, 1750 void ResourceDispatcherHostImpl::OnRenderViewHostSetIsLoading(int child_id,
1746 int route_id, 1751 int route_id,
1747 bool is_loading) { 1752 bool is_loading) {
1748 scheduler_->OnLoadingStateChanged(child_id, route_id, !is_loading); 1753 scheduler_->OnLoadingStateChanged(child_id, route_id, !is_loading);
1749 } 1754 }
1750 1755
1751 void ResourceDispatcherHostImpl::OnRenderViewHostWasHidden( 1756 void ResourceDispatcherHostImpl::OnRenderViewHostWasHidden(
1752 int child_id, 1757 int child_id,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 ResourceLoader* loader = GetLoader(id); 1846 ResourceLoader* loader = GetLoader(id);
1842 // The response we were meant to resume could have already been canceled. 1847 // The response we were meant to resume could have already been canceled.
1843 if (loader) 1848 if (loader)
1844 loader->CompleteTransfer(); 1849 loader->CompleteTransfer();
1845 } 1850 }
1846 1851
1847 // The object died, so cancel and detach all requests associated with it except 1852 // The object died, so cancel and detach all requests associated with it except
1848 // for downloads and detachable resources, which belong to the browser process 1853 // for downloads and detachable resources, which belong to the browser process
1849 // even if initiated via a renderer. 1854 // even if initiated via a renderer.
1850 void ResourceDispatcherHostImpl::CancelRequestsForProcess(int child_id) { 1855 void ResourceDispatcherHostImpl::CancelRequestsForProcess(int child_id) {
1851 CancelRequestsForRoute(child_id, -1 /* cancel all */); 1856 CancelRequestsForFrame(child_id, -1 /* cancel all */);
1852 registered_temp_files_.erase(child_id); 1857 registered_temp_files_.erase(child_id);
1853 } 1858 }
1854 1859
1855 void ResourceDispatcherHostImpl::CancelRequestsForRoute(int child_id, 1860 void ResourceDispatcherHostImpl::CancelRequestsForFrame(int child_id,
1856 int route_id) { 1861 int route_id) {
1857 // Since pending_requests_ is a map, we first build up a list of all of the 1862 // Since pending_requests_ is a map, we first build up a list of all of the
1858 // matching requests to be cancelled, and then we cancel them. Since there 1863 // matching requests to be cancelled, and then we cancel them. Since there
1859 // may be more than one request to cancel, we cannot simply hold onto the map 1864 // may be more than one request to cancel, we cannot simply hold onto the map
1860 // iterators found in the first loop. 1865 // iterators found in the first loop.
1861 1866
1862 // Find the global ID of all matching elements. 1867 // Find the global ID of all matching elements.
1863 bool any_requests_transferring = false; 1868 bool any_requests_transferring = false;
1864 std::vector<GlobalRequestID> matching_requests; 1869 std::vector<GlobalRequestID> matching_requests;
1865 for (LoaderMap::const_iterator i = pending_loaders_.begin(); 1870 for (LoaderMap::const_iterator i = pending_loaders_.begin();
1866 i != pending_loaders_.end(); ++i) { 1871 i != pending_loaders_.end(); ++i) {
1867 if (i->first.child_id != child_id) 1872 if (i->first.child_id != child_id)
1868 continue; 1873 continue;
1869 1874
1870 ResourceRequestInfoImpl* info = i->second->GetRequestInfo(); 1875 ResourceRequestInfoImpl* info = i->second->GetRequestInfo();
1871 1876
1872 GlobalRequestID id(child_id, i->first.request_id); 1877 GlobalRequestID id(child_id, i->first.request_id);
1873 DCHECK(id == i->first); 1878 DCHECK(id == i->first);
1874 // Don't cancel navigations that are expected to live beyond this process. 1879 // Don't cancel navigations that are expected to live beyond this process.
1875 if (IsTransferredNavigation(id)) 1880 if (IsTransferredNavigation(id))
1876 any_requests_transferring = true; 1881 any_requests_transferring = true;
1877 if (info->detachable_handler()) { 1882 if (info->detachable_handler()) {
1878 info->detachable_handler()->Detach(); 1883 info->detachable_handler()->Detach();
1879 } else if (!info->IsDownload() && !info->is_stream() && 1884 } else if (!info->IsDownload() && !info->is_stream() &&
1880 !IsTransferredNavigation(id) && 1885 !IsTransferredNavigation(id) &&
1881 (route_id == -1 || route_id == info->GetRouteID())) { 1886 (route_id == -1 || route_id == info->GetRenderFrameID())) {
1882 matching_requests.push_back(id); 1887 matching_requests.push_back(id);
1883 } 1888 }
1884 } 1889 }
1885 1890
1886 // Remove matches. 1891 // Remove matches.
1887 for (size_t i = 0; i < matching_requests.size(); ++i) { 1892 for (size_t i = 0; i < matching_requests.size(); ++i) {
1888 LoaderMap::iterator iter = pending_loaders_.find(matching_requests[i]); 1893 LoaderMap::iterator iter = pending_loaders_.find(matching_requests[i]);
1889 // Although every matching request was in pending_requests_ when we built 1894 // Although every matching request was in pending_requests_ when we built
1890 // matching_requests, it is normal for a matching request to be not found 1895 // matching_requests, it is normal for a matching request to be not found
1891 // in pending_requests_ after we have removed some matching requests from 1896 // in pending_requests_ after we have removed some matching requests from
(...skipping 10 matching lines...) Expand all
1902 // Don't clear the blocked loaders or offline policy maps if any of the 1907 // Don't clear the blocked loaders or offline policy maps if any of the
1903 // requests in route_id are being transferred to a new process, since those 1908 // requests in route_id are being transferred to a new process, since those
1904 // maps will be updated with the new route_id after the transfer. Otherwise 1909 // maps will be updated with the new route_id after the transfer. Otherwise
1905 // we will lose track of this info when the old route goes away, before the 1910 // we will lose track of this info when the old route goes away, before the
1906 // new one is created. 1911 // new one is created.
1907 if (any_requests_transferring) 1912 if (any_requests_transferring)
1908 return; 1913 return;
1909 1914
1910 // Now deal with blocked requests if any. 1915 // Now deal with blocked requests if any.
1911 if (route_id != -1) { 1916 if (route_id != -1) {
1912 if (blocked_loaders_map_.find(GlobalRoutingID(child_id, route_id)) != 1917 if (blocked_loaders_map_.find(GlobalFrameRoutingID(child_id, route_id)) !=
1913 blocked_loaders_map_.end()) { 1918 blocked_loaders_map_.end()) {
1914 CancelBlockedRequestsForRoute(child_id, route_id); 1919 CancelBlockedRequestsForFrame(child_id, route_id);
1915 } 1920 }
1916 } else { 1921 } else {
1917 // We have to do all render views for the process |child_id|. 1922 // We have to do all render views for the process |child_id|.
1918 // Note that we have to do this in 2 passes as we cannot call 1923 // Note that we have to do this in 2 passes as we cannot call
1919 // CancelBlockedRequestsForRoute while iterating over 1924 // CancelBlockedRequestsForFrame while iterating over
1920 // blocked_loaders_map_, as it modifies it. 1925 // blocked_loaders_map_, as blocking requests modifies the map.
1921 std::set<int> route_ids; 1926 std::set<int> route_ids;
1922 for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin(); 1927 for (BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.begin();
1923 iter != blocked_loaders_map_.end(); ++iter) { 1928 iter != blocked_loaders_map_.end(); ++iter) {
1924 if (iter->first.child_id == child_id) 1929 if (iter->first.child_id == child_id)
1925 route_ids.insert(iter->first.route_id); 1930 route_ids.insert(iter->first.route_id);
1926 } 1931 }
1927 for (std::set<int>::const_iterator iter = route_ids.begin(); 1932 for (std::set<int>::const_iterator iter = route_ids.begin();
1928 iter != route_ids.end(); ++iter) { 1933 iter != route_ids.end(); ++iter) {
1929 CancelBlockedRequestsForRoute(child_id, *iter); 1934 CancelBlockedRequestsForFrame(child_id, *iter);
1930 } 1935 }
1931 } 1936 }
1932 } 1937 }
1933 1938
1934 // Cancels the request and removes it from the list. 1939 // Cancels the request and removes it from the list.
1935 void ResourceDispatcherHostImpl::RemovePendingRequest(int child_id, 1940 void ResourceDispatcherHostImpl::RemovePendingRequest(int child_id,
1936 int request_id) { 1941 int request_id) {
1937 LoaderMap::iterator i = pending_loaders_.find( 1942 LoaderMap::iterator i = pending_loaders_.find(
1938 GlobalRequestID(child_id, request_id)); 1943 GlobalRequestID(child_id, request_id));
1939 if (i == pending_loaders_.end()) { 1944 if (i == pending_loaders_.end()) {
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 IncrementOutstandingRequestsMemory(-1, *info); 2271 IncrementOutstandingRequestsMemory(-1, *info);
2267 2272
2268 // A ResourceHandler must not outlive its associated URLRequest. 2273 // A ResourceHandler must not outlive its associated URLRequest.
2269 handler.reset(); 2274 handler.reset();
2270 return; 2275 return;
2271 } 2276 }
2272 2277
2273 linked_ptr<ResourceLoader> loader( 2278 linked_ptr<ResourceLoader> loader(
2274 new ResourceLoader(request.Pass(), handler.Pass(), this)); 2279 new ResourceLoader(request.Pass(), handler.Pass(), this));
2275 2280
2276 GlobalRoutingID id(info->GetGlobalRoutingID()); 2281 GlobalFrameRoutingID id(info->GetChildID(), info->GetRenderFrameID());
2277 BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.find(id); 2282 BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.find(id);
2278 if (iter != blocked_loaders_map_.end()) { 2283 if (iter != blocked_loaders_map_.end()) {
2279 // The request should be blocked. 2284 // The request should be blocked.
2280 iter->second->push_back(loader); 2285 iter->second->push_back(loader);
2281 return; 2286 return;
2282 } 2287 }
2283 2288
2284 StartLoading(info, loader); 2289 StartLoading(info, loader);
2285 } 2290 }
2286 2291
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 update_load_states_timer_->Stop(); 2393 update_load_states_timer_->Stop();
2389 return; 2394 return;
2390 } 2395 }
2391 2396
2392 BrowserThread::PostTask( 2397 BrowserThread::PostTask(
2393 BrowserThread::UI, FROM_HERE, 2398 BrowserThread::UI, FROM_HERE,
2394 base::Bind(&ResourceDispatcherHostImpl::UpdateLoadInfoOnUIThread, 2399 base::Bind(&ResourceDispatcherHostImpl::UpdateLoadInfoOnUIThread,
2395 base::Passed(&info_map))); 2400 base::Passed(&info_map)));
2396 } 2401 }
2397 2402
2398 void ResourceDispatcherHostImpl::BlockRequestsForRoute(int child_id, 2403 void ResourceDispatcherHostImpl::BlockRequestsForFrame(int child_id,
2399 int route_id) { 2404 int route_id) {
2400 DCHECK_CURRENTLY_ON(BrowserThread::IO); 2405 DCHECK_CURRENTLY_ON(BrowserThread::IO);
2401 GlobalRoutingID key(child_id, route_id); 2406 GlobalFrameRoutingID key(child_id, route_id);
2402 DCHECK(blocked_loaders_map_.find(key) == blocked_loaders_map_.end()) << 2407 DCHECK(blocked_loaders_map_.find(key) == blocked_loaders_map_.end())
2403 "BlockRequestsForRoute called multiple time for the same RVH"; 2408 << "BlockRequestsForFrame called multiple time for the same RVH";
2404 blocked_loaders_map_[key] = new BlockedLoadersList(); 2409 blocked_loaders_map_[key] = new BlockedLoadersList();
2405 } 2410 }
2406 2411
2407 void ResourceDispatcherHostImpl::ResumeBlockedRequestsForRoute(int child_id, 2412 void ResourceDispatcherHostImpl::ResumeBlockedRequestsForFrame(int child_id,
2408 int route_id) { 2413 int route_id) {
2409 ProcessBlockedRequestsForRoute(child_id, route_id, false); 2414 ProcessBlockedRequestsForFrame(child_id, route_id, false);
2410 } 2415 }
2411 2416
2412 void ResourceDispatcherHostImpl::CancelBlockedRequestsForRoute(int child_id, 2417 void ResourceDispatcherHostImpl::CancelBlockedRequestsForFrame(int child_id,
2413 int route_id) { 2418 int route_id) {
2414 ProcessBlockedRequestsForRoute(child_id, route_id, true); 2419 ProcessBlockedRequestsForFrame(child_id, route_id, true);
2415 } 2420 }
2416 2421
2417 void ResourceDispatcherHostImpl::ProcessBlockedRequestsForRoute( 2422 void ResourceDispatcherHostImpl::ProcessBlockedRequestsForFrame(
2418 int child_id, 2423 int child_id,
2419 int route_id, 2424 int route_id,
2420 bool cancel_requests) { 2425 bool cancel_requests) {
2421 BlockedLoadersMap::iterator iter = blocked_loaders_map_.find( 2426 BlockedLoadersMap::iterator iter =
2422 GlobalRoutingID(child_id, route_id)); 2427 blocked_loaders_map_.find(GlobalFrameRoutingID(child_id, route_id));
2423 if (iter == blocked_loaders_map_.end()) { 2428 if (iter == blocked_loaders_map_.end()) {
2424 // It's possible to reach here if the renderer crashed while an interstitial 2429 // It's possible to reach here if the renderer crashed while an interstitial
2425 // page was showing. 2430 // page was showing.
2426 return; 2431 return;
2427 } 2432 }
2428 2433
2429 BlockedLoadersList* loaders = iter->second; 2434 BlockedLoadersList* loaders = iter->second;
2430 2435
2431 // Removing the vector from the map unblocks any subsequent requests. 2436 // Removing the vector from the map unblocks any subsequent requests.
2432 blocked_loaders_map_.erase(iter); 2437 blocked_loaders_map_.erase(iter);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2531 load_flags |= net::LOAD_PREFETCH; 2536 load_flags |= net::LOAD_PREFETCH;
2532 } 2537 }
2533 2538
2534 if (is_sync_load) 2539 if (is_sync_load)
2535 load_flags |= net::LOAD_IGNORE_LIMITS; 2540 load_flags |= net::LOAD_IGNORE_LIMITS;
2536 2541
2537 return load_flags; 2542 return load_flags;
2538 } 2543 }
2539 2544
2540 } // namespace content 2545 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698