| 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_RENDERER_TASK_QUEUE_SELECTOR_H | 5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_TASK_QUEUE_SELECTOR_H |
| 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_TASK_QUEUE_SELECTOR_H | 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_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" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // queues are enabled with normal priority. | 48 // queues are enabled with normal priority. |
| 49 void EnableQueue(size_t queue_index, QueuePriority priority); | 49 void EnableQueue(size_t queue_index, QueuePriority priority); |
| 50 | 50 |
| 51 // Disable the |queue_index|. | 51 // Disable the |queue_index|. |
| 52 void DisableQueue(size_t queue_index); | 52 void DisableQueue(size_t queue_index); |
| 53 | 53 |
| 54 // TaskQueueSelector implementation: | 54 // TaskQueueSelector implementation: |
| 55 void RegisterWorkQueues( | 55 void RegisterWorkQueues( |
| 56 const std::vector<const base::TaskQueue*>& work_queues) override; | 56 const std::vector<const base::TaskQueue*>& work_queues) override; |
| 57 bool SelectWorkQueueToService(size_t* out_queue_index) override; | 57 bool SelectWorkQueueToService(size_t* out_queue_index) override; |
| 58 void AsValueInto(base::debug::TracedValue* state) const override; | 58 void AsValueInto(base::trace_event::TracedValue* state) const override; |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 // Returns true if queueA contains an older task than queueB. | 61 // Returns true if queueA contains an older task than queueB. |
| 62 static bool IsOlder(const base::TaskQueue* queueA, | 62 static bool IsOlder(const base::TaskQueue* queueA, |
| 63 const base::TaskQueue* queueB); | 63 const base::TaskQueue* queueB); |
| 64 | 64 |
| 65 // Returns the priority which is next after |priority|. | 65 // Returns the priority which is next after |priority|. |
| 66 static QueuePriority NextPriority(QueuePriority priority); | 66 static QueuePriority NextPriority(QueuePriority priority); |
| 67 | 67 |
| 68 static const char* PriorityToString(QueuePriority priority); | 68 static const char* PriorityToString(QueuePriority priority); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 89 base::ThreadChecker main_thread_checker_; | 89 base::ThreadChecker main_thread_checker_; |
| 90 std::vector<const base::TaskQueue*> work_queues_; | 90 std::vector<const base::TaskQueue*> work_queues_; |
| 91 std::set<size_t> queue_priorities_[QUEUE_PRIORITY_COUNT]; | 91 std::set<size_t> queue_priorities_[QUEUE_PRIORITY_COUNT]; |
| 92 size_t starvation_count_; | 92 size_t starvation_count_; |
| 93 DISALLOW_COPY_AND_ASSIGN(RendererTaskQueueSelector); | 93 DISALLOW_COPY_AND_ASSIGN(RendererTaskQueueSelector); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace content | 96 } // namespace content |
| 97 | 97 |
| 98 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_TASK_QUEUE_SELECTOR_H | 98 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_TASK_QUEUE_SELECTOR_H |
| OLD | NEW |