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

Unified Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 159255: Fix a race condition where rapid back/forward clicks could close a tab... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/render_view_host.cc
===================================================================
--- chrome/browser/renderer_host/render_view_host.cc (revision 21465)
+++ chrome/browser/renderer_host/render_view_host.cc (working copy)
@@ -320,44 +320,37 @@
}
}
-void RenderViewHost::FirePageUnload() {
- ClosePage(process()->pid(), routing_id());
-}
-
-// static
-void RenderViewHost::ClosePageIgnoringUnloadEvents(int render_process_host_id,
- int request_id) {
- RenderViewHost* rvh = RenderViewHost::FromID(render_process_host_id,
- request_id);
- if (!rvh)
- return;
-
- rvh->StopHangMonitorTimeout();
- rvh->is_waiting_for_unload_ack_ = false;
-
- rvh->set_sudden_termination_allowed(true);
- rvh->delegate()->Close(rvh);
-}
-
-void RenderViewHost::ClosePage(int new_render_process_host_id,
+void RenderViewHost::ClosePage(bool for_cross_site_transition,
+ int new_render_process_host_id,
int new_request_id) {
// Start the hang monitor in case the renderer hangs in the unload handler.
is_waiting_for_unload_ack_ = true;
StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
+ ViewMsg_ClosePage_Params params;
+ params.closing_process_id = process()->pid();
+ params.closing_route_id = routing_id();
+ params.for_cross_site_transition = for_cross_site_transition;
+ params.new_render_process_host_id = new_render_process_host_id;
+ params.new_request_id = new_request_id;
if (IsRenderViewLive()) {
- Send(new ViewMsg_ClosePage(routing_id(),
- new_render_process_host_id,
- new_request_id));
+ Send(new ViewMsg_ClosePage(routing_id(), params));
} else {
// This RenderViewHost doesn't have a live renderer, so just skip closing
// the page. We must notify the ResourceDispatcherHost on the IO thread,
// which we will do through the RenderProcessHost's widget helper.
- process()->CrossSiteClosePageACK(new_render_process_host_id,
- new_request_id);
+ process()->CrossSiteClosePageACK(params);
}
}
+void RenderViewHost::ClosePageIgnoringUnloadEvents() {
+ StopHangMonitorTimeout();
+ is_waiting_for_unload_ack_ = false;
+
+ sudden_termination_allowed_ = true;
+ delegate_->Close(this);
+}
+
void RenderViewHost::SetHasPendingCrossSiteRequest(bool has_pending_request,
int request_id) {
Singleton<CrossSiteRequestManager>()->SetHasPendingCrossSiteRequest(
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.h ('k') | chrome/browser/renderer_host/render_widget_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698