| 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // There is a small overhead to recording task delay histograms, we may not | 39 // There is a small overhead to recording task delay histograms, we may not |
| 40 // wish to do this on all threads. | 40 // wish to do this on all threads. |
| 41 void SetRecordTaskDelayHistograms(bool record_task_delay_histograms); | 41 void SetRecordTaskDelayHistograms(bool record_task_delay_histograms); |
| 42 | 42 |
| 43 // TaskQueueManager::Observer implementation: | 43 // TaskQueueManager::Observer implementation: |
| 44 void OnUnregisterTaskQueue(const scoped_refptr<TaskQueue>& queue) override; | 44 void OnUnregisterTaskQueue(const scoped_refptr<TaskQueue>& queue) override; |
| 45 void OnTriedToExecuteBlockedTask(const TaskQueue& queue, | 45 void OnTriedToExecuteBlockedTask(const TaskQueue& queue, |
| 46 const base::PendingTask& task) override; | 46 const base::PendingTask& task) override; |
| 47 | 47 |
| 48 // Returns the default task runner. | 48 // Returns the default task queue. |
| 49 scoped_refptr<TaskQueue> DefaultTaskRunner(); | 49 scoped_refptr<TaskQueue> DefaultTaskQueue(); |
| 50 | 50 |
| 51 // Returns the control task runner. Tasks posted to this runner are executed | 51 // Returns the control task queue. Tasks posted to this queue are executed |
| 52 // with the highest priority. Care must be taken to avoid starvation of other | 52 // with the highest priority. Care must be taken to avoid starvation of other |
| 53 // task queues. | 53 // task queues. |
| 54 scoped_refptr<TaskQueue> ControlTaskRunner(); | 54 scoped_refptr<TaskQueue> ControlTaskQueue(); |
| 55 | 55 |
| 56 // 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 |
| 57 // 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 |
| 58 // called on the thread this class was created on. | 58 // called on the thread this class was created on. |
| 59 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); | 59 void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer); |
| 60 void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer); | 60 void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer); |
| 61 | 61 |
| 62 void AddTaskTimeObserver(TaskTimeObserver* task_time_observer); | 62 void AddTaskTimeObserver(TaskTimeObserver* task_time_observer); |
| 63 void RemoveTaskTimeObserver(TaskTimeObserver* task_time_observer); | 63 void RemoveTaskTimeObserver(TaskTimeObserver* task_time_observer); |
| 64 | 64 |
| 65 // Shuts down the scheduler by dropping any remaining pending work in the work | 65 // Shuts down the scheduler by dropping any remaining pending work in the work |
| 66 // queues. After this call any work posted to the task runners will be | 66 // queues. After this call any work posted to the task queue will be |
| 67 // silently dropped. | 67 // silently dropped. |
| 68 void Shutdown(); | 68 void Shutdown(); |
| 69 | 69 |
| 70 // Returns true if Shutdown() has been called. Otherwise returns false. | 70 // Returns true if Shutdown() has been called. Otherwise returns false. |
| 71 bool IsShutdown() const { return !task_queue_manager_.get(); } | 71 bool IsShutdown() const { return !task_queue_manager_.get(); } |
| 72 | 72 |
| 73 inline void CheckOnValidThread() const { | 73 inline void CheckOnValidThread() const { |
| 74 DCHECK(thread_checker_.CalledOnValidThread()); | 74 DCHECK(thread_checker_.CalledOnValidThread()); |
| 75 } | 75 } |
| 76 | 76 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 const char* tracing_category_; | 126 const char* tracing_category_; |
| 127 const char* disabled_by_default_tracing_category_; | 127 const char* disabled_by_default_tracing_category_; |
| 128 | 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); | 129 DISALLOW_COPY_AND_ASSIGN(SchedulerHelper); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 } // namespace scheduler | 132 } // namespace scheduler |
| 133 } // namespace blink | 133 } // namespace blink |
| 134 | 134 |
| 135 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H
_ | 135 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_CHILD_SCHEDULER_HELPER_H
_ |
| OLD | NEW |