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/renderer_host/resource_dispatcher_host_impl.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 case ResourceType::PRERENDER: | 281 case ResourceType::PRERENDER: |
282 return net::IDLE; | 282 return net::IDLE; |
283 | 283 |
284 default: | 284 default: |
285 // When new resource types are added, their priority must be considered. | 285 // When new resource types are added, their priority must be considered. |
286 NOTREACHED(); | 286 NOTREACHED(); |
287 return net::LOW; | 287 return net::LOW; |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 void OnSwapOutACKHelper(int render_process_id, int render_view_id) { | 291 void OnSwapOutACKHelper(int render_process_id, int render_view_id, |
292 bool timed_out) { | |
Charlie Reis
2012/04/06 22:34:14
For method declarations that spill over, each argu
nasko
2012/04/10 00:16:37
Done.
Charlie Reis
2012/04/10 01:19:35
Almost. :) For method declarations (as opposed t
nasko
2012/04/10 14:31:26
Done.
| |
292 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID(render_process_id, | 293 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID(render_process_id, |
293 render_view_id); | 294 render_view_id); |
294 if (rvh) | 295 if (rvh) |
295 rvh->OnSwapOutACK(); | 296 rvh->OnSwapOutACK(timed_out); |
296 } | 297 } |
297 | 298 |
298 net::Error CallbackAndReturn( | 299 net::Error CallbackAndReturn( |
299 const DownloadResourceHandler::OnStartedCallback& started_cb, | 300 const DownloadResourceHandler::OnStartedCallback& started_cb, |
300 net::Error net_error) { | 301 net::Error net_error) { |
301 if (started_cb.is_null()) | 302 if (started_cb.is_null()) |
302 return net_error; | 303 return net_error; |
303 BrowserThread::PostTask( | 304 BrowserThread::PostTask( |
304 BrowserThread::UI, FROM_HERE, | 305 BrowserThread::UI, FROM_HERE, |
305 base::Bind(started_cb, content::DownloadId::Invalid(), net_error)); | 306 base::Bind(started_cb, content::DownloadId::Invalid(), net_error)); |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1076 ResourceType::SUB_RESOURCE, | 1077 ResourceType::SUB_RESOURCE, |
1077 PAGE_TRANSITION_LINK, | 1078 PAGE_TRANSITION_LINK, |
1078 0, // upload_size | 1079 0, // upload_size |
1079 download, // is_download | 1080 download, // is_download |
1080 download, // allow_download | 1081 download, // allow_download |
1081 false, // has_user_gesture | 1082 false, // has_user_gesture |
1082 WebKit::WebReferrerPolicyDefault, | 1083 WebKit::WebReferrerPolicyDefault, |
1083 context); | 1084 context); |
1084 } | 1085 } |
1085 | 1086 |
1087 | |
1086 void ResourceDispatcherHostImpl::OnSwapOutACK( | 1088 void ResourceDispatcherHostImpl::OnSwapOutACK( |
1089 const ViewMsg_SwapOut_Params& params) { | |
1090 OnSwapOutACKImpl(params, false); | |
1091 } | |
1092 | |
1093 void ResourceDispatcherHostImpl::OnSimulateSwapOutACK( | |
1087 const ViewMsg_SwapOut_Params& params) { | 1094 const ViewMsg_SwapOut_Params& params) { |
1095 OnSwapOutACKImpl(params, true); | |
Charlie Reis
2012/04/06 22:34:14
Let's add a comment saying that true means it's co
nasko
2012/04/10 00:16:37
Done.
| |
1096 } | |
1097 | |
1098 void ResourceDispatcherHostImpl::OnSwapOutACKImpl( | |
Charlie Reis
2012/04/06 22:34:14
nit: HandleSwapOutACK
nasko
2012/04/10 00:16:37
Done.
| |
1099 const ViewMsg_SwapOut_Params& params, bool timed_out) { | |
1088 // Closes for cross-site transitions are handled such that the cross-site | 1100 // Closes for cross-site transitions are handled such that the cross-site |
1089 // transition continues. | 1101 // transition continues. |
1090 GlobalRequestID global_id(params.new_render_process_host_id, | 1102 GlobalRequestID global_id(params.new_render_process_host_id, |
1091 params.new_request_id); | 1103 params.new_request_id); |
1092 PendingRequestList::iterator i = pending_requests_.find(global_id); | 1104 PendingRequestList::iterator i = pending_requests_.find(global_id); |
1093 if (i != pending_requests_.end()) { | 1105 if (i != pending_requests_.end()) { |
1094 // The response we were meant to resume could have already been canceled. | 1106 // The response we were meant to resume could have already been canceled. |
1095 ResourceRequestInfoImpl* info = | 1107 ResourceRequestInfoImpl* info = |
1096 ResourceRequestInfoImpl::ForRequest(i->second); | 1108 ResourceRequestInfoImpl::ForRequest(i->second); |
1097 if (info->cross_site_handler()) | 1109 if (info->cross_site_handler()) |
1098 info->cross_site_handler()->ResumeResponse(); | 1110 info->cross_site_handler()->ResumeResponse(); |
1099 } | 1111 } |
1100 // Update the RenderViewHost's internal state after the ACK. | 1112 // Update the RenderViewHost's internal state after the ACK. |
1101 BrowserThread::PostTask( | 1113 BrowserThread::PostTask( |
1102 BrowserThread::UI, | 1114 BrowserThread::UI, |
1103 FROM_HERE, | 1115 FROM_HERE, |
1104 base::Bind(&OnSwapOutACKHelper, | 1116 base::Bind(&OnSwapOutACKHelper, |
1105 params.closing_process_id, | 1117 params.closing_process_id, |
1106 params.closing_route_id)); | 1118 params.closing_route_id, |
1119 timed_out)); | |
1107 } | 1120 } |
1108 | 1121 |
1109 void ResourceDispatcherHostImpl::OnDidLoadResourceFromMemoryCache( | 1122 void ResourceDispatcherHostImpl::OnDidLoadResourceFromMemoryCache( |
1110 const GURL& url, | 1123 const GURL& url, |
1111 const std::string& security_info, | 1124 const std::string& security_info, |
1112 const std::string& http_method, | 1125 const std::string& http_method, |
1113 ResourceType::Type resource_type) { | 1126 ResourceType::Type resource_type) { |
1114 if (!url.is_valid() || !(url.SchemeIs("http") || url.SchemeIs("https"))) | 1127 if (!url.is_valid() || !(url.SchemeIs("http") || url.SchemeIs("https"))) |
1115 return; | 1128 return; |
1116 | 1129 |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2293 return allow_cross_origin_auth_prompt_; | 2306 return allow_cross_origin_auth_prompt_; |
2294 } | 2307 } |
2295 | 2308 |
2296 bool ResourceDispatcherHostImpl::IsTransferredNavigation( | 2309 bool ResourceDispatcherHostImpl::IsTransferredNavigation( |
2297 const GlobalRequestID& transferred_request_id) const { | 2310 const GlobalRequestID& transferred_request_id) const { |
2298 return transferred_navigations_.find(transferred_request_id) != | 2311 return transferred_navigations_.find(transferred_request_id) != |
2299 transferred_navigations_.end(); | 2312 transferred_navigations_.end(); |
2300 } | 2313 } |
2301 | 2314 |
2302 } // namespace content | 2315 } // namespace content |
OLD | NEW |