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

Unified Diff: base/message_loop/incoming_task_queue.h

Issue 395913006: High resolution timer fix for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more cleanup Created 6 years, 5 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 | « no previous file | base/message_loop/incoming_task_queue.cc » ('j') | base/message_loop/incoming_task_queue.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/incoming_task_queue.h
diff --git a/base/message_loop/incoming_task_queue.h b/base/message_loop/incoming_task_queue.h
index 56c5638295b8440cdcad41871f28e71eb7ee16e8..d533cafd1026069f8345516bcf8369d0e6b5ebbe 100644
--- a/base/message_loop/incoming_task_queue.h
+++ b/base/message_loop/incoming_task_queue.h
@@ -38,16 +38,17 @@ class BASE_EXPORT IncomingTaskQueue
TimeDelta delay,
bool nestable);
- // Returns true if the message loop has high resolution timers enabled.
- // Provided for testing.
- bool IsHighResolutionTimerEnabledForTesting();
+ // Returns true if the queue contains tasks that require higher than default
+ // timer resolution. Currently only needed for Windows.
+ bool HasHighResolutionTasks();
// Returns true if the message loop is "idle". Provided for testing.
bool IsIdleForTesting();
// Loads tasks from the |incoming_queue_| into |*work_queue|. Must be called
- // from the thread that is running the loop.
- void ReloadWorkQueue(TaskQueue* work_queue);
+ // from the thread that is running the loop. Returns the number of tasks that
+ // require high resolution timers.
+ int ReloadWorkQueue(TaskQueue* work_queue);
// Disconnects |this| from the parent message loop.
void WillDestroyCurrentMessageLoop();
@@ -65,9 +66,9 @@ class BASE_EXPORT IncomingTaskQueue
// does not retain |pending_task->task| beyond this function call.
bool PostPendingTask(PendingTask* pending_task);
-#if defined(OS_WIN)
- TimeTicks high_resolution_timer_expiration_;
-#endif
+ // Number of tasks that require high resolution timing. This value is kept
+ // so that ReloadWorkQueue() completes in constant time.
+ int high_res_task_count_;
darin (slow to review) 2014/07/18 04:07:58 can this number be negative? should we use unsigne
cpu_(ooo_6.6-7.5) 2014/07/18 22:53:10 I rather use signed math to make sure we count dow
// The lock that protects access to |incoming_queue_|, |message_loop_| and
darin (slow to review) 2014/07/18 04:07:58 This lock also protects access to high_res_task_co
cpu_(ooo_6.6-7.5) 2014/07/18 22:53:10 Done.
// |next_sequence_num_|.
« no previous file with comments | « no previous file | base/message_loop/incoming_task_queue.cc » ('j') | base/message_loop/incoming_task_queue.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698