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

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

Issue 922733002: scheduler: Implement task observers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix. Created 5 years, 10 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: 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 0b1bcbba9d619976eca8671d82ea5641e9fe2a1e..9e475ffe13801d67f50d41a6ce5ee3fab9418951 100644
--- a/content/renderer/scheduler/task_queue_manager.h
+++ b/content/renderer/scheduler/task_queue_manager.h
@@ -9,6 +9,7 @@
#include "base/debug/task_annotator.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/message_loop/message_loop.h"
#include "base/pending_task.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h"
@@ -105,6 +106,11 @@ class CONTENT_EXPORT TaskQueueManager {
// tasks posted to the main loop. The batch size is 1 by default.
void SetWorkBatchSize(int work_batch_size);
+ // These functions can only be called on the same thread that the task queue
+ // manager executes its tasks on.
+ void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer);
+ void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer);
+
void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source);
private:
@@ -141,9 +147,12 @@ class CONTENT_EXPORT TaskQueueManager {
bool SelectWorkQueueToService(size_t* out_queue_index);
// Runs a single nestable task from the work queue designated by
- // |queue_index|. Non-nestable task are reposted on the run loop.
- // The queue must not be empty.
- void ProcessTaskFromWorkQueue(size_t queue_index);
+ // |queue_index|. If |has_previous_task| is true, |previous_task| should
+ // contain the previous task in this work batch. Non-nestable task are
+ // reposted on the run loop. The queue must not be empty.
+ void ProcessTaskFromWorkQueue(size_t queue_index,
+ bool has_previous_task,
+ base::PendingTask* previous_task);
bool RunsTasksOnCurrentThread() const;
bool PostDelayedTask(const tracked_objects::Location& from_here,
@@ -177,6 +186,8 @@ class CONTENT_EXPORT TaskQueueManager {
scoped_refptr<cc::TestNowSource> time_source_;
+ ObserverList<base::MessageLoop::TaskObserver> task_observers_;
+
base::WeakPtrFactory<TaskQueueManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(TaskQueueManager);
« no previous file with comments | « content/renderer/scheduler/renderer_scheduler_impl.cc ('k') | content/renderer/scheduler/task_queue_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698