Backed out changeset 4887f7d34df2 (bug 896896) for causing bug 933733. a=lsblakk
authorNicholas Cameron <ncameron@mozilla.com>
Mon, 11 Nov 2013 13:59:45 -0500
changeset 176338 6ab352514ce1822bb34744b8071ce9f917e0bcfa
parent 176337 fb3a5c0013689dd681cfd477ffaf975baddc9834
child 176339 b24e6c62e64a18ff8e410bbd0ee41bb5cbe983fa
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsblakk
bugs896896, 933733
milestone28.0
backs out4887f7d34df23cc6d575b0c609cc6e00ada88bd5
Backed out changeset 4887f7d34df2 (bug 896896) for causing bug 933733. a=lsblakk
widget/windows/WinUtils.cpp
widget/windows/WinUtils.h
widget/windows/nsAppShell.cpp
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -259,38 +259,16 @@ WinUtils::GetMessage(LPMSG aMsg, HWND aW
     NS_ENSURE_TRUE(SUCCEEDED(hr), false);
     return ret;
   }
 #endif // #ifdef NS_ENABLE_TSF
   return ::GetMessageW(aMsg, aWnd, aFirstMessage, aLastMessage);
 }
 
 /* static */
-void
-WinUtils::WaitForMessage()
-{
-  DWORD result = ::MsgWaitForMultipleObjectsEx(0, nullptr, INFINITE, QS_ALLINPUT,
-                                               MWMO_INPUTAVAILABLE);
-  NS_WARN_IF_FALSE(result != WAIT_FAILED, "Wait failed");
-
-  // This idiom is taken from the Chromium ipc code, see
-  // ipc/chromium/src/base/message+puimp_win.cpp:270.
-  // The intent is to avoid a busy wait when MsgWaitForMultipleObjectsEx
-  // returns quickly but PeekMessage would not return a message.
-  if (result == WAIT_OBJECT_0) {
-    MSG msg = {0};
-    DWORD queue_status = ::GetQueueStatus(QS_MOUSE);
-    if (HIWORD(queue_status) & QS_MOUSE &&
-        !PeekMessage(&msg, nullptr, WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE)) {
-      ::WaitMessage();
-    }
-  }
-}
-
-/* static */
 bool
 WinUtils::GetRegistryKey(HKEY aRoot,
                          char16ptr_t aKeyName,
                          char16ptr_t aValueName,
                          wchar_t* aBuffer,
                          DWORD aBufferLength)
 {
   NS_PRECONDITION(aKeyName, "The key name is NULL");
--- a/widget/windows/WinUtils.h
+++ b/widget/windows/WinUtils.h
@@ -90,29 +90,16 @@ public:
    * GetMessageW(), ITfMessageMgr::PeekMessageW() and
    * ITfMessageMgr::GetMessageW().
    * Don't call the native APIs directly.  You MUST use these methods instead.
    */
   static bool PeekMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,
                           UINT aLastMessage, UINT aOption);
   static bool GetMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,
                          UINT aLastMessage);
-
-  /**
-   * Wait until a message is ready to be processed.
-   * Prefer using this method to directly calling ::WaitMessage since
-   * ::WaitMessage will wait if there is an unread message in the queue.
-   * That can cause freezes until another message enters the queue if the
-   * message is marked read by a call to PeekMessage which the caller is
-   * not aware of (e.g., from a different thread).
-   * Note that this method may cause sync dispatch of sent (as opposed to
-   * posted) messages.
-   */
-  static void WaitForMessage();
-
   /**
    * Gets the value of a string-typed registry value.
    *
    * @param aRoot The registry root to search in.
    * @param aKeyName The name of the registry key to open.
    * @param aValueName The name of the registry value in the specified key whose
    *   value is to be retrieved.  Can be null, to retrieve the key's unnamed/
    *   default value.
--- a/widget/windows/nsAppShell.cpp
+++ b/widget/windows/nsAppShell.cpp
@@ -223,17 +223,17 @@ nsAppShell::ProcessNextNativeEvent(bool 
         }
 
         ::TranslateMessage(&msg);
         ::DispatchMessageW(&msg);
       }
     } else if (mayWait) {
       // Block and wait for any posted application message
       mozilla::HangMonitor::Suspend();
-      WinUtils::WaitForMessage();
+      ::WaitMessage();
     }
   } while (!gotMessage && mayWait);
 
   // See DoProcessNextNativeEvent, mEventloopNestingLevel will be
   // one when a modal loop unwinds.
   if (mNativeCallbackPending && mEventloopNestingLevel == 1)
     DoProcessMoreGeckoEvents();