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

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

Issue 845543004: Run task queue manager work in batches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 11 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 100c6d570ca173b44587af4712cbeadcac30d860..f6aca7894a0d7410cfbb5c30e5fef8c55a21246e 100644
--- a/content/renderer/scheduler/task_queue_manager.h
+++ b/content/renderer/scheduler/task_queue_manager.h
@@ -80,6 +80,12 @@ class CONTENT_EXPORT TaskQueueManager {
// to a static string.
void SetQueueName(size_t queue_index, const char* name);
+ // Set the number of tasks executed in a single invocation of the task queue
+ // manager. Increasing the batch size can reduce the overhead of yielding
+ // back to the main message loop -- at the cost of potentially delaying other
+ // tasks posted to the main loop. The batch size is 1 by default.
+ void SetWorkBatchSize(int work_batch_size);
+
private:
friend class internal::TaskQueue;
@@ -135,6 +141,8 @@ class CONTENT_EXPORT TaskQueueManager {
// where re-entrant problems happen.
int pending_dowork_count_;
+ int work_batch_size_;
+
base::WeakPtrFactory<TaskQueueManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(TaskQueueManager);

Powered by Google App Engine
This is Rietveld 408576698