diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-06-02 10:15:40 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-06-02 08:41:08 +0000 |
commit | b92421879c003a0857b2074f7e05b3bbbb326569 (patch) | |
tree | bdfd21ad74690ae4069e4a055191844994027b78 /chromium/base/message_loop | |
parent | 980b784afe75be22158126ac6a639c19459d3427 (diff) | |
download | qtwebengine-chromium-b92421879c003a0857b2074f7e05b3bbbb326569.tar.gz |
BASELINE: Update Chromium to 51.0.2704.79
Also adds a few files for url_parsing in extensions.
Change-Id: Ie4820c3da75f0a56b3cc86dccc077d671227077b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'chromium/base/message_loop')
-rw-r--r-- | chromium/base/message_loop/message_pump_win.cc | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/chromium/base/message_loop/message_pump_win.cc b/chromium/base/message_loop/message_pump_win.cc index 04e76e8b4c0..bf5675ddc17 100644 --- a/chromium/base/message_loop/message_pump_win.cc +++ b/chromium/base/message_loop/message_pump_win.cc @@ -214,37 +214,46 @@ void MessagePumpForUI::InitMessageWnd() { void MessagePumpForUI::WaitForWork() { // Wait until a message is available, up to the time needed by the timer // manager to fire the next set of timers. - int delay = GetCurrentDelay(); - if (delay < 0) // Negative value means no timers waiting. - delay = INFINITE; - - DWORD result; - result = MsgWaitForMultipleObjectsEx(0, NULL, delay, QS_ALLINPUT, - MWMO_INPUTAVAILABLE); - - if (WAIT_OBJECT_0 == result) { - // A WM_* message is available. - // If a parent child relationship exists between windows across threads - // then their thread inputs are implicitly attached. - // This causes the MsgWaitForMultipleObjectsEx API to return indicating - // that messages are ready for processing (Specifically, mouse messages - // intended for the child window may appear if the child window has - // capture). - // The subsequent PeekMessages call may fail to return any messages thus - // causing us to enter a tight loop at times. - // The WaitMessage call below is a workaround to give the child window - // some time to process its input messages. - MSG msg = {0}; - bool has_pending_sent_message = - (HIWORD(GetQueueStatus(QS_SENDMESSAGE)) & QS_SENDMESSAGE) != 0; - if (!has_pending_sent_message && - !PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { - WaitMessage(); + int delay; + DWORD wait_flags = MWMO_INPUTAVAILABLE; + + while ((delay = GetCurrentDelay()) != 0) { + if (delay < 0) // Negative value means no timers waiting. + delay = INFINITE; + + DWORD result = + MsgWaitForMultipleObjectsEx(0, NULL, delay, QS_ALLINPUT, wait_flags); + + if (WAIT_OBJECT_0 == result) { + // A WM_* message is available. + // If a parent child relationship exists between windows across threads + // then their thread inputs are implicitly attached. + // This causes the MsgWaitForMultipleObjectsEx API to return indicating + // that messages are ready for processing (Specifically, mouse messages + // intended for the child window may appear if the child window has + // capture). + // The subsequent PeekMessages call may fail to return any messages thus + // causing us to enter a tight loop at times. + // The code below is a workaround to give the child window + // some time to process its input messages by looping back to + // MsgWaitForMultipleObjectsEx above when there are no messages for the + // current thread. + MSG msg = {0}; + bool has_pending_sent_message = + (HIWORD(GetQueueStatus(QS_SENDMESSAGE)) & QS_SENDMESSAGE) != 0; + if (has_pending_sent_message || + PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { + return; + } + + // We know there are no more messages for this thread because PeekMessage + // has returned false. Reset |wait_flags| so that we wait for a *new* + // message. + wait_flags = 0; } - return; - } - DCHECK_NE(WAIT_FAILED, result) << GetLastError(); + DCHECK_NE(WAIT_FAILED, result) << GetLastError(); + } } void MessagePumpForUI::HandleWorkMessage() { |