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