| 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 24 matching lines...) Expand all Loading... |
| 35 virtual void SetNeedsBeginFrameOnImplThread(bool enable) = 0; | 35 virtual void SetNeedsBeginFrameOnImplThread(bool enable) = 0; |
| 36 virtual void ScheduledActionSendBeginFrameToMainThread() = 0; | 36 virtual void ScheduledActionSendBeginFrameToMainThread() = 0; |
| 37 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() = 0; | 37 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() = 0; |
| 38 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() = 0; | 38 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() = 0; |
| 39 virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() = 0; | 39 virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() = 0; |
| 40 virtual void ScheduledActionCommit() = 0; | 40 virtual void ScheduledActionCommit() = 0; |
| 41 virtual void ScheduledActionUpdateVisibleTiles() = 0; | 41 virtual void ScheduledActionUpdateVisibleTiles() = 0; |
| 42 virtual void ScheduledActionActivatePendingTree() = 0; | 42 virtual void ScheduledActionActivatePendingTree() = 0; |
| 43 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 43 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
| 44 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; | 44 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; |
| 45 virtual void ScheduledActionManageTiles() = 0; |
| 45 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 46 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; |
| 46 virtual base::TimeDelta DrawDurationEstimate() = 0; | 47 virtual base::TimeDelta DrawDurationEstimate() = 0; |
| 47 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() = 0; | 48 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() = 0; |
| 48 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; | 49 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; |
| 49 | 50 |
| 50 protected: | 51 protected: |
| 51 virtual ~SchedulerClient() {} | 52 virtual ~SchedulerClient() {} |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 class CC_EXPORT Scheduler { | 55 class CC_EXPORT Scheduler { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 68 void NotifyReadyToActivate(); | 69 void NotifyReadyToActivate(); |
| 69 | 70 |
| 70 void SetNeedsCommit(); | 71 void SetNeedsCommit(); |
| 71 | 72 |
| 72 // Like SetNeedsCommit(), but ensures a commit will definitely happen even if | 73 // Like SetNeedsCommit(), but ensures a commit will definitely happen even if |
| 73 // we are not visible. Will eventually result in a forced draw internally. | 74 // we are not visible. Will eventually result in a forced draw internally. |
| 74 void SetNeedsForcedCommitForReadback(); | 75 void SetNeedsForcedCommitForReadback(); |
| 75 | 76 |
| 76 void SetNeedsRedraw(); | 77 void SetNeedsRedraw(); |
| 77 | 78 |
| 79 void SetNeedsManageTiles(); |
| 80 |
| 78 void SetMainThreadNeedsLayerTextures(); | 81 void SetMainThreadNeedsLayerTextures(); |
| 79 | 82 |
| 80 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); | 83 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); |
| 81 | 84 |
| 82 void FinishCommit(); | 85 void FinishCommit(); |
| 83 void BeginFrameAbortedByMainThread(bool did_handle); | 86 void BeginFrameAbortedByMainThread(bool did_handle); |
| 84 | 87 |
| 85 void DidLoseOutputSurface(); | 88 void DidLoseOutputSurface(); |
| 86 void DidCreateAndInitializeOutputSurface(); | 89 void DidCreateAndInitializeOutputSurface(); |
| 87 bool HasInitializedOutputSurface() const { | 90 bool HasInitializedOutputSurface() const { |
| 88 return state_machine_.HasInitializedOutputSurface(); | 91 return state_machine_.HasInitializedOutputSurface(); |
| 89 } | 92 } |
| 90 | 93 |
| 91 bool CommitPending() const { return state_machine_.CommitPending(); } | 94 bool CommitPending() const { return state_machine_.CommitPending(); } |
| 92 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 95 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
| 96 bool ManageTilesPending() const { |
| 97 return state_machine_.ManageTilesPending(); |
| 98 } |
| 93 | 99 |
| 94 bool WillDrawIfNeeded() const; | 100 bool WillDrawIfNeeded() const; |
| 95 | 101 |
| 96 base::TimeTicks AnticipatedDrawTime(); | 102 base::TimeTicks AnticipatedDrawTime(); |
| 97 | 103 |
| 98 base::TimeTicks LastBeginFrameOnImplThreadTime(); | 104 base::TimeTicks LastBeginFrameOnImplThreadTime(); |
| 99 | 105 |
| 100 void BeginFrame(const BeginFrameArgs& args); | 106 void BeginFrame(const BeginFrameArgs& args); |
| 101 void PollForAnticipatedDrawTriggers(); | 107 void PollForAnticipatedDrawTriggers(); |
| 102 | 108 |
| 103 scoped_ptr<base::Value> StateAsValue() { | 109 scoped_ptr<base::Value> StateAsValue() { |
| 104 return state_machine_.AsValue().Pass(); | 110 return state_machine_.AsValue().Pass(); |
| 105 } | 111 } |
| 106 | 112 |
| 113 bool IsInsideAction(SchedulerStateMachine::Action action) { |
| 114 return inside_action_ == action; |
| 115 } |
| 116 |
| 107 private: | 117 private: |
| 108 Scheduler(SchedulerClient* client, | 118 Scheduler(SchedulerClient* client, |
| 109 const SchedulerSettings& scheduler_settings); | 119 const SchedulerSettings& scheduler_settings); |
| 110 | 120 |
| 111 void SetupNextBeginFrameIfNeeded(); | 121 void SetupNextBeginFrameIfNeeded(); |
| 112 void DrawAndSwapIfPossible(); | 122 void DrawAndSwapIfPossible(); |
| 113 void DrawAndSwapForced(); | 123 void DrawAndSwapForced(); |
| 114 void DrawAndReadback(); | 124 void DrawAndReadback(); |
| 115 void ProcessScheduledActions(); | 125 void ProcessScheduledActions(); |
| 116 | 126 |
| 117 const SchedulerSettings settings_; | 127 const SchedulerSettings settings_; |
| 118 SchedulerClient* client_; | 128 SchedulerClient* client_; |
| 119 | 129 |
| 120 base::WeakPtrFactory<Scheduler> weak_factory_; | 130 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 121 bool last_set_needs_begin_frame_; | 131 bool last_set_needs_begin_frame_; |
| 122 bool has_pending_begin_frame_; | 132 bool has_pending_begin_frame_; |
| 123 BeginFrameArgs last_begin_frame_args_; | 133 BeginFrameArgs last_begin_frame_args_; |
| 124 base::CancelableClosure poll_for_draw_triggers_closure_; | 134 base::CancelableClosure poll_for_draw_triggers_closure_; |
| 125 | 135 |
| 126 SchedulerStateMachine state_machine_; | 136 SchedulerStateMachine state_machine_; |
| 127 bool inside_process_scheduled_actions_; | 137 bool inside_process_scheduled_actions_; |
| 138 SchedulerStateMachine::Action inside_action_; |
| 128 | 139 |
| 129 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 140 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 130 }; | 141 }; |
| 131 | 142 |
| 132 } // namespace cc | 143 } // namespace cc |
| 133 | 144 |
| 134 #endif // CC_SCHEDULER_SCHEDULER_H_ | 145 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |