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

Unified Diff: base/message_loop/message_pump_win.cc

Issue 1189133003: Ensure that the wake up timer set by the UI worker thread in the UI message pump on Windows is set … Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 a84e04e93a5ef90d1b03fce2afd0545f897333b7..273efdafdf89fe63ae47060374738dc24e91202f 100644
--- a/base/message_loop/message_pump_win.cc
+++ b/base/message_loop/message_pump_win.cc
@@ -93,7 +93,8 @@ int MessagePumpWin::GetCurrentDelay() const {
// MessagePumpForUI public:
MessagePumpForUI::MessagePumpForUI()
- : atom_(0) {
+ : atom_(0),
+ force_fallback_timer_for_tasks_(0) {
InitMessageWnd();
ui_worker_thread_timer_.Set(::CreateWaitableTimer(NULL, FALSE, NULL));
@@ -125,6 +126,8 @@ void MessagePumpForUI::ScheduleWork() {
PostWorkMessage();
return;
}
+
+ ::InterlockedExchange(&force_fallback_timer_for_tasks_, 1);
// Set a one shot timer to fire after 3 milliseconds. The actual resolution
// of the timer is dependent on timeBeginPeriod being called.
SetWakeupTimer(kDefaultUIWorkerThreadWakeupTimerMs);
@@ -425,6 +428,7 @@ bool MessagePumpForUI::ProcessPumpReplacementMessage() {
void MessagePumpForUI::DoWorkerThreadRunLoop() {
DCHECK(ui_worker_thread_timer_.Get());
+
while (TRUE) {
DWORD ret = WaitForSingleObjectEx(
ui_worker_thread_timer_.Get(), INFINITE, TRUE);
@@ -438,7 +442,8 @@ void MessagePumpForUI::DoWorkerThreadRunLoop() {
// Set a one shot timer to process pending delayed tasks if any in the
// queue. The actual resolution of the timer is dependent on the
// timeBeginPeriod API being called.
brucedawson 2015/06/19 21:09:01 "is dependent on the current global timer precisio
ananta 2015/06/19 22:19:10 Done.
- SetWakeupTimer(kDefaultUIWorkerThreadWakeupTimerMs);
+ if (::InterlockedExchange(&force_fallback_timer_for_tasks_, 0))
+ SetWakeupTimer(kDefaultUIWorkerThreadWakeupTimerMs);
}
}
« base/message_loop/message_pump_win.h ('K') | « 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