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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // This function only needs to be called if automatic pumping is disabled | 89 // This function only needs to be called if automatic pumping is disabled |
90 // for |queue_index|. See |SetQueueAutoPumpPolicy|. By default automatic | 90 // for |queue_index|. See |SetQueueAutoPumpPolicy|. By default automatic |
91 // pumping is enabled for all queues. | 91 // pumping is enabled for all queues. |
92 void PumpQueue(size_t queue_index); | 92 void PumpQueue(size_t queue_index); |
93 | 93 |
94 // Returns true if there no tasks in either the work or incoming task queue | 94 // Returns true if there no tasks in either the work or incoming task queue |
95 // identified by |queue_index|. Note that this function involves taking a | 95 // identified by |queue_index|. Note that this function involves taking a |
96 // lock, so calling it has some overhead. | 96 // lock, so calling it has some overhead. |
97 bool IsQueueEmpty(size_t queue_index) const; | 97 bool IsQueueEmpty(size_t queue_index) const; |
98 | 98 |
| 99 // Returns the time of the next pending delayed task in any queue. Returns |
| 100 // a null TimeTicks object if no tasks are pending. |
| 101 base::TimeTicks NextPendingDelayedTaskRunTime(); |
| 102 |
99 // Set the name |queue_index| for tracing purposes. |name| must be a pointer | 103 // Set the name |queue_index| for tracing purposes. |name| must be a pointer |
100 // to a static string. | 104 // to a static string. |
101 void SetQueueName(size_t queue_index, const char* name); | 105 void SetQueueName(size_t queue_index, const char* name); |
102 | 106 |
103 // Set the number of tasks executed in a single invocation of the task queue | 107 // Set the number of tasks executed in a single invocation of the task queue |
104 // manager. Increasing the batch size can reduce the overhead of yielding | 108 // manager. Increasing the batch size can reduce the overhead of yielding |
105 // back to the main message loop -- at the cost of potentially delaying other | 109 // back to the main message loop -- at the cost of potentially delaying other |
106 // tasks posted to the main loop. The batch size is 1 by default. | 110 // tasks posted to the main loop. The batch size is 1 by default. |
107 void SetWorkBatchSize(int work_batch_size); | 111 void SetWorkBatchSize(int work_batch_size); |
108 | 112 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 ObserverList<base::MessageLoop::TaskObserver> task_observers_; | 189 ObserverList<base::MessageLoop::TaskObserver> task_observers_; |
186 | 190 |
187 base::WeakPtrFactory<TaskQueueManager> weak_factory_; | 191 base::WeakPtrFactory<TaskQueueManager> weak_factory_; |
188 | 192 |
189 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); | 193 DISALLOW_COPY_AND_ASSIGN(TaskQueueManager); |
190 }; | 194 }; |
191 | 195 |
192 } // namespace content | 196 } // namespace content |
193 | 197 |
194 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ | 198 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_MANAGER_H_ |
OLD | NEW |