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

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

Issue 2384813002: Don't wait to close tabs waiting for JavaScript dialogs. (Closed)
Patch Set: fix Created 4 years, 2 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_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 666eb2928624addf63257443bac06471965721c4..17c42b5d38ee991b683b2ec9a1ad4d23be8c558b 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -907,12 +907,24 @@ void RenderWidgetHostImpl::StartHangMonitorTimeout(
RenderWidgetHostDelegate::RendererUnresponsiveType hang_monitor_reason) {
if (!hang_monitor_timeout_)
return;
- hang_monitor_timeout_->Start(delay);
+
hang_monitor_reason_ = hang_monitor_reason;
+
+ // If the renderer is known to be unresponsive, don't bother waiting for it.
+ if (known_unresponsive_renderer_count_ > 0)
+ hang_monitor_timeout_->Start(base::TimeDelta());
+ else
+ hang_monitor_timeout_->Start(delay);
}
void RenderWidgetHostImpl::RestartHangMonitorTimeout() {
- if (hang_monitor_timeout_)
+ if (!hang_monitor_timeout_)
+ return;
+
+ // If the renderer is known to be unresponsive, don't bother waiting for it.
+ if (known_unresponsive_renderer_count_ > 0)
+ hang_monitor_timeout_->Restart(base::TimeDelta());
+ else
hang_monitor_timeout_->Restart(hung_renderer_delay_);
}
@@ -930,6 +942,12 @@ void RenderWidgetHostImpl::StopHangMonitorTimeout() {
RendererIsResponsive();
}
+void RenderWidgetHostImpl::SetHangMonitorKnownUnresponsive(bool unresponsive) {
+ int count = unresponsive ? 1 : -1;
+ known_unresponsive_renderer_count_ += count;
+ DCHECK_GE(known_unresponsive_renderer_count_, 0);
+}
+
void RenderWidgetHostImpl::StartNewContentRenderingTimeout() {
// It is possible for a compositor frame to arrive before the browser is
// notified about the page being committed, in which case no timer is

Powered by Google App Engine
This is Rietveld 408576698