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 |
(...skipping 14 matching lines...) Expand all Loading... |
25 namespace debug { | 25 namespace debug { |
26 class ConvertableToTraceFormat; | 26 class ConvertableToTraceFormat; |
27 } | 27 } |
28 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
29 } | 29 } |
30 | 30 |
31 namespace cc { | 31 namespace cc { |
32 | 32 |
33 class SchedulerClient { | 33 class SchedulerClient { |
34 public: | 34 public: |
35 virtual BeginFrameSource* ExternalBeginFrameSource() = 0; | |
36 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; | 35 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; |
37 virtual void ScheduledActionSendBeginMainFrame() = 0; | 36 virtual void ScheduledActionSendBeginMainFrame() = 0; |
38 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; | 37 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; |
39 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; | 38 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; |
40 virtual void ScheduledActionAnimate() = 0; | 39 virtual void ScheduledActionAnimate() = 0; |
41 virtual void ScheduledActionCommit() = 0; | 40 virtual void ScheduledActionCommit() = 0; |
42 virtual void ScheduledActionUpdateVisibleTiles() = 0; | 41 virtual void ScheduledActionUpdateVisibleTiles() = 0; |
43 virtual void ScheduledActionActivateSyncTree() = 0; | 42 virtual void ScheduledActionActivateSyncTree() = 0; |
44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 43 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
45 virtual void ScheduledActionManageTiles() = 0; | 44 virtual void ScheduledActionManageTiles() = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
70 | 69 |
71 friend class Scheduler; | 70 friend class Scheduler; |
72 }; | 71 }; |
73 | 72 |
74 class CC_EXPORT Scheduler : public BeginFrameObserverMixIn { | 73 class CC_EXPORT Scheduler : public BeginFrameObserverMixIn { |
75 public: | 74 public: |
76 static scoped_ptr<Scheduler> Create( | 75 static scoped_ptr<Scheduler> Create( |
77 SchedulerClient* client, | 76 SchedulerClient* client, |
78 const SchedulerSettings& scheduler_settings, | 77 const SchedulerSettings& scheduler_settings, |
79 int layer_tree_host_id, | 78 int layer_tree_host_id, |
80 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { | 79 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 80 scoped_ptr<ExternalBeginFrameSource> external_begin_frame_source) { |
81 SchedulerFrameSourcesConstructor frame_sources_constructor; | 81 SchedulerFrameSourcesConstructor frame_sources_constructor; |
82 return make_scoped_ptr(new Scheduler(client, | 82 return make_scoped_ptr(new Scheduler(client, |
83 scheduler_settings, | 83 scheduler_settings, |
84 layer_tree_host_id, | 84 layer_tree_host_id, |
85 task_runner, | 85 task_runner, |
| 86 external_begin_frame_source.Pass(), |
86 &frame_sources_constructor)); | 87 &frame_sources_constructor)); |
87 } | 88 } |
88 | 89 |
89 virtual ~Scheduler(); | 90 virtual ~Scheduler(); |
90 | 91 |
91 const SchedulerSettings& settings() const { return settings_; } | 92 const SchedulerSettings& settings() const { return settings_; } |
92 | 93 |
93 void CommitVSyncParameters(base::TimeTicks timebase, | 94 void CommitVSyncParameters(base::TimeTicks timebase, |
94 base::TimeDelta interval); | 95 base::TimeDelta interval); |
95 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); | 96 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 158 } |
158 | 159 |
159 // BeginFrameObserverMixin | 160 // BeginFrameObserverMixin |
160 virtual bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; | 161 virtual bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; |
161 | 162 |
162 protected: | 163 protected: |
163 Scheduler(SchedulerClient* client, | 164 Scheduler(SchedulerClient* client, |
164 const SchedulerSettings& scheduler_settings, | 165 const SchedulerSettings& scheduler_settings, |
165 int layer_tree_host_id, | 166 int layer_tree_host_id, |
166 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 167 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 168 scoped_ptr<ExternalBeginFrameSource> external_begin_frame_source, |
167 SchedulerFrameSourcesConstructor* frame_sources_constructor); | 169 SchedulerFrameSourcesConstructor* frame_sources_constructor); |
168 | 170 |
169 // virtual for testing - Don't call these in the constructor or | 171 // virtual for testing - Don't call these in the constructor or |
170 // destructor! | 172 // destructor! |
171 virtual base::TimeTicks Now() const; | 173 virtual base::TimeTicks Now() const; |
172 | 174 |
173 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; | 175 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; |
174 BeginFrameSource* primary_frame_source_; | 176 BeginFrameSource* primary_frame_source_; |
175 BeginFrameSource* background_frame_source_; | 177 BeginFrameSource* background_frame_source_; |
176 | 178 |
177 // Storage when frame sources are internal | 179 // Storage when frame sources are internal |
178 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; | 180 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; |
179 scoped_ptr<SyntheticBeginFrameSource> background_frame_source_internal_; | 181 scoped_ptr<SyntheticBeginFrameSource> background_frame_source_internal_; |
| 182 scoped_ptr<ExternalBeginFrameSource> external_begin_frame_source_internal_; |
180 | 183 |
181 VSyncParameterObserver* vsync_observer_; | 184 VSyncParameterObserver* vsync_observer_; |
182 | 185 |
183 const SchedulerSettings settings_; | 186 const SchedulerSettings settings_; |
184 SchedulerClient* client_; | 187 SchedulerClient* client_; |
185 int layer_tree_host_id_; | 188 int layer_tree_host_id_; |
186 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 189 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
187 | 190 |
188 base::TimeDelta estimated_parent_draw_time_; | 191 base::TimeDelta estimated_parent_draw_time_; |
189 | 192 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 239 |
237 friend class SchedulerFrameSourcesConstructor; | 240 friend class SchedulerFrameSourcesConstructor; |
238 friend class TestSchedulerFrameSourcesConstructor; | 241 friend class TestSchedulerFrameSourcesConstructor; |
239 | 242 |
240 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 243 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
241 }; | 244 }; |
242 | 245 |
243 } // namespace cc | 246 } // namespace cc |
244 | 247 |
245 #endif // CC_SCHEDULER_SCHEDULER_H_ | 248 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |