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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 scoped_ptr<base::Value> StateAsValue() { | 119 scoped_ptr<base::Value> StateAsValue() { |
118 return state_machine_.AsValue().Pass(); | 120 return state_machine_.AsValue().Pass(); |
119 } | 121 } |
120 | 122 |
121 bool IsInsideAction(SchedulerStateMachine::Action action) { | 123 bool IsInsideAction(SchedulerStateMachine::Action action) { |
122 return inside_action_ == action; | 124 return inside_action_ == action; |
123 } | 125 } |
124 | 126 |
125 private: | 127 private: |
126 Scheduler(SchedulerClient* client, | 128 Scheduler(SchedulerClient* client, |
127 const SchedulerSettings& scheduler_settings); | 129 const SchedulerSettings& scheduler_settings, |
| 130 int layer_tree_host_id); |
128 | 131 |
129 void PostBeginImplFrameDeadline(base::TimeTicks deadline); | 132 void PostBeginImplFrameDeadline(base::TimeTicks deadline); |
130 void SetupNextBeginImplFrameIfNeeded(); | 133 void SetupNextBeginImplFrameIfNeeded(); |
131 void ActivatePendingTree(); | 134 void ActivatePendingTree(); |
132 void DrawAndSwapIfPossible(); | 135 void DrawAndSwapIfPossible(); |
133 void DrawAndSwapForced(); | 136 void DrawAndSwapForced(); |
134 void DrawAndReadback(); | 137 void DrawAndReadback(); |
135 void ProcessScheduledActions(); | 138 void ProcessScheduledActions(); |
136 | 139 |
137 const SchedulerSettings settings_; | 140 const SchedulerSettings settings_; |
138 SchedulerClient* client_; | 141 SchedulerClient* client_; |
| 142 int layer_tree_host_id_; |
139 | 143 |
140 bool last_set_needs_begin_impl_frame_; | 144 bool last_set_needs_begin_impl_frame_; |
141 BeginFrameArgs last_begin_impl_frame_args_; | 145 BeginFrameArgs last_begin_impl_frame_args_; |
142 base::CancelableClosure begin_impl_frame_deadline_closure_; | 146 base::CancelableClosure begin_impl_frame_deadline_closure_; |
143 base::CancelableClosure poll_for_draw_triggers_closure_; | 147 base::CancelableClosure poll_for_draw_triggers_closure_; |
144 | 148 |
145 SchedulerStateMachine state_machine_; | 149 SchedulerStateMachine state_machine_; |
146 bool inside_process_scheduled_actions_; | 150 bool inside_process_scheduled_actions_; |
147 SchedulerStateMachine::Action inside_action_; | 151 SchedulerStateMachine::Action inside_action_; |
148 | 152 |
149 base::WeakPtrFactory<Scheduler> weak_factory_; | 153 base::WeakPtrFactory<Scheduler> weak_factory_; |
150 | 154 |
151 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 155 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
152 }; | 156 }; |
153 | 157 |
154 } // namespace cc | 158 } // namespace cc |
155 | 159 |
156 #endif // CC_SCHEDULER_SCHEDULER_H_ | 160 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |