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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 Compositor(gfx::AcceleratedWidget widget, | 134 Compositor(gfx::AcceleratedWidget widget, |
135 ui::ContextFactory* context_factory, | 135 ui::ContextFactory* context_factory, |
136 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 136 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
137 virtual ~Compositor(); | 137 virtual ~Compositor(); |
138 | 138 |
139 ui::ContextFactory* context_factory() { return context_factory_; } | 139 ui::ContextFactory* context_factory() { return context_factory_; } |
140 | 140 |
141 // Schedules a redraw of the layer tree associated with this compositor. | 141 // Schedules a redraw of the layer tree associated with this compositor. |
142 void ScheduleDraw(); | 142 void ScheduleDraw(); |
143 | 143 |
| 144 // When set, this blocks all drawing operations. This can be used to keep |
| 145 // what's currently in the buffer and stop drawing anything new for any period |
| 146 // of time. Unblocking will schedule a redraw so that the buffer can catch up. |
| 147 void SetBlockDrawing(bool block_drawing); |
| 148 |
144 // Sets the root of the layer tree drawn by this Compositor. The root layer | 149 // Sets the root of the layer tree drawn by this Compositor. The root layer |
145 // must have no parent. The compositor's root layer is reset if the root layer | 150 // must have no parent. The compositor's root layer is reset if the root layer |
146 // is destroyed. NULL can be passed to reset the root layer, in which case the | 151 // is destroyed. NULL can be passed to reset the root layer, in which case the |
147 // compositor will stop drawing anything. | 152 // compositor will stop drawing anything. |
148 // The Compositor does not own the root layer. | 153 // The Compositor does not own the root layer. |
149 const Layer* root_layer() const { return root_layer_; } | 154 const Layer* root_layer() const { return root_layer_; } |
150 Layer* root_layer() { return root_layer_; } | 155 Layer* root_layer() { return root_layer_; } |
151 void SetRootLayer(Layer* root_layer); | 156 void SetRootLayer(Layer* root_layer); |
152 | 157 |
153 // Called when we need the compositor to preserve the alpha channel in the | 158 // Called when we need the compositor to preserve the alpha channel in the |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 int last_started_frame_; | 304 int last_started_frame_; |
300 int last_ended_frame_; | 305 int last_ended_frame_; |
301 | 306 |
302 bool disable_schedule_composite_; | 307 bool disable_schedule_composite_; |
303 | 308 |
304 CompositorLock* compositor_lock_; | 309 CompositorLock* compositor_lock_; |
305 | 310 |
306 // Prevent more than one draw from being scheduled. | 311 // Prevent more than one draw from being scheduled. |
307 bool defer_draw_scheduling_; | 312 bool defer_draw_scheduling_; |
308 | 313 |
| 314 // Block all drawing |
| 315 bool block_drawing_; |
| 316 |
309 // Used to prevent Draw()s while a composite is in progress. | 317 // Used to prevent Draw()s while a composite is in progress. |
310 bool waiting_on_compositing_end_; | 318 bool waiting_on_compositing_end_; |
311 bool draw_on_compositing_end_; | 319 bool draw_on_compositing_end_; |
312 enum SwapState { SWAP_NONE, SWAP_POSTED, SWAP_COMPLETED }; | 320 enum SwapState { SWAP_NONE, SWAP_POSTED, SWAP_COMPLETED }; |
313 SwapState swap_state_; | 321 SwapState swap_state_; |
314 | 322 |
315 LayerAnimatorCollection layer_animator_collection_; | 323 LayerAnimatorCollection layer_animator_collection_; |
316 | 324 |
317 base::WeakPtrFactory<Compositor> schedule_draw_factory_; | 325 base::WeakPtrFactory<Compositor> schedule_draw_factory_; |
318 | 326 |
319 DISALLOW_COPY_AND_ASSIGN(Compositor); | 327 DISALLOW_COPY_AND_ASSIGN(Compositor); |
320 }; | 328 }; |
321 | 329 |
322 } // namespace ui | 330 } // namespace ui |
323 | 331 |
324 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 332 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |