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 tree_id) { |
65 return make_scoped_ptr(new Scheduler(client, scheduler_settings, tree_id)); | |
65 } | 66 } |
66 | 67 |
67 virtual ~Scheduler(); | 68 virtual ~Scheduler(); |
68 | 69 |
69 void SetCanStart(); | 70 void SetCanStart(); |
70 | 71 |
71 void SetVisible(bool visible); | 72 void SetVisible(bool visible); |
72 void SetCanDraw(bool can_draw); | 73 void SetCanDraw(bool can_draw); |
73 void NotifyReadyToActivate(); | 74 void NotifyReadyToActivate(); |
74 | 75 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 scoped_ptr<base::Value> StateAsValue() { | 118 scoped_ptr<base::Value> StateAsValue() { |
118 return state_machine_.AsValue().Pass(); | 119 return state_machine_.AsValue().Pass(); |
119 } | 120 } |
120 | 121 |
121 bool IsInsideAction(SchedulerStateMachine::Action action) { | 122 bool IsInsideAction(SchedulerStateMachine::Action action) { |
122 return inside_action_ == action; | 123 return inside_action_ == action; |
123 } | 124 } |
124 | 125 |
125 private: | 126 private: |
126 Scheduler(SchedulerClient* client, | 127 Scheduler(SchedulerClient* client, |
127 const SchedulerSettings& scheduler_settings); | 128 const SchedulerSettings& scheduler_settings, |
129 int tree_id); | |
128 | 130 |
129 void PostBeginImplFrameDeadline(base::TimeTicks deadline); | 131 void PostBeginImplFrameDeadline(base::TimeTicks deadline); |
130 void SetupNextBeginImplFrameIfNeeded(); | 132 void SetupNextBeginImplFrameIfNeeded(); |
131 void ActivatePendingTree(); | 133 void ActivatePendingTree(); |
132 void DrawAndSwapIfPossible(); | 134 void DrawAndSwapIfPossible(); |
133 void DrawAndSwapForced(); | 135 void DrawAndSwapForced(); |
134 void DrawAndReadback(); | 136 void DrawAndReadback(); |
135 void ProcessScheduledActions(); | 137 void ProcessScheduledActions(); |
136 | 138 |
137 const SchedulerSettings settings_; | 139 const SchedulerSettings settings_; |
138 SchedulerClient* client_; | 140 SchedulerClient* client_; |
141 int tree_id_; | |
nduca
2013/11/06 19:05:12
can we call this layer_tree_host_id throughout? We
caseq
2013/11/07 06:36:26
Sure, done (everywhere except devtools_instrumenta
| |
139 | 142 |
140 bool last_set_needs_begin_impl_frame_; | 143 bool last_set_needs_begin_impl_frame_; |
141 BeginFrameArgs last_begin_impl_frame_args_; | 144 BeginFrameArgs last_begin_impl_frame_args_; |
142 base::CancelableClosure begin_impl_frame_deadline_closure_; | 145 base::CancelableClosure begin_impl_frame_deadline_closure_; |
143 base::CancelableClosure poll_for_draw_triggers_closure_; | 146 base::CancelableClosure poll_for_draw_triggers_closure_; |
144 | 147 |
145 SchedulerStateMachine state_machine_; | 148 SchedulerStateMachine state_machine_; |
146 bool inside_process_scheduled_actions_; | 149 bool inside_process_scheduled_actions_; |
147 SchedulerStateMachine::Action inside_action_; | 150 SchedulerStateMachine::Action inside_action_; |
148 | 151 |
149 base::WeakPtrFactory<Scheduler> weak_factory_; | 152 base::WeakPtrFactory<Scheduler> weak_factory_; |
150 | 153 |
151 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 154 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
152 }; | 155 }; |
153 | 156 |
154 } // namespace cc | 157 } // namespace cc |
155 | 158 |
156 #endif // CC_SCHEDULER_SCHEDULER_H_ | 159 #endif // CC_SCHEDULER_SCHEDULER_H_ |
OLD | NEW |