From 40c57cd5b386a0db5b1e5108c429a6f789373605 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Fri, 20 Dec 2013 07:51:13 -0800 Subject: [PATCH 1/2] Bug 952324 - Don't block native events for more than 50ms [r=jimm] --- widget/windows/winrt/MetroAppShell.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/widget/windows/winrt/MetroAppShell.cpp b/widget/windows/winrt/MetroAppShell.cpp index 9a0e53acd6a8..15937c9d117e 100644 --- a/widget/windows/winrt/MetroAppShell.cpp +++ b/widget/windows/winrt/MetroAppShell.cpp @@ -12,6 +12,7 @@ #include "nsIObserverService.h" #include "nsServiceManagerUtils.h" #include "mozilla/AutoRestore.h" +#include "mozilla/TimeStamp.h" #include "WinUtils.h" #include "nsIAppStartup.h" #include "nsToolkitCompsCID.h" @@ -49,6 +50,7 @@ static ComPtr sCoreStatic; static bool sIsDispatching = false; static bool sShouldPurgeThreadQueue = false; static bool sBlockNativeEvents = false; +static TimeStamp sPurgeThreadQueueStart; MetroAppShell::~MetroAppShell() { @@ -283,6 +285,7 @@ MetroAppShell::DispatchAllGeckoEvents() NS_ASSERTION(NS_IsMainThread(), "DispatchAllGeckoEvents should be called on the main thread"); sShouldPurgeThreadQueue = false; + sPurgeThreadQueueStart = TimeStamp::Now(); sBlockNativeEvents = true; nsIThread *thread = NS_GetCurrentThread(); @@ -335,13 +338,17 @@ MetroAppShell::ProcessOneNativeEventIfPresent() bool MetroAppShell::ProcessNextNativeEvent(bool mayWait) { - // NS_ProcessPendingEvents will process thread events *and* call - // nsBaseAppShell::OnProcessNextEvent to process native events. However - // we do not want native events getting dispatched while we are trying + // NS_ProcessPendingEvents will process thread events *and* call + // nsBaseAppShell::OnProcessNextEvent to process native events. However + // we do not want native events getting dispatched while we are trying // to dispatch pending input in DispatchAllGeckoEvents since a native // event may be a UIA Automation call coming in to check focus. if (sBlockNativeEvents) { - return false; + if ((TimeStamp::Now() - sPurgeThreadQueueStart).ToMilliseconds() + < PURGE_MAX_TIMEOUT) { + return false; + } + sBlockNativeEvents = false; } if (ProcessOneNativeEventIfPresent()) { From 4a1fbf06b02060acfa849328330b77023ac9f953 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Fri, 20 Dec 2013 07:58:12 -0800 Subject: [PATCH 2/2] Bug 878935 followup - touch CLOBBER file to clean up bustage --- CLOBBER | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLOBBER b/CLOBBER index 8e6beba9f279..93aece62ddc3 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 932982 apparently requires a clobber or else we get B2G mochitest-2 failures. +Bug 878935 landed without a UUID change (and was since backed out)