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