| 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_SELECTOR_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_SELECTOR_H_ |
| 6 #define CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_SELECTOR_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_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 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class TaskQueue; | 13 class TaskQueue; |
| 14 namespace trace_event { | 14 namespace trace_event { |
| 15 class TracedValue; | 15 class TracedValue; |
| 16 } // namespace trace_event | 16 } // namespace trace_event |
| 17 } // namespace base | 17 } // namespace base |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 class TaskQueueSelector { | 21 class TaskQueueSelector { |
| 22 public: | 22 public: |
| 23 virtual ~TaskQueueSelector() {} | 23 virtual ~TaskQueueSelector() {} |
| 24 | 24 |
| 25 // Called once to register the work queues to be selected from. This function | 25 // Called once to register the work queues to be selected from. This function |
| 26 // is called on the main thread. | 26 // is called on the main thread. |
| 27 virtual void RegisterWorkQueues( | 27 virtual void RegisterWorkQueues( |
| 28 const std::vector<const base::TaskQueue*>& work_queues) = 0; | 28 const std::vector<const base::TaskQueue*>& work_queues) = 0; |
| 29 | 29 |
| 30 class TaskQueueSelectorObserver { |
| 31 public: |
| 32 virtual ~TaskQueueSelectorObserver() {} |
| 33 |
| 34 // Called when a task queue transitions from disabled to enabled. |
| 35 virtual void OnTaskQueueEnabled() = 0; |
| 36 }; |
| 37 |
| 38 // Called once to register TaskQueueSelectorObserver. This function is called |
| 39 // on the main thread. |
| 40 virtual void RegisterTaskQueueObserver( |
| 41 TaskQueueSelectorObserver* observer) = 0; |
| 42 |
| 30 // 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 |
| 31 // 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 |
| 32 // false to avoid running any task. | 45 // false to avoid running any task. |
| 33 // | 46 // |
| 34 // This function is called on the main thread. | 47 // This function is called on the main thread. |
| 35 virtual bool SelectWorkQueueToService(size_t* out_queue_index) = 0; | 48 virtual bool SelectWorkQueueToService(size_t* out_queue_index) = 0; |
| 36 | 49 |
| 37 // Serialize the selector state for tracing. | 50 // Serialize the selector state for tracing. |
| 38 virtual void AsValueInto(base::trace_event::TracedValue* state) const = 0; | 51 virtual void AsValueInto(base::trace_event::TracedValue* state) const = 0; |
| 39 }; | 52 }; |
| 40 | 53 |
| 41 } // namespace content | 54 } // namespace content |
| 42 | 55 |
| 43 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_SELECTOR_H_ | 56 #endif // CONTENT_RENDERER_SCHEDULER_TASK_QUEUE_SELECTOR_H_ |
| OLD | NEW |