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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 did_swap(false) {} | 26 did_swap(false) {} |
27 ScheduledActionDrawAndSwapResult(bool did_draw, bool did_swap) | 27 ScheduledActionDrawAndSwapResult(bool did_draw, bool did_swap) |
28 : did_draw(did_draw), | 28 : did_draw(did_draw), |
29 did_swap(did_swap) {} | 29 did_swap(did_swap) {} |
30 bool did_draw; | 30 bool did_draw; |
31 bool did_swap; | 31 bool did_swap; |
32 }; | 32 }; |
33 | 33 |
34 class SchedulerClient { | 34 class SchedulerClient { |
35 public: | 35 public: |
36 virtual void ScheduledActionBeginFrame() = 0; | 36 virtual void ScheduledActionSendBeginFrameToMainThread() = 0; |
37 virtual ScheduledActionDrawAndSwapResult | 37 virtual ScheduledActionDrawAndSwapResult |
38 ScheduledActionDrawAndSwapIfPossible() = 0; | 38 ScheduledActionDrawAndSwapIfPossible() = 0; |
39 virtual ScheduledActionDrawAndSwapResult | 39 virtual ScheduledActionDrawAndSwapResult |
40 ScheduledActionDrawAndSwapForced() = 0; | 40 ScheduledActionDrawAndSwapForced() = 0; |
41 virtual void ScheduledActionCommit() = 0; | 41 virtual void ScheduledActionCommit() = 0; |
42 virtual void ScheduledActionCheckForCompletedTileUploads() = 0; | 42 virtual void ScheduledActionCheckForCompletedTileUploads() = 0; |
43 virtual void ScheduledActionActivatePendingTreeIfNeeded() = 0; | 43 virtual void ScheduledActionActivatePendingTreeIfNeeded() = 0; |
44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
45 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; | 45 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; |
46 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 46 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; |
(...skipping 29 matching lines...) Expand all Loading... |
76 void SetNeedsRedraw(); | 76 void SetNeedsRedraw(); |
77 | 77 |
78 void SetMainThreadNeedsLayerTextures(); | 78 void SetMainThreadNeedsLayerTextures(); |
79 | 79 |
80 // Like SetNeedsRedraw(), but ensures the draw will definitely happen even if | 80 // Like SetNeedsRedraw(), but ensures the draw will definitely happen even if |
81 // we are not visible. | 81 // we are not visible. |
82 void SetNeedsForcedRedraw(); | 82 void SetNeedsForcedRedraw(); |
83 | 83 |
84 void DidSwapUseIncompleteTile(); | 84 void DidSwapUseIncompleteTile(); |
85 | 85 |
86 void BeginFrameComplete(); | 86 void FinishCommit(); |
87 void BeginFrameAborted(); | 87 void BeginFrameAbortedByMainThread(); |
88 | 88 |
89 void SetMaxFramesPending(int max); | 89 void SetMaxFramesPending(int max); |
90 int MaxFramesPending() const; | 90 int MaxFramesPending() const; |
91 int NumFramesPendingForTesting() const; | 91 int NumFramesPendingForTesting() const; |
92 | 92 |
93 void SetSwapBuffersCompleteSupported(bool supported); | 93 void SetSwapBuffersCompleteSupported(bool supported); |
94 void DidSwapBuffersComplete(); | 94 void DidSwapBuffersComplete(); |
95 | 95 |
96 void DidLoseOutputSurface(); | 96 void DidLoseOutputSurface(); |
97 void DidCreateAndInitializeOutputSurface(); | 97 void DidCreateAndInitializeOutputSurface(); |
98 bool HasInitializedOutputSurface() const { | 98 bool HasInitializedOutputSurface() const { |
99 return state_machine_.HasInitializedOutputSurface(); | 99 return state_machine_.HasInitializedOutputSurface(); |
100 } | 100 } |
101 | 101 |
102 bool CommitPending() const { return state_machine_.CommitPending(); } | 102 bool CommitPending() const { return state_machine_.CommitPending(); } |
103 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 103 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
104 | 104 |
105 bool WillDrawIfNeeded() const; | 105 bool WillDrawIfNeeded() const; |
106 | 106 |
107 void SetTimebaseAndInterval(base::TimeTicks timebase, | 107 void SetTimebaseAndInterval(base::TimeTicks timebase, |
108 base::TimeDelta interval); | 108 base::TimeDelta interval); |
109 | 109 |
110 base::TimeTicks AnticipatedDrawTime(); | 110 base::TimeTicks AnticipatedDrawTime(); |
111 | 111 |
112 base::TimeTicks LastVSyncTime(); | 112 base::TimeTicks LastBeginFrameOnImplThreadTime(); |
113 | 113 |
114 // FrameRateControllerClient implementation | 114 // FrameRateControllerClient implementation |
115 virtual void VSyncTick(bool throttled) OVERRIDE; | 115 virtual void BeginFrame(bool throttled) OVERRIDE; |
116 | 116 |
117 std::string StateAsStringForTesting() { return state_machine_.ToString(); } | 117 std::string StateAsStringForTesting() { return state_machine_.ToString(); } |
118 | 118 |
119 private: | 119 private: |
120 Scheduler(SchedulerClient* client, | 120 Scheduler(SchedulerClient* client, |
121 scoped_ptr<FrameRateController> frame_rate_controller, | 121 scoped_ptr<FrameRateController> frame_rate_controller, |
122 const SchedulerSettings& scheduler_settings); | 122 const SchedulerSettings& scheduler_settings); |
123 | 123 |
124 void ProcessScheduledActions(); | 124 void ProcessScheduledActions(); |
125 | 125 |
126 const SchedulerSettings settings_; | 126 const SchedulerSettings settings_; |
127 SchedulerClient* client_; | 127 SchedulerClient* client_; |
128 scoped_ptr<FrameRateController> frame_rate_controller_; | 128 scoped_ptr<FrameRateController> frame_rate_controller_; |
129 SchedulerStateMachine state_machine_; | 129 SchedulerStateMachine state_machine_; |
130 bool inside_process_scheduled_actions_; | 130 bool inside_process_scheduled_actions_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 132 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
133 }; | 133 }; |
134 | 134 |
135 } // namespace cc | 135 } // namespace cc |
136 | 136 |
137 #endif // CC_SCHEDULER_SCHEDULER_H_ | 137 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |