OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_COMPOSITOR_COMPOSITOR_H_ | 5 #ifndef UI_COMPOSITOR_COMPOSITOR_H_ |
6 #define UI_COMPOSITOR_COMPOSITOR_H_ | 6 #define UI_COMPOSITOR_COMPOSITOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // displayable form of pixels comprising a single widget's contents. It draws an | 136 // displayable form of pixels comprising a single widget's contents. It draws an |
137 // appropriately transformed texture for each transformed view in the widget's | 137 // appropriately transformed texture for each transformed view in the widget's |
138 // view hierarchy. | 138 // view hierarchy. |
139 class COMPOSITOR_EXPORT Compositor | 139 class COMPOSITOR_EXPORT Compositor |
140 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 140 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
141 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { | 141 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { |
142 public: | 142 public: |
143 Compositor(gfx::AcceleratedWidget widget, | 143 Compositor(gfx::AcceleratedWidget widget, |
144 ui::ContextFactory* context_factory, | 144 ui::ContextFactory* context_factory, |
145 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 145 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
146 virtual ~Compositor(); | 146 ~Compositor() override; |
147 | 147 |
148 ui::ContextFactory* context_factory() { return context_factory_; } | 148 ui::ContextFactory* context_factory() { return context_factory_; } |
149 | 149 |
150 // Schedules a redraw of the layer tree associated with this compositor. | 150 // Schedules a redraw of the layer tree associated with this compositor. |
151 void ScheduleDraw(); | 151 void ScheduleDraw(); |
152 | 152 |
153 // Sets the root of the layer tree drawn by this Compositor. The root layer | 153 // Sets the root of the layer tree drawn by this Compositor. The root layer |
154 // must have no parent. The compositor's root layer is reset if the root layer | 154 // must have no parent. The compositor's root layer is reset if the root layer |
155 // is destroyed. NULL can be passed to reset the root layer, in which case the | 155 // is destroyed. NULL can be passed to reset the root layer, in which case the |
156 // compositor will stop drawing anything. | 156 // compositor will stop drawing anything. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // Signals swap has been posted. | 230 // Signals swap has been posted. |
231 void OnSwapBuffersPosted(); | 231 void OnSwapBuffersPosted(); |
232 | 232 |
233 // Signals swap has completed. | 233 // Signals swap has completed. |
234 void OnSwapBuffersComplete(); | 234 void OnSwapBuffersComplete(); |
235 | 235 |
236 // Signals swap has aborted (e.g. lost context). | 236 // Signals swap has aborted (e.g. lost context). |
237 void OnSwapBuffersAborted(); | 237 void OnSwapBuffersAborted(); |
238 | 238 |
239 // LayerTreeHostClient implementation. | 239 // LayerTreeHostClient implementation. |
240 virtual void WillBeginMainFrame(int frame_id) override {} | 240 void WillBeginMainFrame(int frame_id) override {} |
241 virtual void DidBeginMainFrame() override {} | 241 void DidBeginMainFrame() override {} |
242 virtual void BeginMainFrame(const cc::BeginFrameArgs& args) override; | 242 void BeginMainFrame(const cc::BeginFrameArgs& args) override; |
243 virtual void Layout() override; | 243 void Layout() override; |
244 virtual void ApplyViewportDeltas( | 244 void ApplyViewportDeltas(const gfx::Vector2d& inner_delta, |
245 const gfx::Vector2d& inner_delta, | 245 const gfx::Vector2d& outer_delta, |
246 const gfx::Vector2d& outer_delta, | 246 float page_scale, |
247 float page_scale, | 247 float top_controls_delta) override {} |
248 float top_controls_delta) override {} | 248 void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, |
249 virtual void ApplyViewportDeltas( | 249 float page_scale, |
250 const gfx::Vector2d& scroll_delta, | 250 float top_controls_delta) override {} |
251 float page_scale, | 251 void RequestNewOutputSurface(bool fallback) override; |
252 float top_controls_delta) override {} | 252 void DidInitializeOutputSurface() override {} |
253 virtual void RequestNewOutputSurface(bool fallback) override; | 253 void WillCommit() override {} |
254 virtual void DidInitializeOutputSurface() override {} | 254 void DidCommit() override; |
255 virtual void WillCommit() override {} | 255 void DidCommitAndDrawFrame() override; |
256 virtual void DidCommit() override; | 256 void DidCompleteSwapBuffers() override; |
257 virtual void DidCommitAndDrawFrame() override; | |
258 virtual void DidCompleteSwapBuffers() override; | |
259 | 257 |
260 // cc::LayerTreeHostSingleThreadClient implementation. | 258 // cc::LayerTreeHostSingleThreadClient implementation. |
261 virtual void ScheduleComposite() override; | 259 void ScheduleComposite() override; |
262 virtual void ScheduleAnimation() override; | 260 void ScheduleAnimation() override; |
263 virtual void DidPostSwapBuffers() override; | 261 void DidPostSwapBuffers() override; |
264 virtual void DidAbortSwapBuffers() override; | 262 void DidAbortSwapBuffers() override; |
265 | 263 |
266 int last_started_frame() { return last_started_frame_; } | 264 int last_started_frame() { return last_started_frame_; } |
267 int last_ended_frame() { return last_ended_frame_; } | 265 int last_ended_frame() { return last_ended_frame_; } |
268 | 266 |
269 bool IsLocked() { return compositor_lock_ != NULL; } | 267 bool IsLocked() { return compositor_lock_ != NULL; } |
270 | 268 |
271 const cc::LayerTreeDebugState& GetLayerTreeDebugState() const; | 269 const cc::LayerTreeDebugState& GetLayerTreeDebugState() const; |
272 void SetLayerTreeDebugState(const cc::LayerTreeDebugState& debug_state); | 270 void SetLayerTreeDebugState(const cc::LayerTreeDebugState& debug_state); |
273 | 271 |
274 LayerAnimatorCollection* layer_animator_collection() { | 272 LayerAnimatorCollection* layer_animator_collection() { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 LayerAnimatorCollection layer_animator_collection_; | 338 LayerAnimatorCollection layer_animator_collection_; |
341 | 339 |
342 base::WeakPtrFactory<Compositor> schedule_draw_factory_; | 340 base::WeakPtrFactory<Compositor> schedule_draw_factory_; |
343 | 341 |
344 DISALLOW_COPY_AND_ASSIGN(Compositor); | 342 DISALLOW_COPY_AND_ASSIGN(Compositor); |
345 }; | 343 }; |
346 | 344 |
347 } // namespace ui | 345 } // namespace ui |
348 | 346 |
349 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 347 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |