From: Cheng Zhao Date: Fri, 9 May 2014 03:26:13 +0000 (+0800) Subject: Do not override pending unresponsive counter. X-Git-Tag: v0.12.4~8^2~3 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=146ce284dede67968b57eb84d6b14fde8786667e;p=electron.git Do not override pending unresponsive counter. --- diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index f7f069ac..e8877ff7 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -457,8 +457,12 @@ bool NativeWindow::IsPopupOrPanel(const content::WebContents* source) const { void NativeWindow::RendererUnresponsive(content::WebContents* source) { // Schedule the unresponsive shortly later, since we may receive the - // responsive event soon. - // This could happen after the whole application had blocked for a while. + // responsive event soon. This could happen after the whole application had + // blocked for a while. + // Also notice that when closing this event would be ignored because we have + // explicity started a close timeout counter. This is on purpose because we + // don't want the unresponsive event to be sent too early when user is closing + // the window. ScheduleUnresponsiveEvent(50); } @@ -556,6 +560,9 @@ void NativeWindow::DevToolsAppendToFile(const std::string& url, } void NativeWindow::ScheduleUnresponsiveEvent(int ms) { + if (!window_unresposive_closure_.IsCancelled()) + return; + window_unresposive_closure_.Reset( base::Bind(&NativeWindow::NotifyWindowUnresponsive, weak_factory_.GetWeakPtr()));