| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // This class abstracts the creation of the 3D context for the compositor. It is | 63 // This class abstracts the creation of the 3D context for the compositor. It is |
| 64 // a global object. | 64 // a global object. |
| 65 class COMPOSITOR_EXPORT ContextFactory { | 65 class COMPOSITOR_EXPORT ContextFactory { |
| 66 public: | 66 public: |
| 67 virtual ~ContextFactory() {} | 67 virtual ~ContextFactory() {} |
| 68 | 68 |
| 69 // Creates an output surface for the given compositor. The factory may keep | 69 // Creates an output surface for the given compositor. The factory may keep |
| 70 // per-compositor data (e.g. a shared context), that needs to be cleaned up | 70 // per-compositor data (e.g. a shared context), that needs to be cleaned up |
| 71 // by calling RemoveCompositor when the compositor gets destroyed. | 71 // by calling RemoveCompositor when the compositor gets destroyed. |
| 72 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface( | 72 virtual void CreateOutputSurface(base::WeakPtr<Compositor> compositor, |
| 73 Compositor* compositor, bool software_fallback) = 0; | 73 bool software_fallback) = 0; |
| 74 | 74 |
| 75 // Creates a reflector that copies the content of the |mirrored_compositor| | 75 // Creates a reflector that copies the content of the |mirrored_compositor| |
| 76 // onto |mirroing_layer|. | 76 // onto |mirroing_layer|. |
| 77 virtual scoped_refptr<Reflector> CreateReflector( | 77 virtual scoped_refptr<Reflector> CreateReflector( |
| 78 Compositor* mirrored_compositor, | 78 Compositor* mirrored_compositor, |
| 79 Layer* mirroring_layer) = 0; | 79 Layer* mirroring_layer) = 0; |
| 80 // Removes the reflector, which stops the mirroring. | 80 // Removes the reflector, which stops the mirroring. |
| 81 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) = 0; | 81 virtual void RemoveReflector(scoped_refptr<Reflector> reflector) = 0; |
| 82 | 82 |
| 83 // Return a reference to a shared offscreen context provider usable from the | 83 // Return a reference to a shared offscreen context provider usable from the |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ~Compositor() override; | 146 ~Compositor() override; |
| 147 | 147 |
| 148 ui::ContextFactory* context_factory() { return context_factory_; } | 148 ui::ContextFactory* context_factory() { return context_factory_; } |
| 149 | 149 |
| 150 void SetOutputSurface(scoped_ptr<cc::OutputSurface> surface); |
| 151 |
| 150 // Schedules a redraw of the layer tree associated with this compositor. | 152 // Schedules a redraw of the layer tree associated with this compositor. |
| 151 void ScheduleDraw(); | 153 void ScheduleDraw(); |
| 152 | 154 |
| 153 // Sets the root of the layer tree drawn by this Compositor. The root layer | 155 // 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 | 156 // 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 | 157 // is destroyed. NULL can be passed to reset the root layer, in which case the |
| 156 // compositor will stop drawing anything. | 158 // compositor will stop drawing anything. |
| 157 // The Compositor does not own the root layer. | 159 // The Compositor does not own the root layer. |
| 158 const Layer* root_layer() const { return root_layer_; } | 160 const Layer* root_layer() const { return root_layer_; } |
| 159 Layer* root_layer() { return root_layer_; } | 161 Layer* root_layer() { return root_layer_; } |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 bool defer_draw_scheduling_; | 332 bool defer_draw_scheduling_; |
| 331 | 333 |
| 332 // Used to prevent Draw()s while a composite is in progress. | 334 // Used to prevent Draw()s while a composite is in progress. |
| 333 bool waiting_on_compositing_end_; | 335 bool waiting_on_compositing_end_; |
| 334 bool draw_on_compositing_end_; | 336 bool draw_on_compositing_end_; |
| 335 enum SwapState { SWAP_NONE, SWAP_POSTED, SWAP_COMPLETED }; | 337 enum SwapState { SWAP_NONE, SWAP_POSTED, SWAP_COMPLETED }; |
| 336 SwapState swap_state_; | 338 SwapState swap_state_; |
| 337 | 339 |
| 338 LayerAnimatorCollection layer_animator_collection_; | 340 LayerAnimatorCollection layer_animator_collection_; |
| 339 | 341 |
| 340 base::WeakPtrFactory<Compositor> schedule_draw_factory_; | 342 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
| 341 | 343 |
| 342 DISALLOW_COPY_AND_ASSIGN(Compositor); | 344 DISALLOW_COPY_AND_ASSIGN(Compositor); |
| 343 }; | 345 }; |
| 344 | 346 |
| 345 } // namespace ui | 347 } // namespace ui |
| 346 | 348 |
| 347 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 349 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |