| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 virtual void ScheduledActionInvalidateCompositorFrameSink() = 0; | 47 virtual void ScheduledActionInvalidateCompositorFrameSink() = 0; |
| 48 virtual void DidFinishImplFrame() = 0; | 48 virtual void DidFinishImplFrame() = 0; |
| 49 virtual void SendBeginMainFrameNotExpectedSoon() = 0; | 49 virtual void SendBeginMainFrameNotExpectedSoon() = 0; |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 virtual ~SchedulerClient() {} | 52 virtual ~SchedulerClient() {} |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 class CC_EXPORT Scheduler : public BeginFrameObserverBase { | 55 class CC_EXPORT Scheduler : public BeginFrameObserverBase { |
| 56 public: | 56 public: |
| 57 static std::unique_ptr<Scheduler> Create( | 57 Scheduler(SchedulerClient* client, |
| 58 SchedulerClient* client, | 58 const SchedulerSettings& scheduler_settings, |
| 59 const SchedulerSettings& scheduler_settings, | 59 int layer_tree_host_id, |
| 60 int layer_tree_host_id, | 60 base::SingleThreadTaskRunner* task_runner, |
| 61 base::SingleThreadTaskRunner* task_runner, | 61 std::unique_ptr<CompositorTimingHistory> compositor_timing_history); |
| 62 BeginFrameSource* begin_frame_source, | |
| 63 std::unique_ptr<CompositorTimingHistory> compositor_timing_history); | |
| 64 | |
| 65 ~Scheduler() override; | 62 ~Scheduler() override; |
| 66 | 63 |
| 67 // BeginFrameObserverBase | 64 // BeginFrameObserverBase |
| 68 void OnBeginFrameSourcePausedChanged(bool paused) override; | 65 void OnBeginFrameSourcePausedChanged(bool paused) override; |
| 69 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override; | 66 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override; |
| 70 | 67 |
| 71 void OnDrawForCompositorFrameSink(bool resourceless_software_draw); | 68 void OnDrawForCompositorFrameSink(bool resourceless_software_draw); |
| 72 | 69 |
| 73 const SchedulerSettings& settings() const { return settings_; } | 70 const SchedulerSettings& settings() const { return settings_; } |
| 74 | 71 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 128 |
| 132 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 129 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
| 133 | 130 |
| 134 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); | 131 void SetVideoNeedsBeginFrames(bool video_needs_begin_frames); |
| 135 | 132 |
| 136 const BeginFrameSource* begin_frame_source() const { | 133 const BeginFrameSource* begin_frame_source() const { |
| 137 return begin_frame_source_; | 134 return begin_frame_source_; |
| 138 } | 135 } |
| 139 | 136 |
| 140 protected: | 137 protected: |
| 141 Scheduler(SchedulerClient* client, | |
| 142 const SchedulerSettings& scheduler_settings, | |
| 143 int layer_tree_host_id, | |
| 144 base::SingleThreadTaskRunner* task_runner, | |
| 145 BeginFrameSource* begin_frame_source, | |
| 146 std::unique_ptr<CompositorTimingHistory> compositor_timing_history); | |
| 147 | |
| 148 // Virtual for testing. | 138 // Virtual for testing. |
| 149 virtual base::TimeTicks Now() const; | 139 virtual base::TimeTicks Now() const; |
| 150 | 140 |
| 151 const SchedulerSettings settings_; | 141 const SchedulerSettings settings_; |
| 152 // Not owned. | 142 // Not owned. |
| 153 SchedulerClient* client_; | 143 SchedulerClient* client_; |
| 154 int layer_tree_host_id_; | 144 int layer_tree_host_id_; |
| 155 base::SingleThreadTaskRunner* task_runner_; | 145 base::SingleThreadTaskRunner* task_runner_; |
| 156 | 146 |
| 157 // Not owned. May be null. | 147 // Not owned. May be null. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 197 } |
| 208 | 198 |
| 209 base::WeakPtrFactory<Scheduler> weak_factory_; | 199 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 210 | 200 |
| 211 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 201 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 212 }; | 202 }; |
| 213 | 203 |
| 214 } // namespace cc | 204 } // namespace cc |
| 215 | 205 |
| 216 #endif // CC_SCHEDULER_SCHEDULER_H_ | 206 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |