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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Gets the shared bitmap manager for software mode. | 122 // Gets the shared bitmap manager for software mode. |
123 virtual cc::SharedBitmapManager* GetSharedBitmapManager() = 0; | 123 virtual cc::SharedBitmapManager* GetSharedBitmapManager() = 0; |
124 | 124 |
125 // Gets the GPU memory buffer manager. | 125 // Gets the GPU memory buffer manager. |
126 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0; | 126 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0; |
127 | 127 |
128 // Gets the task graph runner. | 128 // Gets the task graph runner. |
129 virtual cc::TaskGraphRunner* GetTaskGraphRunner() = 0; | 129 virtual cc::TaskGraphRunner* GetTaskGraphRunner() = 0; |
130 | 130 |
131 // Creates a Surface ID allocator with a new namespace. | 131 // Creates a Surface ID allocator with a new namespace. |
132 virtual std::unique_ptr<cc::SurfaceIdAllocator> | 132 virtual uint32_t AllocateSurfaceClientId() = 0; |
133 CreateSurfaceIdAllocator() = 0; | |
134 | 133 |
135 // Gets the surface manager. | 134 // Gets the surface manager. |
136 virtual cc::SurfaceManager* GetSurfaceManager() = 0; | 135 virtual cc::SurfaceManager* GetSurfaceManager() = 0; |
137 | 136 |
138 // Resize the display corresponding to this compositor to a particular size. | 137 // Resize the display corresponding to this compositor to a particular size. |
139 virtual void ResizeDisplay(ui::Compositor* compositor, | 138 virtual void ResizeDisplay(ui::Compositor* compositor, |
140 const gfx::Size& size) = 0; | 139 const gfx::Size& size) = 0; |
141 | 140 |
142 // Set the output color profile into which this compositor should render. | 141 // Set the output color profile into which this compositor should render. |
143 virtual void SetDisplayColorSpace(ui::Compositor* compositor, | 142 virtual void SetDisplayColorSpace(ui::Compositor* compositor, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 class COMPOSITOR_EXPORT Compositor | 186 class COMPOSITOR_EXPORT Compositor |
188 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 187 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
189 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { | 188 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { |
190 public: | 189 public: |
191 Compositor(ui::ContextFactory* context_factory, | 190 Compositor(ui::ContextFactory* context_factory, |
192 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 191 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
193 ~Compositor() override; | 192 ~Compositor() override; |
194 | 193 |
195 ui::ContextFactory* context_factory() { return context_factory_; } | 194 ui::ContextFactory* context_factory() { return context_factory_; } |
196 | 195 |
| 196 bool initialized() const { return initialized_; } |
| 197 |
197 void SetOutputSurface(std::unique_ptr<cc::OutputSurface> surface); | 198 void SetOutputSurface(std::unique_ptr<cc::OutputSurface> surface); |
198 | 199 |
199 // Schedules a redraw of the layer tree associated with this compositor. | 200 // Schedules a redraw of the layer tree associated with this compositor. |
200 void ScheduleDraw(); | 201 void ScheduleDraw(); |
201 | 202 |
202 // Sets the root of the layer tree drawn by this Compositor. The root layer | 203 // Sets the root of the layer tree drawn by this Compositor. The root layer |
203 // must have no parent. The compositor's root layer is reset if the root layer | 204 // must have no parent. The compositor's root layer is reset if the root layer |
204 // is destroyed. NULL can be passed to reset the root layer, in which case the | 205 // is destroyed. NULL can be passed to reset the root layer, in which case the |
205 // compositor will stop drawing anything. | 206 // compositor will stop drawing anything. |
206 // The Compositor does not own the root layer. | 207 // The Compositor does not own the root layer. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 gfx::Size size_; | 368 gfx::Size size_; |
368 | 369 |
369 ui::ContextFactory* context_factory_; | 370 ui::ContextFactory* context_factory_; |
370 | 371 |
371 // The root of the Layer tree drawn by this compositor. | 372 // The root of the Layer tree drawn by this compositor. |
372 Layer* root_layer_; | 373 Layer* root_layer_; |
373 | 374 |
374 base::ObserverList<CompositorObserver, true> observer_list_; | 375 base::ObserverList<CompositorObserver, true> observer_list_; |
375 base::ObserverList<CompositorAnimationObserver> animation_observer_list_; | 376 base::ObserverList<CompositorAnimationObserver> animation_observer_list_; |
376 | 377 |
| 378 bool initialized_; |
377 gfx::AcceleratedWidget widget_; | 379 gfx::AcceleratedWidget widget_; |
378 bool widget_valid_; | 380 bool widget_valid_; |
379 bool output_surface_requested_; | 381 bool output_surface_requested_; |
380 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 382 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
381 scoped_refptr<cc::Layer> root_web_layer_; | 383 scoped_refptr<cc::Layer> root_web_layer_; |
382 std::unique_ptr<cc::LayerTreeHost> host_; | 384 std::unique_ptr<cc::LayerTreeHost> host_; |
383 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 385 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
384 | 386 |
385 // The manager of vsync parameters for this compositor. | 387 // The manager of vsync parameters for this compositor. |
386 scoped_refptr<CompositorVSyncManager> vsync_manager_; | 388 scoped_refptr<CompositorVSyncManager> vsync_manager_; |
387 | 389 |
388 // The device scale factor of the monitor that this compositor is compositing | 390 // The device scale factor of the monitor that this compositor is compositing |
389 // layers on. | 391 // layers on. |
390 float device_scale_factor_; | 392 float device_scale_factor_; |
391 | 393 |
392 bool locks_will_time_out_; | 394 bool locks_will_time_out_; |
393 CompositorLock* compositor_lock_; | 395 CompositorLock* compositor_lock_; |
394 | 396 |
395 LayerAnimatorCollection layer_animator_collection_; | 397 LayerAnimatorCollection layer_animator_collection_; |
396 scoped_refptr<cc::AnimationTimeline> animation_timeline_; | 398 scoped_refptr<cc::AnimationTimeline> animation_timeline_; |
397 | 399 |
398 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 400 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
399 | 401 |
400 DISALLOW_COPY_AND_ASSIGN(Compositor); | 402 DISALLOW_COPY_AND_ASSIGN(Compositor); |
401 }; | 403 }; |
402 | 404 |
403 } // namespace ui | 405 } // namespace ui |
404 | 406 |
405 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 407 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |