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_SCHEDULER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ |
6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ |
7 | 7 |
8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "content/renderer/scheduler/renderer_scheduler.h" | 11 #include "content/renderer/scheduler/renderer_scheduler.h" |
12 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" | 12 #include "content/renderer/scheduler/single_thread_idle_task_runner.h" |
13 #include "content/renderer/scheduler/task_queue_manager.h" | 13 #include "content/renderer/scheduler/task_queue_manager.h" |
14 | 14 |
| 15 namespace base { |
| 16 namespace debug { |
| 17 class ConvertableToTraceFormat; |
| 18 } |
| 19 } |
| 20 |
15 namespace content { | 21 namespace content { |
16 | 22 |
17 class RendererTaskQueueSelector; | 23 class RendererTaskQueueSelector; |
18 | 24 |
19 class RendererSchedulerImpl : public RendererScheduler, | 25 class RendererSchedulerImpl : public RendererScheduler, |
20 private IdleTaskDeadlineSupplier { | 26 private IdleTaskDeadlineSupplier { |
21 public: | 27 public: |
22 RendererSchedulerImpl(); | 28 RendererSchedulerImpl(); |
23 ~RendererSchedulerImpl() override; | 29 ~RendererSchedulerImpl() override; |
24 | 30 |
(...skipping 26 matching lines...) Expand all Loading... |
51 CONTROL_TASK_QUEUE, | 57 CONTROL_TASK_QUEUE, |
52 // Must be the last entry. | 58 // Must be the last entry. |
53 TASK_QUEUE_COUNT, | 59 TASK_QUEUE_COUNT, |
54 }; | 60 }; |
55 | 61 |
56 enum Policy { | 62 enum Policy { |
57 NORMAL_PRIORITY_POLICY, | 63 NORMAL_PRIORITY_POLICY, |
58 COMPOSITOR_PRIORITY_POLICY, | 64 COMPOSITOR_PRIORITY_POLICY, |
59 }; | 65 }; |
60 | 66 |
| 67 // Returns the serialized scheduler state for tracing. |
| 68 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueLocked( |
| 69 base::TimeTicks optional_now) const; |
| 70 static const char* TaskQueueIdToString(QueueId queue_id); |
| 71 static const char* PolicyToString(Policy policy); |
| 72 |
61 // The time we should stay in CompositorPriority mode for after a touch event. | 73 // The time we should stay in CompositorPriority mode for after a touch event. |
62 static const int kCompositorPriorityAfterTouchMillis = 100; | 74 static const int kCompositorPriorityAfterTouchMillis = 100; |
63 | 75 |
64 // IdleTaskDeadlineSupplier Implementation: | 76 // IdleTaskDeadlineSupplier Implementation: |
65 base::TimeTicks CurrentIdleTaskDeadline() const override; | 77 base::TimeTicks CurrentIdleTaskDeadline() const override; |
66 | 78 |
67 // Returns the current scheduler policy. This may involve updating the | 79 // Returns the current scheduler policy. This may involve updating the |
68 // current policy if a new signal has arrived. Must be called from the main | 80 // current policy if a new signal has arrived. Must be called from the main |
69 // thread. | 81 // thread. |
70 Policy SchedulerPolicy(); | 82 Policy SchedulerPolicy(); |
(...skipping 27 matching lines...) Expand all Loading... |
98 base::TimeTicks last_input_time_; | 110 base::TimeTicks last_input_time_; |
99 base::subtle::AtomicWord policy_may_need_update_; | 111 base::subtle::AtomicWord policy_may_need_update_; |
100 | 112 |
101 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_; | 113 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_; |
102 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 114 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
103 }; | 115 }; |
104 | 116 |
105 } // namespace content | 117 } // namespace content |
106 | 118 |
107 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ | 119 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ |
OLD | NEW |