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

Unified Diff: base/message_loop/message_loop.h

Issue 543413004: High resolution timer fix reland (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 years, 3 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/incoming_task_queue.cc ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop.h
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h
index 39a1b686bac46b698b04c26585ce1e3d23def8ea..8db1e77daf38b21e191df7c0108b6abe0d6571fe 100644
--- a/base/message_loop/message_loop.h
+++ b/base/message_loop/message_loop.h
@@ -371,10 +371,6 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
void AddTaskObserver(TaskObserver* task_observer);
void RemoveTaskObserver(TaskObserver* task_observer);
- // When we go into high resolution timer mode, we will stay in hi-res mode
- // for at least 1s.
- static const int kHighResolutionTimerModeLeaseTimeMs = 1000;
-
#if defined(OS_WIN)
void set_os_modal_loop(bool os_modal_loop) {
os_modal_loop_ = os_modal_loop;
@@ -390,7 +386,7 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// Returns true if the message loop has high resolution timers enabled.
// Provided for testing.
- bool IsHighResolutionTimerEnabledForTesting();
+ bool HasHighResolutionTasks();
// Returns true if the message loop is "idle". Provided for testing.
bool IsIdleForTesting();
@@ -459,6 +455,14 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate {
// this queue is only accessed (push/pop) by our current thread.
TaskQueue work_queue_;
+ // How many high resolution tasks are in the pending task queue. This value
+ // increases by N every time we call ReloadWorkQueue() and decreases by 1
+ // every time we call RunTask() if the task needs a high resolution timer.
+ int pending_high_res_tasks_;
+ // Tracks if we have requested high resolution timers. Its only use is to
+ // turn off the high resolution timer upon loop destruction.
+ bool in_high_res_mode_;
+
// Contains delayed tasks, sorted by their 'delayed_run_time' property.
DelayedTaskQueue delayed_work_queue_;
« no previous file with comments | « base/message_loop/incoming_task_queue.cc ('k') | base/message_loop/message_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698