Backed out changeset 4887f7d34df2 (bug 896896) for causing bug 933733. a=lsblakk

This commit is contained in:
Nicholas Cameron 2013-11-11 13:59:45 -05:00
parent 200cfba6b0
commit a9d30ba1fc
3 changed files with 1 additions and 36 deletions

View File

@ -263,28 +263,6 @@ WinUtils::GetMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,
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,

View File

@ -95,19 +95,6 @@ public:
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.
*

View File

@ -282,7 +282,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
} else if (mayWait) {
// Block and wait for any posted application message
mozilla::HangMonitor::Suspend();
WinUtils::WaitForMessage();
::WaitMessage();
}
} while (!gotMessage && mayWait);