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

Unified Diff: content/renderer/scheduler/task_queue_manager.h

Issue 1008693004: Handle delayed tasks more natively in the scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bug with AutomaticSelectorForTest and multiple queues Created 5 years, 9 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 | « cc/test/test_now_source.cc ('k') | content/renderer/scheduler/task_queue_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/scheduler/task_queue_manager.h
diff --git a/content/renderer/scheduler/task_queue_manager.h b/content/renderer/scheduler/task_queue_manager.h
index 0be8b99d5ccfcb1f4d69b0110f464c9c0a88bb2f..ae38cc8be5db6596f959c7ac5d397160ae769f33 100644
--- a/content/renderer/scheduler/task_queue_manager.h
+++ b/content/renderer/scheduler/task_queue_manager.h
@@ -29,6 +29,7 @@ class TestNowSource;
namespace content {
namespace internal {
+class LazyNow;
class TaskQueue;
}
class TaskQueueSelector;
@@ -98,8 +99,10 @@ class CONTENT_EXPORT TaskQueueManager {
// lock, so calling it has some overhead.
bool IsQueueEmpty(size_t queue_index) const;
- // Returns the time of the next pending delayed task in any queue. Returns
- // a null TimeTicks object if no tasks are pending.
+ // Returns the time of the next pending delayed task in any queue. Ignores
+ // any delayed tasks whose delay has expired. Returns a null TimeTicks object
+ // if no tasks are pending. NOTE this is somewhat expensive since every queue
+ // will get locked.
base::TimeTicks NextPendingDelayedTaskRunTime();
// Set the name |queue_index| for tracing purposes. |name| must be a pointer
@@ -120,6 +123,7 @@ class CONTENT_EXPORT TaskQueueManager {
void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source);
private:
+ friend class internal::LazyNow;
friend class internal::TaskQueue;
// Called by the task queue to register a new pending task and allocate a
@@ -134,14 +138,14 @@ class CONTENT_EXPORT TaskQueueManager {
// Use the selector to choose a pending task and run it.
void DoWork(bool posted_from_main_thread);
+ // Delayed Tasks with run_times <= Now() are enqueued onto the work queue.
// Reloads any empty work queues which have automatic pumping enabled and
// which are eligible to be auto pumped based on the |previous_task| which was
// run. Call with an empty |previous_task| if no task was just run. Returns
// true if any work queue has tasks after doing this.
// |next_pending_delayed_task| should be the time of the next known delayed
// task. It is updated if any task is found which should run earlier.
- bool UpdateWorkQueues(base::TimeTicks* next_pending_delayed_task,
- const base::PendingTask* previous_task);
+ bool UpdateWorkQueues(const base::PendingTask* previous_task);
// Chooses the next work queue to service. Returns true if |out_queue_index|
// indicates the queue from which the next task should be run, false to
« no previous file with comments | « cc/test/test_now_source.cc ('k') | content/renderer/scheduler/task_queue_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698