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

Issue 1714263002: Version of MessagePumpForUI optimized for GPU process (Closed)

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

Description

Version of MessagePumpForUI optimized for GPU process. The purpose of this change is to reduce overhead of MessagePump in GPU process. According to my testing on Windows 10 Dell XPS laptop this change improved the power usage by 0.15 Wt in one test and 0.12 Wt in another. The test was a windowed playback of 1080p @ 60 Hz H.264 video. Based on ETW sample profile the overhead of the message pump is reduced from 13-15% to 7-10%. The overhead is calculated as a number of inclusive samples in DoRunLoop that are not part of DoWork and DoDelayedWork. The change eliminates some system calls that shouldn't be needed in the context of GPU process such as GetQueueStatus, SetTimer, KillTimer, and minimizes other system calls that came up high in the sampling profile - PeekMessage, MsgWaitForMultipleObjectsEx, PostMessage. While this version of MessagePump is still capable to peek and dispatch Windows messages which apparently is needed in the GPU process on Windows version above Win7, based on the usage pattern analysis, the emphasis gets shifted to handling the work (vs. handling Windows messages in MessagePumpForUI). See the bug for more details. If this work well in a limited context of the GPU process some of these ideas might later be applied to other types of MessagePump. BUG=588798 Committed: https://crrev.com/f71e6d2cbb90cacc88ce41a48475c47c6b7a3543 Cr-Commit-Position: refs/heads/master@{#386898}

Patch Set 1 : #

Total comments: 2

Patch Set 2 : Got rid of MessageBaseForUIBase and used PostThreadMessage #

Patch Set 3 : Handle messages for other threads without exiting WaitForWork #

Total comments: 26

Patch Set 4 : Addressed CR feedback #

Total comments: 8

Patch Set 5 : Addressed CR feedback #

Patch Set 6 : Added <memory> include #

Patch Set 7 : Two more comparisons to flip #

Total comments: 8

Patch Set 8 : Added CallMsgFilter call #

