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

Unified Diff: base/message_loop/message_pump_win.cc

Issue 2036603002: MessagePumpForGpu - reduce potential work processing starvation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop/message_pump_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_pump_win.cc
diff --git a/base/message_loop/message_pump_win.cc b/base/message_loop/message_pump_win.cc
index ac54788539cb062da639e4338fe7b430c85b4449..3d401bda259ce415ec35ecea5ff6480c5ea2775a 100644
--- a/base/message_loop/message_pump_win.cc
+++ b/base/message_loop/message_pump_win.cc
@@ -449,6 +449,10 @@ void MessagePumpForGpu::ScheduleWork() {
if (InterlockedExchange(&work_state_, HAVE_WORK) != READY)
return; // Someone else continued the pumping.
+ // TODO(stanisc): crbug.com/596190: Preserve for crash dump analysis.
+ // Remove this when the bug is fixes.
brucedawson 2016/06/03 23:36:15 fixes -> fixed
+ last_set_event_timeticks_ = TimeTicks::Now();
+
// Make sure the MessagePump does some work for us.
SetEvent(event_);
}
@@ -520,19 +524,19 @@ void MessagePumpForGpu::WaitForWork() {
if (delay < 0) // Negative value means no timers waiting.
delay = INFINITE;
+ // TODO(stanisc): crbug.com/596190: Preserve for crash dump analysis.
+ // Remove this when the bug is fixes.
brucedawson 2016/06/03 23:36:15 fixes -> fixed
+ TimeTicks wait_for_work_timeticks = TimeTicks::Now();
+ debug::Alias(&wait_for_work_timeticks);
+ debug::Alias(&delay);
+
DWORD result =
MsgWaitForMultipleObjectsEx(1, &event_, delay, QS_ALLINPUT, 0);
- if (result == WAIT_OBJECT_0) {
- // Work available.
+ DCHECK_NE(WAIT_FAILED, result) << GetLastError();
+ if (result != WAIT_TIMEOUT) {
+ // Either work or message available.
return;
- } else if (result == WAIT_OBJECT_0 + 1) {
- // Message available. Keep waiting if this message isn't for this thread.
- MSG msg;
- if (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE))
- return;
}
-
- DCHECK_NE(WAIT_FAILED, result) << GetLastError();
}
}
« no previous file with comments | « base/message_loop/message_pump_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698