OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ |
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 const base::PendingTask& task) override; | 40 const base::PendingTask& task) override; |
41 | 41 |
42 // Returns the default task runner. | 42 // Returns the default task runner. |
43 scoped_refptr<TaskQueue> DefaultTaskRunner(); | 43 scoped_refptr<TaskQueue> DefaultTaskRunner(); |
44 | 44 |
45 // Returns the control task runner. Tasks posted to this runner are executed | 45 // Returns the control task runner. Tasks posted to this runner are executed |
46 // with the highest priority. Care must be taken to avoid starvation of other | 46 // with the highest priority. Care must be taken to avoid starvation of other |
47 // task queues. | 47 // task queues. |
48 scoped_refptr<TaskQueue> ControlTaskRunner(); | 48 scoped_refptr<TaskQueue> ControlTaskRunner(); |
49 | 49 |
50 // Returns the control task after wakeup runner. Tasks posted to this runner | |
51 // are executed with the highest priority but do not cause the scheduler to | |
52 // wake up. Care must be taken to avoid starvation of other task queues. | |
53 scoped_refptr<TaskQueue> ControlAfterWakeUpTaskRunner(); | |
54 | |
55 // Adds or removes a task observer from the scheduler. The observer will be | 50 // Adds or removes a task observer from the scheduler. The observer will be |
56 // notified before and after every executed task. These functions can only be | 51 // notified before and after every executed task. These functions can only be |
57 // called on the thread this class was created on. | 52 // called on the thread this class was created on. |
58 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); | 53 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); |
59 void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer); | 54 void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer); |
60 | 55 |
61 void AddTaskTimeObserver(TaskTimeObserver* task_time_observer); | 56 void AddTaskTimeObserver(TaskTimeObserver* task_time_observer); |
62 void RemoveTaskTimeObserver(TaskTimeObserver* task_time_observer); | 57 void RemoveTaskTimeObserver(TaskTimeObserver* task_time_observer); |
63 | 58 |
64 // Shuts down the scheduler by dropping any remaining pending work in the work | 59 // Shuts down the scheduler by dropping any remaining pending work in the work |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void SetWorkBatchSizeForTesting(size_t work_batch_size); | 102 void SetWorkBatchSizeForTesting(size_t work_batch_size); |
108 TaskQueueManager* GetTaskQueueManagerForTesting(); | 103 TaskQueueManager* GetTaskQueueManagerForTesting(); |
109 | 104 |
110 private: | 105 private: |
111 friend class SchedulerHelperTest; | 106 friend class SchedulerHelperTest; |
112 | 107 |
113 base::ThreadChecker thread_checker_; | 108 base::ThreadChecker thread_checker_; |
114 scoped_refptr<SchedulerTqmDelegate> task_queue_manager_delegate_; | 109 scoped_refptr<SchedulerTqmDelegate> task_queue_manager_delegate_; |
115 std::unique_ptr<TaskQueueManager> task_queue_manager_; | 110 std::unique_ptr<TaskQueueManager> task_queue_manager_; |
116 scoped_refptr<TaskQueue> control_task_runner_; | 111 scoped_refptr<TaskQueue> control_task_runner_; |
117 scoped_refptr<TaskQueue> control_after_wakeup_task_runner_; | |
118 scoped_refptr<TaskQueue> default_task_runner_; | 112 scoped_refptr<TaskQueue> default_task_runner_; |
119 | 113 |
120 Observer* observer_; // NOT OWNED | 114 Observer* observer_; // NOT OWNED |
121 const char* tracing_category_; | 115 const char* tracing_category_; |
122 const char* disabled_by_default_tracing_category_; | 116 const char* disabled_by_default_tracing_category_; |
123 | 117 |
124 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); | 118 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); |
125 }; | 119 }; |
126 | 120 |
127 } // namespace scheduler | 121 } // namespace scheduler |
128 } // namespace blink | 122 } // namespace blink |
129 | 123 |
130 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H
_ | 124 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H
_ |
OLD | NEW |