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

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

Issue 10008015: Fixing a problem, where a hung renderer process is not killed when navigating away (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes based on feedback and new test Created 8 years, 8 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 | Annotate | Revision Log
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/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
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) {
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
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 HandleSwapOutACK(params, false);
1091 }
1092
1093 void ResourceDispatcherHostImpl::OnSimulateSwapOutACK(
1087 const ViewMsg_SwapOut_Params& params) { 1094 const ViewMsg_SwapOut_Params& params) {
1095 // Call the real implementation with true, which means that we timed out.
1096 HandleSwapOutACK(params, true);
1097 }
1098
1099 void ResourceDispatcherHostImpl::HandleSwapOutACK(
1100 const ViewMsg_SwapOut_Params& params, bool timed_out) {
1088 // Closes for cross-site transitions are handled such that the cross-site 1101 // Closes for cross-site transitions are handled such that the cross-site
1089 // transition continues. 1102 // transition continues.
1090 GlobalRequestID global_id(params.new_render_process_host_id, 1103 GlobalRequestID global_id(params.new_render_process_host_id,
1091 params.new_request_id); 1104 params.new_request_id);
1092 PendingRequestList::iterator i = pending_requests_.find(global_id); 1105 PendingRequestList::iterator i = pending_requests_.find(global_id);
1093 if (i != pending_requests_.end()) { 1106 if (i != pending_requests_.end()) {
1094 // The response we were meant to resume could have already been canceled. 1107 // The response we were meant to resume could have already been canceled.
1095 ResourceRequestInfoImpl* info = 1108 ResourceRequestInfoImpl* info =
1096 ResourceRequestInfoImpl::ForRequest(i->second); 1109 ResourceRequestInfoImpl::ForRequest(i->second);
1097 if (info->cross_site_handler()) 1110 if (info->cross_site_handler())
1098 info->cross_site_handler()->ResumeResponse(); 1111 info->cross_site_handler()->ResumeResponse();
1099 } 1112 }
1100 // Update the RenderViewHost's internal state after the ACK. 1113 // Update the RenderViewHost's internal state after the ACK.
1101 BrowserThread::PostTask( 1114 BrowserThread::PostTask(
1102 BrowserThread::UI, 1115 BrowserThread::UI,
1103 FROM_HERE, 1116 FROM_HERE,
1104 base::Bind(&OnSwapOutACKHelper, 1117 base::Bind(&OnSwapOutACKHelper,
1105 params.closing_process_id, 1118 params.closing_process_id,
1106 params.closing_route_id)); 1119 params.closing_route_id,
1120 timed_out));
1107 } 1121 }
1108 1122
1109 void ResourceDispatcherHostImpl::OnDidLoadResourceFromMemoryCache( 1123 void ResourceDispatcherHostImpl::OnDidLoadResourceFromMemoryCache(
1110 const GURL& url, 1124 const GURL& url,
1111 const std::string& security_info, 1125 const std::string& security_info,
1112 const std::string& http_method, 1126 const std::string& http_method,
1113 ResourceType::Type resource_type) { 1127 ResourceType::Type resource_type) {
1114 if (!url.is_valid() || !(url.SchemeIs("http") || url.SchemeIs("https"))) 1128 if (!url.is_valid() || !(url.SchemeIs("http") || url.SchemeIs("https")))
1115 return; 1129 return;
1116 1130
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2293 return allow_cross_origin_auth_prompt_; 2307 return allow_cross_origin_auth_prompt_;
2294 } 2308 }
2295 2309
2296 bool ResourceDispatcherHostImpl::IsTransferredNavigation( 2310 bool ResourceDispatcherHostImpl::IsTransferredNavigation(
2297 const GlobalRequestID& transferred_request_id) const { 2311 const GlobalRequestID& transferred_request_id) const {
2298 return transferred_navigations_.find(transferred_request_id) != 2312 return transferred_navigations_.find(transferred_request_id) !=
2299 transferred_navigations_.end(); 2313 transferred_navigations_.end();
2300 } 2314 }
2301 2315
2302 } // namespace content 2316 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698