| 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_PRIORITIZING_TASK_QUEUE_SELECTOR_H_ | 5 #ifndef COMPONENTS_SCHEDULER_CHILD_PRIORITIZING_TASK_QUEUE_SELECTOR_H_ |
| 6 #define CONTENT_CHILD_SCHEDULER_PRIORITIZING_TASK_QUEUE_SELECTOR_H_ | 6 #define COMPONENTS_SCHEDULER_CHILD_PRIORITIZING_TASK_QUEUE_SELECTOR_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "content/child/scheduler/task_queue_selector.h" | 12 #include "components/scheduler/child/task_queue_selector.h" |
| 13 #include "content/common/content_export.h" | 13 #include "components/scheduler/scheduler_export.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace scheduler { |
| 16 | 16 |
| 17 // A PrioritizingTaskQueueSelector is a TaskQueueSelector which is used by the | 17 // A PrioritizingTaskQueueSelector is a TaskQueueSelector which is used by the |
| 18 // SchedulerHelper to enable prioritization of particular task queues. | 18 // SchedulerHelper to enable prioritization of particular task queues. |
| 19 class CONTENT_EXPORT PrioritizingTaskQueueSelector | 19 class SCHEDULER_EXPORT PrioritizingTaskQueueSelector |
| 20 : NON_EXPORTED_BASE(public TaskQueueSelector) { | 20 : NON_EXPORTED_BASE(public TaskQueueSelector) { |
| 21 public: | 21 public: |
| 22 enum QueuePriority { | 22 enum QueuePriority { |
| 23 // Queues with control priority will run before any other queue, and will | 23 // Queues with control priority will run before any other queue, and will |
| 24 // explicitly starve other queues. Typically this should only be used for | 24 // explicitly starve other queues. Typically this should only be used for |
| 25 // private queues which perform control operations. | 25 // private queues which perform control operations. |
| 26 CONTROL_PRIORITY, | 26 CONTROL_PRIORITY, |
| 27 // Queues with high priority will be selected preferentially over normal or | 27 // Queues with high priority will be selected preferentially over normal or |
| 28 // best effort queues. The selector will ensure that high priority queues | 28 // best effort queues. The selector will ensure that high priority queues |
| 29 // cannot completely starve normal priority queues. | 29 // cannot completely starve normal priority queues. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 static const size_t kMaxStarvationTasks = 5; | 96 static const size_t kMaxStarvationTasks = 5; |
| 97 | 97 |
| 98 base::ThreadChecker main_thread_checker_; | 98 base::ThreadChecker main_thread_checker_; |
| 99 std::vector<const base::TaskQueue*> work_queues_; | 99 std::vector<const base::TaskQueue*> work_queues_; |
| 100 std::set<size_t> queue_priorities_[QUEUE_PRIORITY_COUNT]; | 100 std::set<size_t> queue_priorities_[QUEUE_PRIORITY_COUNT]; |
| 101 size_t starvation_count_; | 101 size_t starvation_count_; |
| 102 Observer* task_queue_selector_observer_; // NOT OWNED | 102 Observer* task_queue_selector_observer_; // NOT OWNED |
| 103 DISALLOW_COPY_AND_ASSIGN(PrioritizingTaskQueueSelector); | 103 DISALLOW_COPY_AND_ASSIGN(PrioritizingTaskQueueSelector); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace content | 106 } // namespace scheduler |
| 107 | 107 |
| 108 #endif // CONTENT_CHILD_SCHEDULER_PRIORITIZING_TASK_QUEUE_SELECTOR_H_ | 108 #endif // COMPONENTS_SCHEDULER_CHILD_PRIORITIZING_TASK_QUEUE_SELECTOR_H_ |
| OLD | NEW |