| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // This class abstracts the creation of the 3D context for the compositor. It is | 62 // This class abstracts the creation of the 3D context for the compositor. It is |
| 63 // a global object. | 63 // a global object. |
| 64 class COMPOSITOR_EXPORT ContextFactory { | 64 class COMPOSITOR_EXPORT ContextFactory { |
| 65 public: | 65 public: |
| 66 virtual ~ContextFactory() {} | 66 virtual ~ContextFactory() {} |
| 67 | 67 |
| 68 // Creates an output surface for the given compositor. The factory may keep | 68 // Creates an output surface for the given compositor. The factory may keep |
| 69 // per-compositor data (e.g. a shared context), that needs to be cleaned up | 69 // per-compositor data (e.g. a shared context), that needs to be cleaned up |
| 70 // by calling RemoveCompositor when the compositor gets destroyed. | 70 // by calling RemoveCompositor when the compositor gets destroyed. |
| 71 virtual void CreateOutputSurface(base::WeakPtr<Compositor> compositor, | 71 virtual void CreateOutputSurface(base::WeakPtr<Compositor> compositor) = 0; |
| 72 bool software_fallback) = 0; | |
| 73 | 72 |
| 74 // Creates a reflector that copies the content of the |mirrored_compositor| | 73 // Creates a reflector that copies the content of the |mirrored_compositor| |
| 75 // onto |mirroring_layer|. | 74 // onto |mirroring_layer|. |
| 76 virtual scoped_refptr<Reflector> CreateReflector( | 75 virtual scoped_refptr<Reflector> CreateReflector( |
| 77 Compositor* mirrored_compositor, | 76 Compositor* mirrored_compositor, |
| 78 Layer* mirroring_layer) = 0; | 77 Layer* mirroring_layer) = 0; |
| 79 // Removes the reflector, which stops the mirroring. | 78 // Removes the reflector, which stops the mirroring. |
| 80 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) = 0; | 79 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) = 0; |
| 81 | 80 |
| 82 // Return a reference to a shared offscreen context provider usable from the | 81 // Return a reference to a shared offscreen context provider usable from the |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 } | 278 } |
| 280 | 279 |
| 281 cc::SurfaceIdAllocator* surface_id_allocator() { | 280 cc::SurfaceIdAllocator* surface_id_allocator() { |
| 282 return surface_id_allocator_.get(); | 281 return surface_id_allocator_.get(); |
| 283 } | 282 } |
| 284 | 283 |
| 285 private: | 284 private: |
| 286 friend class base::RefCounted<Compositor>; | 285 friend class base::RefCounted<Compositor>; |
| 287 friend class CompositorLock; | 286 friend class CompositorLock; |
| 288 | 287 |
| 289 enum { | |
| 290 OUTPUT_SURFACE_RETRIES_BEFORE_FALLBACK = 4, | |
| 291 MAX_OUTPUT_SURFACE_RETRIES = 5, | |
| 292 }; | |
| 293 | |
| 294 // Called by CompositorLock. | 288 // Called by CompositorLock. |
| 295 void UnlockCompositor(); | 289 void UnlockCompositor(); |
| 296 | 290 |
| 297 // Called to release any pending CompositorLock | 291 // Called to release any pending CompositorLock |
| 298 void CancelCompositorLock(); | 292 void CancelCompositorLock(); |
| 299 | 293 |
| 300 gfx::Size size_; | 294 gfx::Size size_; |
| 301 | 295 |
| 302 ui::ContextFactory* context_factory_; | 296 ui::ContextFactory* context_factory_; |
| 303 | 297 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 316 // The manager of vsync parameters for this compositor. | 310 // The manager of vsync parameters for this compositor. |
| 317 scoped_refptr<CompositorVSyncManager> vsync_manager_; | 311 scoped_refptr<CompositorVSyncManager> vsync_manager_; |
| 318 | 312 |
| 319 // The device scale factor of the monitor that this compositor is compositing | 313 // The device scale factor of the monitor that this compositor is compositing |
| 320 // layers on. | 314 // layers on. |
| 321 float device_scale_factor_; | 315 float device_scale_factor_; |
| 322 | 316 |
| 323 int last_started_frame_; | 317 int last_started_frame_; |
| 324 int last_ended_frame_; | 318 int last_ended_frame_; |
| 325 | 319 |
| 326 int num_failed_recreate_attempts_; | |
| 327 | |
| 328 bool disable_schedule_composite_; | 320 bool disable_schedule_composite_; |
| 329 | 321 |
| 330 CompositorLock* compositor_lock_; | 322 CompositorLock* compositor_lock_; |
| 331 | 323 |
| 332 LayerAnimatorCollection layer_animator_collection_; | 324 LayerAnimatorCollection layer_animator_collection_; |
| 333 | 325 |
| 334 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 326 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
| 335 | 327 |
| 336 DISALLOW_COPY_AND_ASSIGN(Compositor); | 328 DISALLOW_COPY_AND_ASSIGN(Compositor); |
| 337 }; | 329 }; |
| 338 | 330 |
| 339 } // namespace ui | 331 } // namespace ui |
| 340 | 332 |
| 341 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 333 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |