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

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

Issue 6777002: Merge 79440 - Clean up unload-related state after the ack is received. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/696/src/
Patch Set: Created 9 years, 9 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: content/browser/renderer_host/render_view_host.cc
===================================================================
--- content/browser/renderer_host/render_view_host.cc (revision 79779)
+++ content/browser/renderer_host/render_view_host.cc (working copy)
@@ -287,8 +287,9 @@
void RenderViewHost::ClosePage(bool for_cross_site_transition,
int new_render_process_host_id,
int new_request_id) {
- // In most cases, this will not be set to false afterward. Either the tab
- // will be closed, or a pending RenderViewHost will replace this one.
+ // This will be set back to false in OnClosePageACK, just before we close the
+ // tab or replace it with a pending RVH. There are some cases (such as 204
+ // errors) where we'll continue to show this RVH.
is_waiting_for_unload_ack_ = true;
// Start the hang monitor in case the renderer hangs in the unload handler.
StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
@@ -314,6 +315,18 @@
}
}
+void RenderViewHost::OnClosePageACK(bool for_cross_site_transition) {
+ StopHangMonitorTimeout();
+ is_waiting_for_unload_ack_ = false;
+
+ // If this ClosePageACK is not for a cross-site transition, then it is for an
+ // attempt to close the tab. We have now finished the unload handler and can
+ // proceed with closing the tab.
+ if (!for_cross_site_transition) {
+ ClosePageIgnoringUnloadEvents();
+ }
+}
+
void RenderViewHost::ClosePageIgnoringUnloadEvents() {
StopHangMonitorTimeout();
is_waiting_for_beforeunload_ack_ = false;

Powered by Google App Engine
This is Rietveld 408576698