summaryrefslogtreecommitdiffstats
path: root/chrome/browser/render_widget_host.cc
diff options
context:
space:
mode:
authorojan@google.com <ojan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-29 23:32:47 +0000
committerojan@google.com <ojan@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-29 23:32:47 +0000
commitc82192d62ae8518837f448f9bbd9d0c93cd4af13 (patch)
tree795361f6bb6033caf55862386541c70e08b969be /chrome/browser/render_widget_host.cc
parent9a2bba4ed0996b8bc9f8dab235ad83af3f155948 (diff)
downloadchromium_src-c82192d62ae8518837f448f9bbd9d0c93cd4af13.zip
chromium_src-c82192d62ae8518837f448f9bbd9d0c93cd4af13.tar.gz
chromium_src-c82192d62ae8518837f448f9bbd9d0c93cd4af13.tar.bz2
Fix not closing the browser with hung, crashed and interstitial tabs. Adds a 1 second hang monitor for the beforeunload/unload events to fire.
BUG=1296059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/render_widget_host.cc')
-rw-r--r--chrome/browser/render_widget_host.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/chrome/browser/render_widget_host.cc b/chrome/browser/render_widget_host.cc
index bfcce2a..2415925 100644
--- a/chrome/browser/render_widget_host.cc
+++ b/chrome/browser/render_widget_host.cc
@@ -338,8 +338,7 @@ void RenderWidgetHost::OnMsgInputEventAck(const IPC::Message& message) {
UMA_HISTOGRAM_TIMES(L"MPArch.RWH_InputEventDelta", delta);
// Cancel pending hung renderer checks since the renderer is responsive.
- ResetHangMonitorTimeout();
- RendererIsResponsive();
+ StopHangMonitorTimeout();
void* iter = NULL;
int type = 0;
@@ -396,8 +395,7 @@ void RenderWidgetHost::WasHidden() {
is_hidden_ = true;
// Don't bother reporting hung state when we aren't the active tab.
- ResetHangMonitorTimeout();
- RendererIsResponsive();
+ StopHangMonitorTimeout();
// If we have a renderer, then inform it that we are being hidden so it can
// reduce its resource utilization.
@@ -499,9 +497,7 @@ void RenderWidgetHost::ForwardInputEvent(const WebInputEvent& input_event,
// any input event cancels a pending mouse move event
next_mouse_move_.reset();
- MessageLoop::current()->PostDelayedTask(FROM_HERE,
- hung_renderer_factory_.NewRunnableMethod(
- &RenderWidgetHost::RendererIsUnresponsive), kHungRendererDelayMs);
+ StartHangMonitorTimeout(kHungRendererDelayMs);
}
void RenderWidgetHost::Shutdown() {
@@ -694,6 +690,18 @@ void RenderWidgetHost::ScrollRect(HANDLE bitmap, const gfx::Rect& bitmap_rect,
}
}
-void RenderWidgetHost::ResetHangMonitorTimeout() {
+void RenderWidgetHost::RestartHangMonitorTimeout() {
+ hung_renderer_factory_.RevokeAll();
+ StartHangMonitorTimeout(kHungRendererDelayMs);
+}
+
+void RenderWidgetHost::StopHangMonitorTimeout() {
hung_renderer_factory_.RevokeAll();
+ RendererIsResponsive();
+}
+
+void RenderWidgetHost::StartHangMonitorTimeout(int delay) {
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ hung_renderer_factory_.NewRunnableMethod(
+ &RenderWidgetHost::RendererIsUnresponsive), delay);
}