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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // main thread. | 86 // main thread. |
87 virtual scoped_refptr<cc::ContextProvider> | 87 virtual scoped_refptr<cc::ContextProvider> |
88 SharedMainThreadContextProvider() = 0; | 88 SharedMainThreadContextProvider() = 0; |
89 | 89 |
90 // Destroys per-compositor data. | 90 // Destroys per-compositor data. |
91 virtual void RemoveCompositor(Compositor* compositor) = 0; | 91 virtual void RemoveCompositor(Compositor* compositor) = 0; |
92 | 92 |
93 // When true, the factory uses test contexts that do not do real GL | 93 // When true, the factory uses test contexts that do not do real GL |
94 // operations. | 94 // operations. |
95 virtual bool DoesCreateTestContexts() = 0; | 95 virtual bool DoesCreateTestContexts() = 0; |
| 96 |
| 97 // Gets the shared bitmap manager for software mode. |
| 98 virtual cc::SharedBitmapManager* GetSharedBitmapManager() = 0; |
96 }; | 99 }; |
97 | 100 |
98 // This class represents a lock on the compositor, that can be used to prevent | 101 // This class represents a lock on the compositor, that can be used to prevent |
99 // commits to the compositor tree while we're waiting for an asynchronous | 102 // commits to the compositor tree while we're waiting for an asynchronous |
100 // event. The typical use case is when waiting for a renderer to produce a frame | 103 // event. The typical use case is when waiting for a renderer to produce a frame |
101 // at the right size. The caller keeps a reference on this object, and drops the | 104 // at the right size. The caller keeps a reference on this object, and drops the |
102 // reference once it desires to release the lock. | 105 // reference once it desires to release the lock. |
103 // Note however that the lock is cancelled after a short timeout to ensure | 106 // Note however that the lock is cancelled after a short timeout to ensure |
104 // responsiveness of the UI, so the compositor tree should be kept in a | 107 // responsiveness of the UI, so the compositor tree should be kept in a |
105 // "reasonable" state while the lock is held. | 108 // "reasonable" state while the lock is held. |
(...skipping 23 matching lines...) Expand all Loading... |
129 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 132 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
130 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { | 133 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { |
131 public: | 134 public: |
132 explicit Compositor(gfx::AcceleratedWidget widget); | 135 explicit Compositor(gfx::AcceleratedWidget widget); |
133 virtual ~Compositor(); | 136 virtual ~Compositor(); |
134 | 137 |
135 static void Initialize(); | 138 static void Initialize(); |
136 static bool WasInitializedWithThread(); | 139 static bool WasInitializedWithThread(); |
137 static scoped_refptr<base::MessageLoopProxy> GetCompositorMessageLoop(); | 140 static scoped_refptr<base::MessageLoopProxy> GetCompositorMessageLoop(); |
138 static void Terminate(); | 141 static void Terminate(); |
139 static void SetSharedBitmapManager(cc::SharedBitmapManager* manager); | |
140 | 142 |
141 // Schedules a redraw of the layer tree associated with this compositor. | 143 // Schedules a redraw of the layer tree associated with this compositor. |
142 void ScheduleDraw(); | 144 void ScheduleDraw(); |
143 | 145 |
144 // Sets the root of the layer tree drawn by this Compositor. The root layer | 146 // 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 | 147 // 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 | 148 // is destroyed. NULL can be passed to reset the root layer, in which case the |
147 // compositor will stop drawing anything. | 149 // compositor will stop drawing anything. |
148 // The Compositor does not own the root layer. | 150 // The Compositor does not own the root layer. |
149 const Layer* root_layer() const { return root_layer_; } | 151 const Layer* root_layer() const { return root_layer_; } |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 SwapState swap_state_; | 292 SwapState swap_state_; |
291 | 293 |
292 base::WeakPtrFactory<Compositor> schedule_draw_factory_; | 294 base::WeakPtrFactory<Compositor> schedule_draw_factory_; |
293 | 295 |
294 DISALLOW_COPY_AND_ASSIGN(Compositor); | 296 DISALLOW_COPY_AND_ASSIGN(Compositor); |
295 }; | 297 }; |
296 | 298 |
297 } // namespace ui | 299 } // namespace ui |
298 | 300 |
299 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 301 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |