| 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 26 matching lines...) Expand all Loading... |
| 37 virtual void ScheduledActionSendBeginMainFrame() = 0; | 37 virtual void ScheduledActionSendBeginMainFrame() = 0; |
| 38 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() = 0; | 38 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() = 0; |
| 39 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() = 0; | 39 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() = 0; |
| 40 virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() = 0; | 40 virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() = 0; |
| 41 virtual void ScheduledActionCommit() = 0; | 41 virtual void ScheduledActionCommit() = 0; |
| 42 virtual void ScheduledActionUpdateVisibleTiles() = 0; | 42 virtual void ScheduledActionUpdateVisibleTiles() = 0; |
| 43 virtual void ScheduledActionActivatePendingTree() = 0; | 43 virtual void ScheduledActionActivatePendingTree() = 0; |
| 44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
| 45 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; | 45 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; |
| 46 virtual void ScheduledActionManageTiles() = 0; | 46 virtual void ScheduledActionManageTiles() = 0; |
| 47 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; | 47 virtual void DidAnticipatedDrawTimeChange(gfx::FrameTime time) = 0; |
| 48 virtual base::TimeDelta DrawDurationEstimate() = 0; | 48 virtual base::TimeDelta DrawDurationEstimate() = 0; |
| 49 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; | 49 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() = 0; |
| 50 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; | 50 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; |
| 51 virtual void PostBeginImplFrameDeadline(const base::Closure& closure, | 51 virtual void PostBeginImplFrameDeadline( |
| 52 base::TimeTicks deadline) = 0; | 52 const base::Closure& closure, |
| 53 gfx::FrameTime deadline) = 0; |
| 53 virtual void DidBeginImplFrameDeadline() = 0; | 54 virtual void DidBeginImplFrameDeadline() = 0; |
| 54 | 55 |
| 55 protected: | 56 protected: |
| 56 virtual ~SchedulerClient() {} | 57 virtual ~SchedulerClient() {} |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 class CC_EXPORT Scheduler { | 60 class CC_EXPORT Scheduler { |
| 60 public: | 61 public: |
| 61 static scoped_ptr<Scheduler> Create( | 62 static scoped_ptr<Scheduler> Create( |
| 62 SchedulerClient* client, | 63 SchedulerClient* client, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 99 } |
| 99 | 100 |
| 100 bool CommitPending() const { return state_machine_.CommitPending(); } | 101 bool CommitPending() const { return state_machine_.CommitPending(); } |
| 101 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 102 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
| 102 bool ManageTilesPending() const { | 103 bool ManageTilesPending() const { |
| 103 return state_machine_.ManageTilesPending(); | 104 return state_machine_.ManageTilesPending(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 bool WillDrawIfNeeded() const; | 107 bool WillDrawIfNeeded() const; |
| 107 | 108 |
| 108 base::TimeTicks AnticipatedDrawTime(); | 109 gfx::FrameTime AnticipatedDrawTime(); |
| 109 | 110 |
| 110 base::TimeTicks LastBeginImplFrameTime(); | 111 gfx::FrameTime LastBeginImplFrameTime(); |
| 111 | 112 |
| 112 void BeginImplFrame(const BeginFrameArgs& args); | 113 void BeginImplFrame(const BeginFrameArgs& args); |
| 113 void OnBeginImplFrameDeadline(); | 114 void OnBeginImplFrameDeadline(); |
| 114 void PollForAnticipatedDrawTriggers(); | 115 void PollForAnticipatedDrawTriggers(); |
| 115 | 116 |
| 116 scoped_ptr<base::Value> StateAsValue() { | 117 scoped_ptr<base::Value> StateAsValue() { |
| 117 return state_machine_.AsValue().Pass(); | 118 return state_machine_.AsValue().Pass(); |
| 118 } | 119 } |
| 119 | 120 |
| 120 bool IsInsideAction(SchedulerStateMachine::Action action) { | 121 bool IsInsideAction(SchedulerStateMachine::Action action) { |
| 121 return inside_action_ == action; | 122 return inside_action_ == action; |
| 122 } | 123 } |
| 123 | 124 |
| 124 private: | 125 private: |
| 125 Scheduler(SchedulerClient* client, | 126 Scheduler(SchedulerClient* client, |
| 126 const SchedulerSettings& scheduler_settings); | 127 const SchedulerSettings& scheduler_settings); |
| 127 | 128 |
| 128 void PostBeginImplFrameDeadline(base::TimeTicks deadline); | 129 void PostBeginImplFrameDeadline(gfx::FrameTime deadline); |
| 129 void SetupNextBeginImplFrameIfNeeded(); | 130 void SetupNextBeginImplFrameIfNeeded(); |
| 130 void ActivatePendingTree(); | 131 void ActivatePendingTree(); |
| 131 void DrawAndSwapIfPossible(); | 132 void DrawAndSwapIfPossible(); |
| 132 void DrawAndSwapForced(); | 133 void DrawAndSwapForced(); |
| 133 void DrawAndReadback(); | 134 void DrawAndReadback(); |
| 134 void ProcessScheduledActions(); | 135 void ProcessScheduledActions(); |
| 135 | 136 |
| 136 const SchedulerSettings settings_; | 137 const SchedulerSettings settings_; |
| 137 SchedulerClient* client_; | 138 SchedulerClient* client_; |
| 138 | 139 |
| 139 bool last_set_needs_begin_impl_frame_; | 140 bool last_set_needs_begin_impl_frame_; |
| 140 BeginFrameArgs last_begin_impl_frame_args_; | 141 BeginFrameArgs last_begin_impl_frame_args_; |
| 141 base::CancelableClosure begin_impl_frame_deadline_closure_; | 142 base::CancelableClosure begin_impl_frame_deadline_closure_; |
| 142 base::CancelableClosure poll_for_draw_triggers_closure_; | 143 base::CancelableClosure poll_for_draw_triggers_closure_; |
| 143 | 144 |
| 144 SchedulerStateMachine state_machine_; | 145 SchedulerStateMachine state_machine_; |
| 145 bool inside_process_scheduled_actions_; | 146 bool inside_process_scheduled_actions_; |
| 146 SchedulerStateMachine::Action inside_action_; | 147 SchedulerStateMachine::Action inside_action_; |
| 147 | 148 |
| 148 base::WeakPtrFactory<Scheduler> weak_factory_; | 149 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 149 | 150 |
| 150 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 151 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 } // namespace cc | 154 } // namespace cc |
| 154 | 155 |
| 155 #endif // CC_SCHEDULER_SCHEDULER_H_ | 156 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |