| 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" |
| 11 #include "base/time/tick_clock.h" | 11 #include "base/time/tick_clock.h" |
| 12 #include "platform/scheduler/base/task_queue_manager.h" | 12 #include "platform/scheduler/base/task_queue_manager.h" |
| 13 #include "platform/scheduler/base/task_queue_selector.h" | 13 #include "platform/scheduler/base/task_queue_selector.h" |
| 14 #include "public/platform/WebThread.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class TickClock; | 17 class TickClock; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace blink { | 20 namespace blink { |
| 20 namespace scheduler { | 21 namespace scheduler { |
| 21 | 22 |
| 22 class SchedulerTqmDelegate; | 23 class SchedulerTqmDelegate; |
| 23 | 24 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 51 // are executed with the highest priority but do not cause the scheduler to | 52 // 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 // wake up. Care must be taken to avoid starvation of other task queues. |
| 53 scoped_refptr<TaskQueue> ControlAfterWakeUpTaskRunner(); | 54 scoped_refptr<TaskQueue> ControlAfterWakeUpTaskRunner(); |
| 54 | 55 |
| 55 // Adds or removes a task observer from the scheduler. The observer will be | 56 // 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 | 57 // notified before and after every executed task. These functions can only be |
| 57 // called on the thread this class was created on. | 58 // called on the thread this class was created on. |
| 58 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); | 59 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); |
| 59 void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer); | 60 void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer); |
| 60 | 61 |
| 61 void SetTaskTimeTracker(TaskTimeTracker* task_time_tracker) { | 62 void AddTaskTimeObserver(WebThread::TaskTimeObserver* task_time_observer) { |
| 62 if (task_queue_manager_) | 63 if (task_queue_manager_) |
| 63 task_queue_manager_->SetTaskTimeTracker(task_time_tracker); | 64 task_queue_manager_->AddTaskTimeObserver(task_time_observer); |
| 65 } |
| 66 |
| 67 void RemoveTaskTimeObserver(WebThread::TaskTimeObserver* task_time_observer) { |
| 68 if (task_queue_manager_) |
| 69 task_queue_manager_->RemoveTaskTimeObserver(task_time_observer); |
| 64 } | 70 } |
| 65 | 71 |
| 66 // Shuts down the scheduler by dropping any remaining pending work in the work | 72 // Shuts down the scheduler by dropping any remaining pending work in the work |
| 67 // queues. After this call any work posted to the task runners will be | 73 // queues. After this call any work posted to the task runners will be |
| 68 // silently dropped. | 74 // silently dropped. |
| 69 void Shutdown(); | 75 void Shutdown(); |
| 70 | 76 |
| 71 // Returns true if Shutdown() has been called. Otherwise returns false. | 77 // Returns true if Shutdown() has been called. Otherwise returns false. |
| 72 bool IsShutdown() const { return !task_queue_manager_.get(); } | 78 bool IsShutdown() const { return !task_queue_manager_.get(); } |
| 73 | 79 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 const char* tracing_category_; | 129 const char* tracing_category_; |
| 124 const char* disabled_by_default_tracing_category_; | 130 const char* disabled_by_default_tracing_category_; |
| 125 | 131 |
| 126 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); | 132 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); |
| 127 }; | 133 }; |
| 128 | 134 |
| 129 } // namespace scheduler | 135 } // namespace scheduler |
| 130 } // namespace blink | 136 } // namespace blink |
| 131 | 137 |
| 132 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H
_ | 138 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H
_ |
| OLD | NEW |