| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 virtual void DidBeginImplFrameDeadline() = 0; | 53 virtual void DidBeginImplFrameDeadline() = 0; |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 virtual ~SchedulerClient() {} | 56 virtual ~SchedulerClient() {} |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class CC_EXPORT Scheduler { | 59 class CC_EXPORT Scheduler { |
| 60 public: | 60 public: |
| 61 static scoped_ptr<Scheduler> Create( | 61 static scoped_ptr<Scheduler> Create( |
| 62 SchedulerClient* client, | 62 SchedulerClient* client, |
| 63 const SchedulerSettings& scheduler_settings) { | 63 const SchedulerSettings& scheduler_settings, |
| 64 return make_scoped_ptr(new Scheduler(client, scheduler_settings)); | 64 int layer_tree_host_id) { |
| 65 return make_scoped_ptr( |
| 66 new Scheduler(client, scheduler_settings, layer_tree_host_id)); |
| 65 } | 67 } |
| 66 | 68 |
| 67 virtual ~Scheduler(); | 69 virtual ~Scheduler(); |
| 68 | 70 |
| 69 void SetCanStart(); | 71 void SetCanStart(); |
| 70 | 72 |
| 71 void SetVisible(bool visible); | 73 void SetVisible(bool visible); |
| 72 void SetCanDraw(bool can_draw); | 74 void SetCanDraw(bool can_draw); |
| 73 void NotifyReadyToActivate(); | 75 void NotifyReadyToActivate(); |
| 74 | 76 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 scoped_ptr<base::Value> StateAsValue() { | 122 scoped_ptr<base::Value> StateAsValue() { |
| 121 return state_machine_.AsValue().Pass(); | 123 return state_machine_.AsValue().Pass(); |
| 122 } | 124 } |
| 123 | 125 |
| 124 bool IsInsideAction(SchedulerStateMachine::Action action) { | 126 bool IsInsideAction(SchedulerStateMachine::Action action) { |
| 125 return inside_action_ == action; | 127 return inside_action_ == action; |
| 126 } | 128 } |
| 127 | 129 |
| 128 private: | 130 private: |
| 129 Scheduler(SchedulerClient* client, | 131 Scheduler(SchedulerClient* client, |
| 130 const SchedulerSettings& scheduler_settings); | 132 const SchedulerSettings& scheduler_settings, |
| 133 int layer_tree_host_id); |
| 131 | 134 |
| 132 void PostBeginImplFrameDeadline(base::TimeTicks deadline); | 135 void PostBeginImplFrameDeadline(base::TimeTicks deadline); |
| 133 void SetupNextBeginImplFrameIfNeeded(); | 136 void SetupNextBeginImplFrameIfNeeded(); |
| 134 void ActivatePendingTree(); | 137 void ActivatePendingTree(); |
| 135 void DrawAndSwapIfPossible(); | 138 void DrawAndSwapIfPossible(); |
| 136 void DrawAndSwapForced(); | 139 void DrawAndSwapForced(); |
| 137 void DrawAndReadback(); | 140 void DrawAndReadback(); |
| 138 void ProcessScheduledActions(); | 141 void ProcessScheduledActions(); |
| 139 | 142 |
| 140 bool CanCommitAndActivateBeforeDeadline() const; | 143 bool CanCommitAndActivateBeforeDeadline() const; |
| 141 void AdvanceCommitStateIfPossible(); | 144 void AdvanceCommitStateIfPossible(); |
| 142 | 145 |
| 143 const SchedulerSettings settings_; | 146 const SchedulerSettings settings_; |
| 144 SchedulerClient* client_; | 147 SchedulerClient* client_; |
| 148 int layer_tree_host_id_; |
| 145 | 149 |
| 146 bool last_set_needs_begin_impl_frame_; | 150 bool last_set_needs_begin_impl_frame_; |
| 147 BeginFrameArgs last_begin_impl_frame_args_; | 151 BeginFrameArgs last_begin_impl_frame_args_; |
| 148 base::CancelableClosure begin_impl_frame_deadline_closure_; | 152 base::CancelableClosure begin_impl_frame_deadline_closure_; |
| 149 base::CancelableClosure poll_for_draw_triggers_closure_; | 153 base::CancelableClosure poll_for_draw_triggers_closure_; |
| 150 base::RepeatingTimer<Scheduler> advance_commit_state_timer_; | 154 base::RepeatingTimer<Scheduler> advance_commit_state_timer_; |
| 151 | 155 |
| 152 SchedulerStateMachine state_machine_; | 156 SchedulerStateMachine state_machine_; |
| 153 bool inside_process_scheduled_actions_; | 157 bool inside_process_scheduled_actions_; |
| 154 SchedulerStateMachine::Action inside_action_; | 158 SchedulerStateMachine::Action inside_action_; |
| 155 | 159 |
| 156 base::WeakPtrFactory<Scheduler> weak_factory_; | 160 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 157 | 161 |
| 158 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 162 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 159 }; | 163 }; |
| 160 | 164 |
| 161 } // namespace cc | 165 } // namespace cc |
| 162 | 166 |
| 163 #endif // CC_SCHEDULER_SCHEDULER_H_ | 167 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |