OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
7 | 7 |
8 #include "base/atomic_sequence_num.h" | 8 #include "base/atomic_sequence_num.h" |
9 #include "base/debug/task_annotator.h" | 9 #include "base/debug/task_annotator.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // This function only needs to be called if automatic pumping is disabled | 91 // This function only needs to be called if automatic pumping is disabled |
92 // for |queue_index|. See |SetQueueAutoPumpPolicy|. By default automatic | 92 // for |queue_index|. See |SetQueueAutoPumpPolicy|. By default automatic |
93 // pumping is enabled for all queues. | 93 // pumping is enabled for all queues. |
94 void PumpQueue(size_t queue_index); | 94 void PumpQueue(size_t queue_index); |
95 | 95 |
96 // Returns true if there no tasks in either the work or incoming task queue | 96 // Returns true if there no tasks in either the work or incoming task queue |
97 // identified by |queue_index|. Note that this function involves taking a | 97 // identified by |queue_index|. Note that this function involves taking a |
98 // lock, so calling it has some overhead. | 98 // lock, so calling it has some overhead. |
99 bool IsQueueEmpty(size_t queue_index) const; | 99 bool IsQueueEmpty(size_t queue_index) const; |
100 | 100 |
| 101 // Returns the time of the next pending delayed task in any queue. Returns |
| 102 // a null TimeTicks object if no tasks are pending. |
| 103 base::TimeTicks NextPendingDelayedTaskRunTime(); |
| 104 |
101 // Set the name |queue_index| for tracing purposes. |name| must be a pointer | 105 // Set the name |queue_index| for tracing purposes. |name| must be a pointer |
102 // to a static string. | 106 // to a static string. |
103 void SetQueueName(size_t queue_index, const char* name); | 107 void SetQueueName(size_t queue_index, const char* name); |
104 | 108 |
105 // Set the number of tasks executed in a single invocation of the task queue | 109 // Set the number of tasks executed in a single invocation of the task queue |
106 // manager. Increasing the batch size can reduce the overhead of yielding | 110 // manager. Increasing the batch size can reduce the overhead of yielding |
107 // back to the main message loop -- at the cost of potentially delaying other | 111 // back to the main message loop -- at the cost of potentially delaying other |
108 // tasks posted to the main loop. The batch size is 1 by default. | 112 // tasks posted to the main loop. The batch size is 1 by default. |
109 void SetWorkBatchSize(int work_batch_size); | 113 void SetWorkBatchSize(int work_batch_size); |
110 | 114 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 ObserverList<base::MessageLoop::TaskObserver> task_observers_; | 191 ObserverList<base::MessageLoop::TaskObserver> task_observers_; |
188 | 192 |
189 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 193 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
190 | 194 |
191 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 195 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
192 }; | 196 }; |
193 | 197 |
194 } // namespace content | 198 } // namespace content |
195 | 199 |
196 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 200 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
OLD | NEW |