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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 class SchedulerClient { | 36 class SchedulerClient { |
37 public: | 37 public: |
38 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; | 38 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; |
39 virtual void ScheduledActionSendBeginMainFrame( | 39 virtual void ScheduledActionSendBeginMainFrame( |
40 const BeginFrameArgs& args) = 0; | 40 const BeginFrameArgs& args) = 0; |
41 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; | 41 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; |
42 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; | 42 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; |
43 virtual void ScheduledActionCommit() = 0; | 43 virtual void ScheduledActionCommit() = 0; |
44 virtual void ScheduledActionActivateSyncTree() = 0; | 44 virtual void ScheduledActionActivateSyncTree() = 0; |
45 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 45 virtual void ScheduledActionBeginCompositorFrameSinkCreation() = 0; |
46 virtual void ScheduledActionPrepareTiles() = 0; | 46 virtual void ScheduledActionPrepareTiles() = 0; |
47 virtual void ScheduledActionInvalidateOutputSurface() = 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 static std::unique_ptr<Scheduler> Create( |
58 SchedulerClient* client, | 58 SchedulerClient* client, |
59 const SchedulerSettings& scheduler_settings, | 59 const SchedulerSettings& scheduler_settings, |
60 int layer_tree_host_id, | 60 int layer_tree_host_id, |
61 base::SingleThreadTaskRunner* task_runner, | 61 base::SingleThreadTaskRunner* task_runner, |
62 BeginFrameSource* begin_frame_source, | 62 BeginFrameSource* begin_frame_source, |
63 std::unique_ptr<CompositorTimingHistory> compositor_timing_history); | 63 std::unique_ptr<CompositorTimingHistory> compositor_timing_history); |
64 | 64 |
65 ~Scheduler() override; | 65 ~Scheduler() override; |
66 | 66 |
67 // BeginFrameObserverBase | 67 // BeginFrameObserverBase |
68 void OnBeginFrameSourcePausedChanged(bool paused) override; | 68 void OnBeginFrameSourcePausedChanged(bool paused) override; |
69 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override; | 69 bool OnBeginFrameDerivedImpl(const BeginFrameArgs& args) override; |
70 | 70 |
71 void OnDrawForOutputSurface(bool resourceless_software_draw); | 71 void OnDrawForCompositorFrameSink(bool resourceless_software_draw); |
72 | 72 |
73 const SchedulerSettings& settings() const { return settings_; } | 73 const SchedulerSettings& settings() const { return settings_; } |
74 | 74 |
75 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); | 75 void SetEstimatedParentDrawTime(base::TimeDelta draw_time); |
76 | 76 |
77 void SetVisible(bool visible); | 77 void SetVisible(bool visible); |
78 bool visible() { return state_machine_.visible(); } | 78 bool visible() { return state_machine_.visible(); } |
79 void SetCanDraw(bool can_draw); | 79 void SetCanDraw(bool can_draw); |
80 void NotifyReadyToActivate(); | 80 void NotifyReadyToActivate(); |
81 void NotifyReadyToDraw(); | 81 void NotifyReadyToDraw(); |
(...skipping 13 matching lines...) Expand all Loading... |
95 | 95 |
96 void SetTreePrioritiesAndScrollState(TreePriority tree_priority, | 96 void SetTreePrioritiesAndScrollState(TreePriority tree_priority, |
97 ScrollHandlerState scroll_handler_state); | 97 ScrollHandlerState scroll_handler_state); |
98 | 98 |
99 void NotifyReadyToCommit(); | 99 void NotifyReadyToCommit(); |
100 void BeginMainFrameAborted(CommitEarlyOutReason reason); | 100 void BeginMainFrameAborted(CommitEarlyOutReason reason); |
101 void DidCommit(); | 101 void DidCommit(); |
102 | 102 |
103 void WillPrepareTiles(); | 103 void WillPrepareTiles(); |
104 void DidPrepareTiles(); | 104 void DidPrepareTiles(); |
105 void DidLoseOutputSurface(); | 105 void DidLoseCompositorFrameSink(); |
106 void DidCreateAndInitializeOutputSurface(); | 106 void DidCreateAndInitializeCompositorFrameSink(); |
107 | 107 |
108 // Tests do not want to shut down until all possible BeginMainFrames have | 108 // Tests do not want to shut down until all possible BeginMainFrames have |
109 // occured to prevent flakiness. | 109 // occured to prevent flakiness. |
110 bool MainFrameForTestingWillHappen() const { | 110 bool MainFrameForTestingWillHappen() const { |
111 return state_machine_.CommitPending() || | 111 return state_machine_.CommitPending() || |
112 state_machine_.CouldSendBeginMainFrame(); | 112 state_machine_.CouldSendBeginMainFrame(); |
113 } | 113 } |
114 | 114 |
115 bool CommitPending() const { return state_machine_.CommitPending(); } | 115 bool CommitPending() const { return state_machine_.CommitPending(); } |
116 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 116 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 214 } |
215 | 215 |
216 base::WeakPtrFactory<Scheduler> weak_factory_; | 216 base::WeakPtrFactory<Scheduler> weak_factory_; |
217 | 217 |
218 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 218 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
219 }; | 219 }; |
220 | 220 |
221 } // namespace cc | 221 } // namespace cc |
222 | 222 |
223 #endif // CC_SCHEDULER_SCHEDULER_H_ | 223 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |