Chromium Code Reviews| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 | 98 |
| 99 // Gets the GPU memory buffer manager. | 99 // Gets the GPU memory buffer manager. |
| 100 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0; | 100 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() = 0; |
| 101 | 101 |
| 102 // Gets the compositor message loop, or NULL if not using threaded | 102 // Gets the compositor message loop, or NULL if not using threaded |
| 103 // compositing. | 103 // compositing. |
| 104 virtual base::MessageLoopProxy* GetCompositorMessageLoop() = 0; | 104 virtual base::MessageLoopProxy* GetCompositorMessageLoop() = 0; |
| 105 | 105 |
| 106 // Creates a Surface ID allocator with a new namespace. | 106 // Creates a Surface ID allocator with a new namespace. |
| 107 virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() = 0; | 107 virtual scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() = 0; |
| 108 | |
| 109 // Resize the display corresponding to this compositor to a particular size. | |
| 110 virtual void ResizeDisplay(ui::Compositor* compositor, | |
| 111 const gfx::Size& size) = 0; | |
| 108 }; | 112 }; |
| 109 | 113 |
| 110 // This class represents a lock on the compositor, that can be used to prevent | 114 // This class represents a lock on the compositor, that can be used to prevent |
| 111 // commits to the compositor tree while we're waiting for an asynchronous | 115 // commits to the compositor tree while we're waiting for an asynchronous |
| 112 // event. The typical use case is when waiting for a renderer to produce a frame | 116 // event. The typical use case is when waiting for a renderer to produce a frame |
| 113 // at the right size. The caller keeps a reference on this object, and drops the | 117 // at the right size. The caller keeps a reference on this object, and drops the |
| 114 // reference once it desires to release the lock. | 118 // reference once it desires to release the lock. |
| 115 // Note however that the lock is cancelled after a short timeout to ensure | 119 // Note however that the lock is cancelled after a short timeout to ensure |
| 116 // responsiveness of the UI, so the compositor tree should be kept in a | 120 // responsiveness of the UI, so the compositor tree should be kept in a |
| 117 // "reasonable" state while the lock is held. | 121 // "reasonable" state while the lock is held. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 | 180 |
| 177 // Where possible, draws are scissored to a damage region calculated from | 181 // Where possible, draws are scissored to a damage region calculated from |
| 178 // changes to layer properties. This bypasses that and indicates that | 182 // changes to layer properties. This bypasses that and indicates that |
| 179 // the whole frame needs to be drawn. | 183 // the whole frame needs to be drawn. |
| 180 void ScheduleFullRedraw(); | 184 void ScheduleFullRedraw(); |
| 181 | 185 |
| 182 // Schedule redraw and append damage_rect to the damage region calculated | 186 // Schedule redraw and append damage_rect to the damage region calculated |
| 183 // from changes to layer properties. | 187 // from changes to layer properties. |
| 184 void ScheduleRedrawRect(const gfx::Rect& damage_rect); | 188 void ScheduleRedrawRect(const gfx::Rect& damage_rect); |
| 185 | 189 |
| 186 // Finishes all outstanding rendering on the GPU. | 190 // Disable swapping on this surface until it is resized. |
|
piman
2014/12/01 23:42:09
Nit: "Finishes all outstanding rendering and disab
| |
| 187 void FinishAllRendering(); | 191 void DisableSwapUntilResize(); |
| 188 | 192 |
| 189 void SetLatencyInfo(const LatencyInfo& latency_info); | 193 void SetLatencyInfo(const LatencyInfo& latency_info); |
| 190 | 194 |
| 191 // Sets the compositor's device scale factor and size. | 195 // Sets the compositor's device scale factor and size. |
| 192 void SetScaleAndSize(float scale, const gfx::Size& size_in_pixel); | 196 void SetScaleAndSize(float scale, const gfx::Size& size_in_pixel); |
| 193 | 197 |
| 194 // Returns the size of the widget that is being drawn to in pixel coordinates. | 198 // Returns the size of the widget that is being drawn to in pixel coordinates. |
| 195 const gfx::Size& size() const { return size_; } | 199 const gfx::Size& size() const { return size_; } |
| 196 | 200 |
| 197 // Sets the background color used for areas that aren't covered by | 201 // Sets the background color used for areas that aren't covered by |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 LayerAnimatorCollection layer_animator_collection_; | 341 LayerAnimatorCollection layer_animator_collection_; |
| 338 | 342 |
| 339 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 343 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
| 340 | 344 |
| 341 DISALLOW_COPY_AND_ASSIGN(Compositor); | 345 DISALLOW_COPY_AND_ASSIGN(Compositor); |
| 342 }; | 346 }; |
| 343 | 347 |
| 344 } // namespace ui | 348 } // namespace ui |
| 345 | 349 |
| 346 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 350 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |