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 16 matching lines...) Expand all Loading... |
27 namespace debug { | 27 namespace debug { |
28 class ConvertableToTraceFormat; | 28 class ConvertableToTraceFormat; |
29 } | 29 } |
30 class SingleThreadTaskRunner; | 30 class SingleThreadTaskRunner; |
31 } | 31 } |
32 | 32 |
33 namespace cc { | 33 namespace cc { |
34 | 34 |
35 class SchedulerClient { | 35 class SchedulerClient { |
36 public: | 36 public: |
37 virtual BeginFrameSource* ExternalBeginFrameSource() = 0; | |
38 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; | 37 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; |
39 virtual void ScheduledActionSendBeginMainFrame() = 0; | 38 virtual void ScheduledActionSendBeginMainFrame() = 0; |
40 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; | 39 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; |
41 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; | 40 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; |
42 virtual void ScheduledActionAnimate() = 0; | 41 virtual void ScheduledActionAnimate() = 0; |
43 virtual void ScheduledActionCommit() = 0; | 42 virtual void ScheduledActionCommit() = 0; |
44 virtual void ScheduledActionUpdateVisibleTiles() = 0; | 43 virtual void ScheduledActionUpdateVisibleTiles() = 0; |
45 virtual void ScheduledActionActivateSyncTree() = 0; | 44 virtual void ScheduledActionActivateSyncTree() = 0; |
46 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 45 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
47 virtual void ScheduledActionManageTiles() = 0; | 46 virtual void ScheduledActionManageTiles() = 0; |
(...skipping 26 matching lines...) Expand all Loading... |
74 }; | 73 }; |
75 | 74 |
76 class CC_EXPORT Scheduler : public BeginFrameObserverMixIn, | 75 class CC_EXPORT Scheduler : public BeginFrameObserverMixIn, |
77 public base::PowerObserver { | 76 public base::PowerObserver { |
78 public: | 77 public: |
79 static scoped_ptr<Scheduler> Create( | 78 static scoped_ptr<Scheduler> Create( |
80 SchedulerClient* client, | 79 SchedulerClient* client, |
81 const SchedulerSettings& scheduler_settings, | 80 const SchedulerSettings& scheduler_settings, |
82 int layer_tree_host_id, | 81 int layer_tree_host_id, |
83 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 82 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
84 base::PowerMonitor* power_monitor) { | 83 base::PowerMonitor* power_monitor, |
| 84 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
85 SchedulerFrameSourcesConstructor frame_sources_constructor; | 85 SchedulerFrameSourcesConstructor frame_sources_constructor; |
86 return make_scoped_ptr(new Scheduler(client, | 86 return make_scoped_ptr(new Scheduler(client, |
87 scheduler_settings, | 87 scheduler_settings, |
88 layer_tree_host_id, | 88 layer_tree_host_id, |
89 task_runner, | 89 task_runner, |
90 power_monitor, | 90 power_monitor, |
| 91 external_begin_frame_source.Pass(), |
91 &frame_sources_constructor)); | 92 &frame_sources_constructor)); |
92 } | 93 } |
93 | 94 |
94 ~Scheduler() override; | 95 ~Scheduler() override; |
95 | 96 |
96 // base::PowerObserver method. | 97 // base::PowerObserver method. |
97 void OnPowerStateChange(bool on_battery_power) override; | 98 void OnPowerStateChange(bool on_battery_power) override; |
98 | 99 |
99 const SchedulerSettings& settings() const { return settings_; } | 100 const SchedulerSettings& settings() const { return settings_; } |
100 | 101 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 167 |
167 // BeginFrameObserverMixin | 168 // BeginFrameObserverMixin |
168 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; | 169 bool OnBeginFrameMixInDelegate(const BeginFrameArgs& args) override; |
169 | 170 |
170 protected: | 171 protected: |
171 Scheduler(SchedulerClient* client, | 172 Scheduler(SchedulerClient* client, |
172 const SchedulerSettings& scheduler_settings, | 173 const SchedulerSettings& scheduler_settings, |
173 int layer_tree_host_id, | 174 int layer_tree_host_id, |
174 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 175 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
175 base::PowerMonitor* power_monitor, | 176 base::PowerMonitor* power_monitor, |
| 177 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
176 SchedulerFrameSourcesConstructor* frame_sources_constructor); | 178 SchedulerFrameSourcesConstructor* frame_sources_constructor); |
177 | 179 |
178 // virtual for testing - Don't call these in the constructor or | 180 // virtual for testing - Don't call these in the constructor or |
179 // destructor! | 181 // destructor! |
180 virtual base::TimeTicks Now() const; | 182 virtual base::TimeTicks Now() const; |
181 | 183 |
182 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; | 184 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; |
183 BeginFrameSource* primary_frame_source_; | 185 BeginFrameSource* primary_frame_source_; |
184 BeginFrameSource* background_frame_source_; | 186 BeginFrameSource* background_frame_source_; |
185 | 187 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 251 |
250 friend class SchedulerFrameSourcesConstructor; | 252 friend class SchedulerFrameSourcesConstructor; |
251 friend class TestSchedulerFrameSourcesConstructor; | 253 friend class TestSchedulerFrameSourcesConstructor; |
252 | 254 |
253 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 255 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
254 }; | 256 }; |
255 | 257 |
256 } // namespace cc | 258 } // namespace cc |
257 | 259 |
258 #endif // CC_SCHEDULER_SCHEDULER_H_ | 260 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |