| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 class Compositor; | 63 class Compositor; |
| 64 class CompositorVSyncManager; | 64 class CompositorVSyncManager; |
| 65 class LatencyInfo; | 65 class LatencyInfo; |
| 66 class Layer; | 66 class Layer; |
| 67 class Reflector; | 67 class Reflector; |
| 68 class Texture; | 68 class Texture; |
| 69 | 69 |
| 70 const int kCompositorLockTimeoutMs = 67; | 70 const int kCompositorLockTimeoutMs = 67; |
| 71 | 71 |
| 72 class COMPOSITOR_EXPORT ContextFactoryObserver { |
| 73 public: |
| 74 virtual ~ContextFactoryObserver() {} |
| 75 |
| 76 // Notifies that the ContextProvider returned from |
| 77 // ui::ContextFactory::SharedMainThreadContextProvider was lost. When this |
| 78 // is called, the old resources (e.g. shared context, GL helper) still |
| 79 // exist, but are about to be destroyed. Getting a reference to those |
| 80 // resources from the ContextFactory (e.g. through |
| 81 // SharedMainThreadContextProvider()) will return newly recreated, valid |
| 82 // resources. |
| 83 virtual void OnLostResources() = 0; |
| 84 }; |
| 85 |
| 72 // This class abstracts the creation of the 3D context for the compositor. It is | 86 // This class abstracts the creation of the 3D context for the compositor. It is |
| 73 // a global object. | 87 // a global object. |
| 74 class COMPOSITOR_EXPORT ContextFactory { | 88 class COMPOSITOR_EXPORT ContextFactory { |
| 75 public: | 89 public: |
| 76 virtual ~ContextFactory() {} | 90 virtual ~ContextFactory() {} |
| 77 | 91 |
| 78 // Creates an output surface for the given compositor. The factory may keep | 92 // Creates an output surface for the given compositor. The factory may keep |
| 79 // per-compositor data (e.g. a shared context), that needs to be cleaned up | 93 // per-compositor data (e.g. a shared context), that needs to be cleaned up |
| 80 // by calling RemoveCompositor when the compositor gets destroyed. | 94 // by calling RemoveCompositor when the compositor gets destroyed. |
| 81 virtual void CreateOutputSurface(base::WeakPtr<Compositor> compositor) = 0; | 95 virtual void CreateOutputSurface(base::WeakPtr<Compositor> compositor) = 0; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 virtual cc::SurfaceManager* GetSurfaceManager() = 0; | 135 virtual cc::SurfaceManager* GetSurfaceManager() = 0; |
| 122 | 136 |
| 123 // Resize the display corresponding to this compositor to a particular size. | 137 // Resize the display corresponding to this compositor to a particular size. |
| 124 virtual void ResizeDisplay(ui::Compositor* compositor, | 138 virtual void ResizeDisplay(ui::Compositor* compositor, |
| 125 const gfx::Size& size) = 0; | 139 const gfx::Size& size) = 0; |
| 126 | 140 |
| 127 virtual void SetAuthoritativeVSyncInterval(ui::Compositor* compositor, | 141 virtual void SetAuthoritativeVSyncInterval(ui::Compositor* compositor, |
| 128 base::TimeDelta interval) = 0; | 142 base::TimeDelta interval) = 0; |
| 129 | 143 |
| 130 virtual void SetOutputIsSecure(Compositor* compositor, bool secure) = 0; | 144 virtual void SetOutputIsSecure(Compositor* compositor, bool secure) = 0; |
| 145 |
| 146 virtual void AddObserver(ContextFactoryObserver* observer) = 0; |
| 147 |
| 148 virtual void RemoveObserver(ContextFactoryObserver* observer) = 0; |
| 131 }; | 149 }; |
| 132 | 150 |
| 133 // This class represents a lock on the compositor, that can be used to prevent | 151 // This class represents a lock on the compositor, that can be used to prevent |
| 134 // commits to the compositor tree while we're waiting for an asynchronous | 152 // commits to the compositor tree while we're waiting for an asynchronous |
| 135 // event. The typical use case is when waiting for a renderer to produce a frame | 153 // event. The typical use case is when waiting for a renderer to produce a frame |
| 136 // at the right size. The caller keeps a reference on this object, and drops the | 154 // at the right size. The caller keeps a reference on this object, and drops the |
| 137 // reference once it desires to release the lock. | 155 // reference once it desires to release the lock. |
| 138 // By default, the lock will be cancelled after a short timeout to ensure | 156 // By default, the lock will be cancelled after a short timeout to ensure |
| 139 // responsiveness of the UI, so the compositor tree should be kept in a | 157 // responsiveness of the UI, so the compositor tree should be kept in a |
| 140 // "reasonable" state while the lock is held. If the compositor sets | 158 // "reasonable" state while the lock is held. If the compositor sets |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 scoped_refptr<cc::AnimationTimeline> animation_timeline_; | 394 scoped_refptr<cc::AnimationTimeline> animation_timeline_; |
| 377 | 395 |
| 378 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 396 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
| 379 | 397 |
| 380 DISALLOW_COPY_AND_ASSIGN(Compositor); | 398 DISALLOW_COPY_AND_ASSIGN(Compositor); |
| 381 }; | 399 }; |
| 382 | 400 |
| 383 } // namespace ui | 401 } // namespace ui |
| 384 | 402 |
| 385 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 403 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |