| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 class COMPOSITOR_EXPORT Compositor | 186 class COMPOSITOR_EXPORT Compositor |
| 187 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 187 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
| 188 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { | 188 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { |
| 189 public: | 189 public: |
| 190 Compositor(ui::ContextFactory* context_factory, | 190 Compositor(ui::ContextFactory* context_factory, |
| 191 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 191 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 192 ~Compositor() override; | 192 ~Compositor() override; |
| 193 | 193 |
| 194 ui::ContextFactory* context_factory() { return context_factory_; } | 194 ui::ContextFactory* context_factory() { return context_factory_; } |
| 195 | 195 |
| 196 void AddSurfaceClient(uint32_t client_id); |
| 197 void RemoveSurfaceClient(uint32_t client_id); |
| 198 const std::unordered_map<uint32_t, uint32_t>& SurfaceClientsForTesting() { |
| 199 return surface_clients_; |
| 200 } |
| 201 |
| 196 void SetOutputSurface(std::unique_ptr<cc::OutputSurface> surface); | 202 void SetOutputSurface(std::unique_ptr<cc::OutputSurface> surface); |
| 197 | 203 |
| 198 // Schedules a redraw of the layer tree associated with this compositor. | 204 // Schedules a redraw of the layer tree associated with this compositor. |
| 199 void ScheduleDraw(); | 205 void ScheduleDraw(); |
| 200 | 206 |
| 201 // Sets the root of the layer tree drawn by this Compositor. The root layer | 207 // Sets the root of the layer tree drawn by this Compositor. The root layer |
| 202 // must have no parent. The compositor's root layer is reset if the root layer | 208 // must have no parent. The compositor's root layer is reset if the root layer |
| 203 // is destroyed. NULL can be passed to reset the root layer, in which case the | 209 // is destroyed. NULL can be passed to reset the root layer, in which case the |
| 204 // compositor will stop drawing anything. | 210 // compositor will stop drawing anything. |
| 205 // The Compositor does not own the root layer. | 211 // The Compositor does not own the root layer. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 373 |
| 368 ui::ContextFactory* context_factory_; | 374 ui::ContextFactory* context_factory_; |
| 369 | 375 |
| 370 // The root of the Layer tree drawn by this compositor. | 376 // The root of the Layer tree drawn by this compositor. |
| 371 Layer* root_layer_; | 377 Layer* root_layer_; |
| 372 | 378 |
| 373 base::ObserverList<CompositorObserver, true> observer_list_; | 379 base::ObserverList<CompositorObserver, true> observer_list_; |
| 374 base::ObserverList<CompositorAnimationObserver> animation_observer_list_; | 380 base::ObserverList<CompositorAnimationObserver> animation_observer_list_; |
| 375 | 381 |
| 376 gfx::AcceleratedWidget widget_; | 382 gfx::AcceleratedWidget widget_; |
| 383 std::unordered_map<uint32_t, uint32_t> surface_clients_; |
| 377 bool widget_valid_; | 384 bool widget_valid_; |
| 378 bool output_surface_requested_; | 385 bool output_surface_requested_; |
| 379 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 386 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
| 380 scoped_refptr<cc::Layer> root_web_layer_; | 387 scoped_refptr<cc::Layer> root_web_layer_; |
| 381 std::unique_ptr<cc::LayerTreeHost> host_; | 388 std::unique_ptr<cc::LayerTreeHost> host_; |
| 382 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 389 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 383 | 390 |
| 384 // The manager of vsync parameters for this compositor. | 391 // The manager of vsync parameters for this compositor. |
| 385 scoped_refptr<CompositorVSyncManager> vsync_manager_; | 392 scoped_refptr<CompositorVSyncManager> vsync_manager_; |
| 386 | 393 |
| 387 // The device scale factor of the monitor that this compositor is compositing | 394 // The device scale factor of the monitor that this compositor is compositing |
| 388 // layers on. | 395 // layers on. |
| 389 float device_scale_factor_; | 396 float device_scale_factor_; |
| 390 | 397 |
| 391 bool locks_will_time_out_; | 398 bool locks_will_time_out_; |
| 392 CompositorLock* compositor_lock_; | 399 CompositorLock* compositor_lock_; |
| 393 | 400 |
| 394 LayerAnimatorCollection layer_animator_collection_; | 401 LayerAnimatorCollection layer_animator_collection_; |
| 395 scoped_refptr<cc::AnimationTimeline> animation_timeline_; | 402 scoped_refptr<cc::AnimationTimeline> animation_timeline_; |
| 396 | 403 |
| 397 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 404 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
| 398 | 405 |
| 399 DISALLOW_COPY_AND_ASSIGN(Compositor); | 406 DISALLOW_COPY_AND_ASSIGN(Compositor); |
| 400 }; | 407 }; |
| 401 | 408 |
| 402 } // namespace ui | 409 } // namespace ui |
| 403 | 410 |
| 404 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 411 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |