Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Issue 1222013004: Revert of Don't peek messages in the MessagePumpForUI class when we receive our kMsgHaveWork message. (Closed)

Created:
5 years, 5 months ago by jbauman
Modified:
5 years, 5 months ago
CC:
chromium-reviews, jam, erikwright+watch_chromium.org, sadrul, piman+watch_chromium.org, darin-cc_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Revert of Don't peek messages in the MessagePumpForUI class when we receive our kMsgHaveWork message. (patchset #2 id:20001 of https://codereview.chromium.org/1194673004/) Reason for revert: Causes one 1 task to run per 3 ms when in a nested modal loop, which causes resize to lag behind. BUG=505612 Original issue's description: > Don't peek messages in the MessagePumpForUI class when we receive our kMsgHaveWork message. > Relanding this patch with fixes for the performance issues reported with the worker thread hogging the CPU continuosly. (https://codereview.chromium.org/1181263008/) > > Currently the MessagePumpForUI class peeks Windows messages when we receive the kMsgHaveWork message in > our main message loop and in nested modal loops. This is because the posted message starves the message loop > of input and other lower priority messages. While this is ok for the main message loop our peeking and dispatching > messages in nested loops is wrong and violates the silent contract where in the nested loop should be the one peeking > and dispatching messages. > > To fix this the approach we are taking is to create a worker thread which uses a waitable timer of 3 ms which posts > the kMsgHaveWork message to the main loop when the timer fires. As a result we can safely delete all the code > in the MessagePumpForUI::ScheduleWork function and simplify the ProcessPumpReplacementMessage function. > > The MessagePumpForUI::ScheduleWork function now checks the delay for the task at the head of the queue > If it is 0 then we post the message right away as it is a regular task. Added functions (GetNewlyAddedTaskDelay) to the MessagePump::Delegate class and the IncomingTaskQueue for this. > > The other change here is to change the GPU process to use the IO message pump by default and use the UI pump only > if we are using opengl. Reason being this patch causes a delay in processing tasks due to the worker thread which > causes tests like webgl_conformance to fail. We will continue working on addressing this over the coming days. > > To prevent the UI worker thread from continuously posting the timer we use a flag to control the same. > The flag ensures that the worker thread posts the timer once for each iteration. > > This patch also contains a fix for the crash reported in bug 501602 which occurs due to the GetNewlyAddedTaskDelay > function being called from the WndProc which does not have the incoming queue lock. Fix is to move some of the > logic in the ScheduleWork function to the newly added ScheduleWorkHelper function. > > BUG=492837, 501602 > TBR=cpu > > Committed: https://crrev.com/4d5496cde5b81436954e31a9fe82e35ccfe5de49 > Cr-Commit-Position: refs/heads/master@{#335475} TBR=scottmg@chromium.org,cpu@chromium.org,brucedawson@chromium.org,kbr@chromium.org,ananta@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=492837, 501602 Committed: https://crrev.com/ca6bfb547d1ee58459b06ab79dd87a0f14081f4c Cr-Commit-Position: refs/heads/master@{#337113}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -177 lines) Patch
M base/message_loop/incoming_task_queue.h View 1 chunk +0 lines, -3 lines 0 comments Download
M base/message_loop/incoming_task_queue.cc View 1 chunk +0 lines, -5 lines 0 comments Download
M base/message_loop/message_loop.h View 1 chunk +0 lines, -1 line 0 comments Download
M base/message_loop/message_loop.cc View 1 chunk +0 lines, -4 lines 0 comments Download
M base/message_loop/message_pump.h View 1 chunk +0 lines, -3 lines 0 comments Download
M base/message_loop/message_pump_win.h View 3 chunks +0 lines, -40 lines 0 comments Download
M base/message_loop/message_pump_win.cc View 6 chunks +61 lines, -107 lines 0 comments Download
M content/gpu/gpu_main.cc View 1 chunk +1 line, -14 lines 0 comments Download

Messages

Total messages: 1 (0 generated)
jbauman
5 years, 5 months ago (2015-07-01 21:16:08 UTC) #1
Created Revert of Don't peek messages in the MessagePumpForUI class when we
receive our kMsgHaveWork message.

Powered by Google App Engine
This is Rietveld 408576698