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 CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { | 25 class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { |
20 public: | 26 public: |
21 RendererSchedulerImpl( | 27 RendererSchedulerImpl( |
22 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 28 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
23 ~RendererSchedulerImpl() override; | 29 ~RendererSchedulerImpl() override; |
24 | 30 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 bool IsSet() const; | 73 bool IsSet() const; |
68 | 74 |
69 private: | 75 private: |
70 base::subtle::Atomic32 flag_; | 76 base::subtle::Atomic32 flag_; |
71 base::Lock* write_lock_; // Not owned. | 77 base::Lock* write_lock_; // Not owned. |
72 base::ThreadChecker thread_checker_; | 78 base::ThreadChecker thread_checker_; |
73 | 79 |
74 DISALLOW_COPY_AND_ASSIGN(PollableNeedsUpdateFlag); | 80 DISALLOW_COPY_AND_ASSIGN(PollableNeedsUpdateFlag); |
75 }; | 81 }; |
76 | 82 |
| 83 // Returns the serialized scheduler state for tracing. |
| 84 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueLocked( |
| 85 base::TimeTicks optional_now) const; |
| 86 static const char* TaskQueueIdToString(QueueId queue_id); |
| 87 static const char* PolicyToString(Policy policy); |
| 88 |
77 // The time we should stay in CompositorPriority mode for after a touch event. | 89 // The time we should stay in CompositorPriority mode for after a touch event. |
78 static const int kCompositorPriorityAfterTouchMillis = 100; | 90 static const int kCompositorPriorityAfterTouchMillis = 100; |
79 | 91 |
80 // IdleTaskDeadlineSupplier Implementation: | 92 // IdleTaskDeadlineSupplier Implementation: |
81 void CurrentIdleTaskDeadlineCallback(base::TimeTicks* deadline_out) const; | 93 void CurrentIdleTaskDeadlineCallback(base::TimeTicks* deadline_out) const; |
82 | 94 |
83 // Returns the current scheduler policy. Must be called from the main thread. | 95 // Returns the current scheduler policy. Must be called from the main thread. |
84 Policy SchedulerPolicy() const; | 96 Policy SchedulerPolicy() const; |
85 | 97 |
86 // Posts a call to UpdatePolicy on the control runner to be run after |delay| | 98 // Posts a call to UpdatePolicy on the control runner to be run after |delay| |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 136 |
125 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_; | 137 base::WeakPtr<RendererSchedulerImpl> weak_renderer_scheduler_ptr_; |
126 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; | 138 base::WeakPtrFactory<RendererSchedulerImpl> weak_factory_; |
127 | 139 |
128 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); | 140 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImpl); |
129 }; | 141 }; |
130 | 142 |
131 } // namespace content | 143 } // namespace content |
132 | 144 |
133 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ | 145 #endif // CONTENT_RENDERER_SCHEDULER_RENDERER_SCHEDULER_IMPL_H_ |
OLD | NEW |