Unified diffs Side-by-side diffs Delta from patch set Stats (+195 lines, -14 lines) Patch
M base/message_loop/message_loop_unittest.cc View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M base/message_loop/message_pump_win.h View 1 2 3 4 5 6 7 5 chunks +40 lines, -6 lines 0 comments Download
M base/message_loop/message_pump_win.cc View 1 2 3 4 5 6 7 10 chunks +151 lines, -8 lines 0 comments Download
M content/gpu/gpu_main.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 40 (19 generated)
stanisc
PTAL!
4 years, 9 months ago (2016-03-18 00:15:13 UTC) #12
jbauman
https://codereview.chromium.org/1714263002/diff/60001/base/message_loop/message_pump_win.cc File base/message_loop/message_pump_win.cc (right): https://codereview.chromium.org/1714263002/diff/60001/base/message_loop/message_pump_win.cc#newcode87 base/message_loop/message_pump_win.cc:87: InitMessageWnd(); We could essentially get rid of MessagePumpForUIBase as ...
4 years, 9 months ago (2016-03-18 01:00:51 UTC) #13
stanisc
https://codereview.chromium.org/1714263002/diff/60001/base/message_loop/message_pump_win.cc File base/message_loop/message_pump_win.cc (right): https://codereview.chromium.org/1714263002/diff/60001/base/message_loop/message_pump_win.cc#newcode87 base/message_loop/message_pump_win.cc:87: InitMessageWnd(); On 2016/03/18 01:00:50, jbauman wrote: > We could ...
4 years, 9 months ago (2016-03-18 18:16:46 UTC) #14
stanisc
I've removed the base class and reimplemented MessagePumpForGpu to derive from MessagePumpWin and to use ...
4 years, 9 months ago (2016-03-21 20:42:10 UTC) #15
jbauman
lgtm
4 years, 9 months ago (2016-03-21 21:39:49 UTC) #16
stanisc
Nico, could you take a look or recommend someone else to review this?
4 years, 9 months ago (2016-03-22 16:22:46 UTC) #17
stanisc
Removed Nico from the review and added thestig@ and ananta@. I've done a second round ...
4 years, 8 months ago (2016-04-07 21:05:47 UTC) #21
Lei Zhang
https://codereview.chromium.org/1714263002/diff/120001/base/message_loop/message_pump_win.cc File base/message_loop/message_pump_win.cc (right): https://codereview.chromium.org/1714263002/diff/120001/base/message_loop/message_pump_win.cc#newcode97 base/message_loop/message_pump_win.cc:97: if (READY != InterlockedExchange(&work_state_, HAVE_WORK)) nit: Just write it ...
4 years, 8 months ago (2016-04-07 21:32:26 UTC) #22
stanisc
Addressed CR feedback. https://codereview.chromium.org/1714263002/diff/120001/base/message_loop/message_pump_win.cc File base/message_loop/message_pump_win.cc (right): https://codereview.chromium.org/1714263002/diff/120001/base/message_loop/message_pump_win.cc#newcode97 base/message_loop/message_pump_win.cc:97: if (READY != InterlockedExchange(&work_state_, HAVE_WORK)) On ...
4 years, 8 months ago (2016-04-08 01:07:12 UTC) #23
Lei Zhang
https://codereview.chromium.org/1714263002/diff/120001/base/message_loop/message_pump_win.h File base/message_loop/message_pump_win.h (right): https://codereview.chromium.org/1714263002/diff/120001/base/message_loop/message_pump_win.h#newcode13 base/message_loop/message_pump_win.h:13: #include "base/memory/scoped_ptr.h" On 2016/04/08 01:07:12, stanisc wrote: > On ...
4 years, 8 months ago (2016-04-08 19:10:21 UTC) #24
stanisc
Addressed the second round of CR comments. PTAL! https://codereview.chromium.org/1714263002/diff/120001/base/message_loop/message_pump_win.h File base/message_loop/message_pump_win.h (right): https://codereview.chromium.org/1714263002/diff/120001/base/message_loop/message_pump_win.h#newcode13 base/message_loop/message_pump_win.h:13: #include ...
4 years, 8 months ago (2016-04-11 21:52:59 UTC) #25
Lei Zhang
Thanks for getting to all the nits, lgtm.
4 years, 8 months ago (2016-04-11 21:59:05 UTC) #26
iyengar
https://codereview.chromium.org/1714263002/diff/200001/base/message_loop/message_pump_win.cc File base/message_loop/message_pump_win.cc (right): https://codereview.chromium.org/1714263002/diff/200001/base/message_loop/message_pump_win.cc#newcode423 base/message_loop/message_pump_win.cc:423: PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE); Is this needed? https://codereview.chromium.org/1714263002/diff/200001/base/message_loop/message_pump_win.cc#newcode475 ...
4 years, 8 months ago (2016-04-11 22:18:22 UTC) #28
stanisc
https://codereview.chromium.org/1714263002/diff/200001/base/message_loop/message_pump_win.cc File base/message_loop/message_pump_win.cc (right): https://codereview.chromium.org/1714263002/diff/200001/base/message_loop/message_pump_win.cc#newcode423 base/message_loop/message_pump_win.cc:423: PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE); On 2016/04/11 22:18:21, iyengar ...
4 years, 8 months ago (2016-04-11 23:57:32 UTC) #29
ananta
sg https://codereview.chromium.org/1714263002/diff/200001/base/message_loop/message_pump_win.cc File base/message_loop/message_pump_win.cc (right): https://codereview.chromium.org/1714263002/diff/200001/base/message_loop/message_pump_win.cc#newcode533 base/message_loop/message_pump_win.cc:533: if (msg.message == WM_QUIT) { On 2016/04/11 23:57:32, ...
4 years, 8 months ago (2016-04-12 00:00:47 UTC) #30
stanisc
Added a call to the message filters and did another round of testing. https://codereview.chromium.org/1714263002/diff/200001/base/message_loop/message_pump_win.cc File ...
4 years, 8 months ago (2016-04-12 21:59:34 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1714263002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1714263002/220001
4 years, 8 months ago (2016-04-13 01:11:39 UTC) #34
ananta
lgtm
4 years, 8 months ago (2016-04-13 01:26:41 UTC) #35
commit-bot: I haz the power
Committed patchset #8 (id:220001)
4 years, 8 months ago (2016-04-13 02:13:21 UTC) #37
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/f71e6d2cbb90cacc88ce41a48475c47c6b7a3543 Cr-Commit-Position: refs/heads/master@{#386898}
4 years, 8 months ago (2016-04-13 02:14:52 UTC) #39
stanisc
4 years, 8 months ago (2016-04-16 00:23:28 UTC) #40
Message was sent while issue was closed.
A revert of this CL (patchset #8 id:220001) has been created in
https://codereview.chromium.org/1889293003/ by stanisc@chromium.org.

The reason for reverting is: It looks like this is causing issues with UI
responsiveness due to shared message queue..

Powered by Google App Engine
This is Rietveld 408576698