OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_POLICY_H_ | |
6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_POLICY_H_ | |
7 | |
8 #include "base/task/task_queue_selector.h" | |
9 #include "base/threading/thread_checker.h" | |
10 | |
11 namespace content { | |
12 | |
13 class RendererSchedulerSelector : public base::TaskQueueSelector { | |
14 public: | |
15 enum QueuePriority { | |
16 kControlPriority, | |
17 kHighPriority, | |
18 kNormalPriority, | |
19 kBestEffortPriority, | |
20 // Must be the last entry. | |
21 kQueuePriorityCount, | |
22 }; | |
23 | |
24 RendererSchedulerSelector(); | |
25 virtual ~RendererSchedulerSelector(); | |
26 | |
27 // Set the priority of |queue_id| to |set_priority|. | |
28 void SetQueuePriority(size_t queue_id, QueuePriority set_priority); | |
29 | |
30 // Enable the |queue_id| with a priority of |priority|. | |
Sami
2014/10/20 13:31:09
Are all queues enabled or disabled by default? Pro
petrcermak
2014/10/20 17:43:36
This is explained on renderer_scheduler_selector.c
rmcilroy
2014/10/21 17:21:28
Done.
| |
31 void EnableQueue(size_t queue_id, QueuePriority priority); | |
32 | |
33 // Disable the |queue_id|. | |
34 void DisableQueue(size_t queue_id); | |
35 | |
36 // TaskQueueSelector implementation: | |
37 virtual void RegisterWorkQueues( | |
38 const std::vector<const base::TaskQueue*>& work_queues) override; | |
39 virtual bool SelectWorkQueueToService(size_t* out_queue_index) override; | |
petrcermak
2014/10/20 17:43:36
Why is the queue index called "queue_id" when it's
rmcilroy
2014/10/21 17:21:28
Good catch. Changed all to queue_index
| |
40 | |
41 private: | |
42 // Return true if |out_queue_index| indicates the index of the queue with | |
43 // the oldest pending task from the set of queues of |priority|, or | |
44 // false if all queues of that priority are empty. | |
45 bool ChooseOldestWithPriority( | |
46 QueuePriority priority, size_t* out_queue_index); | |
47 | |
48 // Returns true if |out_queue_index| indicates the index of the control queue, | |
49 // or false if there is no control queue. | |
50 bool ControlQueueId(size_t* out_queue_index); | |
Sami
2014/10/20 13:31:09
Unused?
rmcilroy
2014/10/21 17:21:28
Removed, thanks.
| |
51 | |
52 // Returns true if |queue_id| is enabled with the given |priority|. | |
53 bool QueueEnabledWithPriority(size_t queue_id, QueuePriority priority); | |
Sami
2014/10/20 13:31:09
nit: const
rmcilroy
2014/10/21 17:21:28
Done.
| |
54 | |
55 QueuePriority NextPriorty(QueuePriority priority); | |
Sami
2014/10/20 13:31:09
typo: Priority
| |
56 | |
57 base::ThreadChecker main_thread_checker_; | |
58 std::vector<const base::TaskQueue*> work_queues_; | |
59 size_t queue_priorities_[kQueuePriorityCount]; | |
60 }; | |
61 | |
62 } // namespace content | |
63 | |
64 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_POLICY_H_ | |
OLD | NEW |