| 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_CHILD_SCHEDULER_TASK_QUEUE_SELECTOR_H_ | 5 #ifndef COMPONENTS_SCHEDULER_CHILD_TASK_QUEUE_SELECTOR_H_ |
| 6 #define CONTENT_CHILD_SCHEDULER_TASK_QUEUE_SELECTOR_H_ | 6 #define COMPONENTS_SCHEDULER_CHILD_TASK_QUEUE_SELECTOR_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "content/common/content_export.h" | 11 #include "components/scheduler/scheduler_export.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class TaskQueue; | 14 class TaskQueue; |
| 15 namespace trace_event { | 15 namespace trace_event { |
| 16 class TracedValue; | 16 class TracedValue; |
| 17 } // namespace trace_event | 17 } // namespace trace_event |
| 18 } // namespace base | 18 } // namespace base |
| 19 | 19 |
| 20 namespace content { | 20 namespace scheduler { |
| 21 | 21 |
| 22 class TaskQueueSelector { | 22 class TaskQueueSelector { |
| 23 public: | 23 public: |
| 24 virtual ~TaskQueueSelector() {} | 24 virtual ~TaskQueueSelector() {} |
| 25 | 25 |
| 26 // Called once to register the work queues to be selected from. This function | 26 // Called once to register the work queues to be selected from. This function |
| 27 // is called on the main thread. | 27 // is called on the main thread. |
| 28 virtual void RegisterWorkQueues( | 28 virtual void RegisterWorkQueues( |
| 29 const std::vector<const base::TaskQueue*>& work_queues) = 0; | 29 const std::vector<const base::TaskQueue*>& work_queues) = 0; |
| 30 | 30 |
| 31 class CONTENT_EXPORT Observer { | 31 class SCHEDULER_EXPORT Observer { |
| 32 public: | 32 public: |
| 33 virtual ~Observer() {} | 33 virtual ~Observer() {} |
| 34 | 34 |
| 35 // Called when a task queue transitions from disabled to enabled. | 35 // Called when a task queue transitions from disabled to enabled. |
| 36 virtual void OnTaskQueueEnabled() = 0; | 36 virtual void OnTaskQueueEnabled() = 0; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // Called once to set the Observer. This function is called | 39 // Called once to set the Observer. This function is called |
| 40 // on the main thread. If |observer| is null, then no callbacks will occur. | 40 // on the main thread. If |observer| is null, then no callbacks will occur. |
| 41 virtual void SetTaskQueueSelectorObserver(Observer* observer) = 0; | 41 virtual void SetTaskQueueSelectorObserver(Observer* observer) = 0; |
| 42 | 42 |
| 43 // Called to choose the work queue from which the next task should be taken | 43 // Called to choose the work queue from which the next task should be taken |
| 44 // and run. Return true if |out_queue| indicates the queue to service or | 44 // and run. Return true if |out_queue| indicates the queue to service or |
| 45 // false to avoid running any task. | 45 // false to avoid running any task. |
| 46 // | 46 // |
| 47 // This function is called on the main thread. | 47 // This function is called on the main thread. |
| 48 virtual bool SelectWorkQueueToService(size_t* out_queue_index) = 0; | 48 virtual bool SelectWorkQueueToService(size_t* out_queue_index) = 0; |
| 49 | 49 |
| 50 // Serialize the selector state for tracing. | 50 // Serialize the selector state for tracing. |
| 51 virtual void AsValueInto(base::trace_event::TracedValue* state) const = 0; | 51 virtual void AsValueInto(base::trace_event::TracedValue* state) const = 0; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace content | 54 } // namespace scheduler |
| 55 | 55 |
| 56 #endif // CONTENT_CHILD_SCHEDULER_TASK_QUEUE_SELECTOR_H_ | 56 #endif // COMPONENTS_SCHEDULER_CHILD_TASK_QUEUE_SELECTOR_H_ |
| OLD | NEW |