| 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 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 IncrementOutstandingRequestsMemory(-1, *info); | 1175 IncrementOutstandingRequestsMemory(-1, *info); |
| 1176 bool should_update_count = info->counted_as_in_flight_request(); | 1176 bool should_update_count = info->counted_as_in_flight_request(); |
| 1177 if (should_update_count) | 1177 if (should_update_count) |
| 1178 IncrementOutstandingRequestsCount(-1, info); | 1178 IncrementOutstandingRequestsCount(-1, info); |
| 1179 pending_loaders_.erase(old_request_id); | 1179 pending_loaders_.erase(old_request_id); |
| 1180 | 1180 |
| 1181 // ResourceHandlers should always get state related to the request from the | 1181 // ResourceHandlers should always get state related to the request from the |
| 1182 // ResourceRequestInfo rather than caching it locally. This lets us update | 1182 // ResourceRequestInfo rather than caching it locally. This lets us update |
| 1183 // the info object when a transfer occurs. | 1183 // the info object when a transfer occurs. |
| 1184 info->UpdateForTransfer(child_id, route_id, request_data.origin_pid, | 1184 info->UpdateForTransfer(child_id, route_id, request_data.origin_pid, |
| 1185 request_id, request_data.parent_render_frame_id, | 1185 request_id, filter_->GetWeakPtr()); |
| 1186 filter_->GetWeakPtr()); | |
| 1187 | 1186 |
| 1188 // Update maps that used the old IDs, if necessary. Some transfers in tests | 1187 // Update maps that used the old IDs, if necessary. Some transfers in tests |
| 1189 // do not actually use a different ID, so not all maps need to be updated. | 1188 // do not actually use a different ID, so not all maps need to be updated. |
| 1190 pending_loaders_[new_request_id] = loader; | 1189 pending_loaders_[new_request_id] = loader; |
| 1191 IncrementOutstandingRequestsMemory(1, *info); | 1190 IncrementOutstandingRequestsMemory(1, *info); |
| 1192 if (should_update_count) | 1191 if (should_update_count) |
| 1193 IncrementOutstandingRequestsCount(1, info); | 1192 IncrementOutstandingRequestsCount(1, info); |
| 1194 if (old_routing_id != new_routing_id) { | 1193 if (old_routing_id != new_routing_id) { |
| 1195 if (blocked_loaders_map_.find(old_routing_id) != | 1194 if (blocked_loaders_map_.find(old_routing_id) != |
| 1196 blocked_loaders_map_.end()) { | 1195 blocked_loaders_map_.end()) { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 | 1406 |
| 1408 // Make extra info and read footer (contains request ID). | 1407 // Make extra info and read footer (contains request ID). |
| 1409 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( | 1408 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( |
| 1410 process_type, child_id, route_id, | 1409 process_type, child_id, route_id, |
| 1411 -1, // frame_tree_node_id | 1410 -1, // frame_tree_node_id |
| 1412 request_data.origin_pid, | 1411 request_data.origin_pid, |
| 1413 request_id, | 1412 request_id, |
| 1414 request_data.render_frame_id, | 1413 request_data.render_frame_id, |
| 1415 request_data.is_main_frame, | 1414 request_data.is_main_frame, |
| 1416 request_data.parent_is_main_frame, | 1415 request_data.parent_is_main_frame, |
| 1417 request_data.parent_render_frame_id, | |
| 1418 request_data.resource_type, | 1416 request_data.resource_type, |
| 1419 request_data.transition_type, | 1417 request_data.transition_type, |
| 1420 request_data.should_replace_current_entry, | 1418 request_data.should_replace_current_entry, |
| 1421 false, // is download | 1419 false, // is download |
| 1422 false, // is stream | 1420 false, // is stream |
| 1423 allow_download, | 1421 allow_download, |
| 1424 request_data.has_user_gesture, | 1422 request_data.has_user_gesture, |
| 1425 request_data.enable_load_timing, | 1423 request_data.enable_load_timing, |
| 1426 request_data.enable_upload_progress, | 1424 request_data.enable_upload_progress, |
| 1427 do_not_prompt_for_login, | 1425 do_not_prompt_for_login, |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 return new ResourceRequestInfoImpl( | 1703 return new ResourceRequestInfoImpl( |
| 1706 PROCESS_TYPE_RENDERER, | 1704 PROCESS_TYPE_RENDERER, |
| 1707 child_id, | 1705 child_id, |
| 1708 render_view_route_id, | 1706 render_view_route_id, |
| 1709 -1, // frame_tree_node_id | 1707 -1, // frame_tree_node_id |
| 1710 0, | 1708 0, |
| 1711 request_id_, | 1709 request_id_, |
| 1712 render_frame_route_id, | 1710 render_frame_route_id, |
| 1713 false, // is_main_frame | 1711 false, // is_main_frame |
| 1714 false, // parent_is_main_frame | 1712 false, // parent_is_main_frame |
| 1715 -1, // parent_render_frame_id | |
| 1716 RESOURCE_TYPE_SUB_RESOURCE, | 1713 RESOURCE_TYPE_SUB_RESOURCE, |
| 1717 ui::PAGE_TRANSITION_LINK, | 1714 ui::PAGE_TRANSITION_LINK, |
| 1718 false, // should_replace_current_entry | 1715 false, // should_replace_current_entry |
| 1719 download, // is_download | 1716 download, // is_download |
| 1720 false, // is_stream | 1717 false, // is_stream |
| 1721 download, // allow_download | 1718 download, // allow_download |
| 1722 false, // has_user_gesture | 1719 false, // has_user_gesture |
| 1723 false, // enable_load_timing | 1720 false, // enable_load_timing |
| 1724 false, // enable_upload_progress | 1721 false, // enable_upload_progress |
| 1725 false, // do_not_prompt_for_login | 1722 false, // do_not_prompt_for_login |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 // that IO thread -> UI thread hops will work. | 2142 // that IO thread -> UI thread hops will work. |
| 2146 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( | 2143 ResourceRequestInfoImpl* extra_info = new ResourceRequestInfoImpl( |
| 2147 PROCESS_TYPE_BROWSER, | 2144 PROCESS_TYPE_BROWSER, |
| 2148 -1, // child_id | 2145 -1, // child_id |
| 2149 -1, // route_id | 2146 -1, // route_id |
| 2150 info.frame_tree_node_id, | 2147 info.frame_tree_node_id, |
| 2151 -1, // request_data.origin_pid, | 2148 -1, // request_data.origin_pid, |
| 2152 request_id_, | 2149 request_id_, |
| 2153 -1, // request_data.render_frame_id, | 2150 -1, // request_data.render_frame_id, |
| 2154 info.is_main_frame, info.parent_is_main_frame, | 2151 info.is_main_frame, info.parent_is_main_frame, |
| 2155 -1, // request_data.parent_render_frame_id, | |
| 2156 resource_type, info.common_params.transition, | 2152 resource_type, info.common_params.transition, |
| 2157 // should_replace_current_entry. This was only maintained at layer for | 2153 // should_replace_current_entry. This was only maintained at layer for |
| 2158 // request transfers and isn't needed for browser-side navigations. | 2154 // request transfers and isn't needed for browser-side navigations. |
| 2159 false, | 2155 false, |
| 2160 false, // is download | 2156 false, // is download |
| 2161 false, // is stream | 2157 false, // is stream |
| 2162 info.common_params.allow_download, info.begin_params.has_user_gesture, | 2158 info.common_params.allow_download, info.begin_params.has_user_gesture, |
| 2163 true, // enable_load_timing | 2159 true, // enable_load_timing |
| 2164 false, // enable_upload_progress | 2160 false, // enable_upload_progress |
| 2165 false, // do_not_prompt_for_login | 2161 false, // do_not_prompt_for_login |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2536 load_flags |= net::LOAD_PREFETCH; | 2532 load_flags |= net::LOAD_PREFETCH; |
| 2537 } | 2533 } |
| 2538 | 2534 |
| 2539 if (is_sync_load) | 2535 if (is_sync_load) |
| 2540 load_flags |= net::LOAD_IGNORE_LIMITS; | 2536 load_flags |= net::LOAD_IGNORE_LIMITS; |
| 2541 | 2537 |
| 2542 return load_flags; | 2538 return load_flags; |
| 2543 } | 2539 } |
| 2544 | 2540 |
| 2545 } // namespace content | 2541 } // namespace content |
| OLD | NEW |