OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CC_SCHEDULER_SCHEDULER_H_ | 5 #ifndef CC_SCHEDULER_SCHEDULER_H_ |
6 #define CC_SCHEDULER_SCHEDULER_H_ | 6 #define CC_SCHEDULER_SCHEDULER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
16 #include "cc/output/begin_frame_args.h" | 16 #include "cc/output/begin_frame_args.h" |
17 #include "cc/scheduler/delay_based_time_source.h" | 17 #include "cc/scheduler/delay_based_time_source.h" |
18 #include "cc/scheduler/draw_result.h" | 18 #include "cc/scheduler/draw_result.h" |
19 #include "cc/scheduler/scheduler_settings.h" | 19 #include "cc/scheduler/scheduler_settings.h" |
20 #include "cc/scheduler/scheduler_state_machine.h" | 20 #include "cc/scheduler/scheduler_state_machine.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
| 23 namespace debug { |
| 24 class ConvertableToTraceFormat; |
| 25 } |
23 class SingleThreadTaskRunner; | 26 class SingleThreadTaskRunner; |
24 } | 27 } |
25 | 28 |
26 namespace cc { | 29 namespace cc { |
27 | 30 |
28 class SchedulerClient { | 31 class SchedulerClient { |
29 public: | 32 public: |
30 virtual void SetNeedsBeginFrame(bool enable) = 0; | 33 virtual void SetNeedsBeginFrame(bool enable) = 0; |
31 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; | 34 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; |
32 virtual void ScheduledActionSendBeginMainFrame() = 0; | 35 virtual void ScheduledActionSendBeginMainFrame() = 0; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void BeginFrame(const BeginFrameArgs& args); | 125 void BeginFrame(const BeginFrameArgs& args); |
123 void PostBeginRetroFrame(); | 126 void PostBeginRetroFrame(); |
124 void BeginRetroFrame(); | 127 void BeginRetroFrame(); |
125 void BeginUnthrottledFrame(); | 128 void BeginUnthrottledFrame(); |
126 | 129 |
127 void BeginImplFrame(const BeginFrameArgs& args); | 130 void BeginImplFrame(const BeginFrameArgs& args); |
128 void OnBeginImplFrameDeadline(); | 131 void OnBeginImplFrameDeadline(); |
129 void PollForAnticipatedDrawTriggers(); | 132 void PollForAnticipatedDrawTriggers(); |
130 void PollToAdvanceCommitState(); | 133 void PollToAdvanceCommitState(); |
131 | 134 |
132 scoped_ptr<base::Value> AsValue() const; | 135 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
133 | 136 |
134 bool IsInsideAction(SchedulerStateMachine::Action action) { | 137 bool IsInsideAction(SchedulerStateMachine::Action action) { |
135 return inside_action_ == action; | 138 return inside_action_ == action; |
136 } | 139 } |
137 | 140 |
138 bool IsBeginMainFrameSent() const; | 141 bool IsBeginMainFrameSent() const; |
139 void SetContinuousPainting(bool continuous_painting) { | 142 void SetContinuousPainting(bool continuous_painting) { |
140 state_machine_.SetContinuousPainting(continuous_painting); | 143 state_machine_.SetContinuousPainting(continuous_painting); |
141 } | 144 } |
142 | 145 |
(...skipping 11 matching lines...) Expand all Loading... |
154 // Activates future BeginFrames and, if activating, pushes the most | 157 // Activates future BeginFrames and, if activating, pushes the most |
155 // recently missed BeginFrame to the back of a retroactive queue. | 158 // recently missed BeginFrame to the back of a retroactive queue. |
156 void SetNeedsBeginFrame(bool needs_begin_frame, | 159 void SetNeedsBeginFrame(bool needs_begin_frame, |
157 std::deque<BeginFrameArgs>* begin_retro_frame_args); | 160 std::deque<BeginFrameArgs>* begin_retro_frame_args); |
158 | 161 |
159 bool IsActive() const; | 162 bool IsActive() const; |
160 | 163 |
161 // TimeSourceClient implementation of OnTimerTick triggers a BeginFrame. | 164 // TimeSourceClient implementation of OnTimerTick triggers a BeginFrame. |
162 virtual void OnTimerTick() OVERRIDE; | 165 virtual void OnTimerTick() OVERRIDE; |
163 | 166 |
164 scoped_ptr<base::Value> AsValue() const; | 167 void AsValueInto(base::debug::TracedValue* dict) const; |
165 | 168 |
166 private: | 169 private: |
167 BeginFrameArgs CreateSyntheticBeginFrameArgs(base::TimeTicks frame_time); | 170 BeginFrameArgs CreateSyntheticBeginFrameArgs(base::TimeTicks frame_time); |
168 | 171 |
169 Scheduler* scheduler_; | 172 Scheduler* scheduler_; |
170 scoped_refptr<DelayBasedTimeSource> time_source_; | 173 scoped_refptr<DelayBasedTimeSource> time_source_; |
171 }; | 174 }; |
172 | 175 |
173 Scheduler( | 176 Scheduler( |
174 SchedulerClient* client, | 177 SchedulerClient* client, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 void SetupSyntheticBeginFrames(); | 227 void SetupSyntheticBeginFrames(); |
225 | 228 |
226 base::WeakPtrFactory<Scheduler> weak_factory_; | 229 base::WeakPtrFactory<Scheduler> weak_factory_; |
227 | 230 |
228 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 231 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
229 }; | 232 }; |
230 | 233 |
231 } // namespace cc | 234 } // namespace cc |
232 | 235 |
233 #endif // CC_SCHEDULER_SCHEDULER_H_ | 236 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |