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

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

Issue 88503002: Have the unload event execute in background on cross-site navigations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 70db572f395d4ff160a8fb0e1789a41a9dc71061..6b2185e0fb1b45115f42d49c46aa8507396beb66 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -102,6 +102,12 @@ namespace {
// fire.
const int kUnloadTimeoutMS = 1000;
+// Delay to wait on closing the WebContents for an unload/handler to fire when
+// swapping renderers. The old renderer will allways be sent to the background
Charlie Reis 2013/11/26 19:35:00 nit: always As Ojan wondered, have you checked wh
+// since the unload handler cannot show dialogues.
+// http://crbug.com/323528.
+const int kUnloadSwapTimeoutMS = 0;
+
// Translate a WebKit text direction into a base::i18n one.
base::i18n::TextDirection WebTextDirectionToChromeTextDirection(
blink::WebTextDirection dir) {
@@ -694,14 +700,15 @@ void RenderViewHostImpl::SwapOut() {
// This will be set back to false in OnSwapOutACK, just before we replace
// this RVH with the pending RVH.
is_waiting_for_unload_ack_ = true;
- // Start the hang monitor in case the renderer hangs in the unload handler.
- // Increment the in-flight event count, to ensure that input events won't
- // cancel the timeout timer.
- increment_in_flight_event_count();
- StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
if (IsRenderViewLive()) {
Send(new ViewMsg_SwapOut(GetRoutingID()));
+ // The hang monitor will immediately time out, which will cause the old
+ // renderer to go execute the unload event in the background. The swap out
+ // can then proceed without any delay.
+ // http://crbug.com/323528.
+ increment_in_flight_event_count();
+ StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadSwapTimeoutMS));
Charlie Reis 2013/11/26 19:35:00 Moving these calls inside the if seems like a prob
} else {
// This RenderViewHost doesn't have a live renderer, so just skip the unload
// event.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698