| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 const cc::RendererSettings& GetRendererSettings() const; | 317 const cc::RendererSettings& GetRendererSettings() const; |
| 318 | 318 |
| 319 LayerAnimatorCollection* layer_animator_collection() { | 319 LayerAnimatorCollection* layer_animator_collection() { |
| 320 return &layer_animator_collection_; | 320 return &layer_animator_collection_; |
| 321 } | 321 } |
| 322 | 322 |
| 323 cc::SurfaceIdAllocator* surface_id_allocator() { | 323 cc::SurfaceIdAllocator* surface_id_allocator() { |
| 324 return surface_id_allocator_.get(); | 324 return surface_id_allocator_.get(); |
| 325 } | 325 } |
| 326 | 326 |
| 327 gfx::Size last_swapped_frame_size() const { return last_swapped_frame_size_; } |
| 328 |
| 327 private: | 329 private: |
| 328 friend class base::RefCounted<Compositor>; | 330 friend class base::RefCounted<Compositor>; |
| 329 friend class CompositorLock; | 331 friend class CompositorLock; |
| 332 class ResizeSwapPromise; |
| 330 | 333 |
| 331 // Called by CompositorLock. | 334 // Called by CompositorLock. |
| 332 void UnlockCompositor(); | 335 void UnlockCompositor(); |
| 333 | 336 |
| 334 // Called to release any pending CompositorLock | 337 // Called to release any pending CompositorLock |
| 335 void CancelCompositorLock(); | 338 void CancelCompositorLock(); |
| 336 | 339 |
| 340 void set_pending_swapped_frame_size( |
| 341 const gfx::Size& pending_swapped_frame_size) { |
| 342 pending_swapped_frame_size_ = pending_swapped_frame_size; |
| 343 } |
| 344 |
| 345 void UpdateLastSwappedFrameSize() { |
| 346 last_swapped_frame_size_ = pending_swapped_frame_size_; |
| 347 pending_swapped_frame_size_ = gfx::Size(); |
| 348 } |
| 349 |
| 337 gfx::Size size_; | 350 gfx::Size size_; |
| 338 | 351 |
| 339 ui::ContextFactory* context_factory_; | 352 ui::ContextFactory* context_factory_; |
| 340 | 353 |
| 341 // The root of the Layer tree drawn by this compositor. | 354 // The root of the Layer tree drawn by this compositor. |
| 342 Layer* root_layer_; | 355 Layer* root_layer_; |
| 343 | 356 |
| 344 base::ObserverList<CompositorObserver, true> observer_list_; | 357 base::ObserverList<CompositorObserver, true> observer_list_; |
| 345 base::ObserverList<CompositorAnimationObserver> animation_observer_list_; | 358 base::ObserverList<CompositorAnimationObserver> animation_observer_list_; |
| 346 base::ObserverList<CompositorBeginFrameObserver, true> | 359 base::ObserverList<CompositorBeginFrameObserver, true> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 365 int last_ended_frame_; | 378 int last_ended_frame_; |
| 366 | 379 |
| 367 bool locks_will_time_out_; | 380 bool locks_will_time_out_; |
| 368 CompositorLock* compositor_lock_; | 381 CompositorLock* compositor_lock_; |
| 369 | 382 |
| 370 LayerAnimatorCollection layer_animator_collection_; | 383 LayerAnimatorCollection layer_animator_collection_; |
| 371 | 384 |
| 372 // Used to send to any new CompositorBeginFrameObserver immediately. | 385 // Used to send to any new CompositorBeginFrameObserver immediately. |
| 373 cc::BeginFrameArgs missed_begin_frame_args_; | 386 cc::BeginFrameArgs missed_begin_frame_args_; |
| 374 | 387 |
| 388 // Used to track the last swapped frame size. We use a swap promise to track |
| 389 // the progression of a frame through resizing of the compositor to posting |
| 390 // swap buffers. Once posted, the frame's size is recorded to |
| 391 // |pending_swapped_frame_size_|. Once a swap completes, the pending size is |
| 392 // promoted to the |last_swapped_frame_size_|. |
| 393 gfx::Size last_swapped_frame_size_; |
| 394 gfx::Size pending_swapped_frame_size_; |
| 395 |
| 375 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 396 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
| 376 | 397 |
| 377 DISALLOW_COPY_AND_ASSIGN(Compositor); | 398 DISALLOW_COPY_AND_ASSIGN(Compositor); |
| 378 }; | 399 }; |
| 379 | 400 |
| 380 } // namespace ui | 401 } // namespace ui |
| 381 | 402 |
| 382 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 403 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |