OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CC_LAYER_TREE_HOST_H_ | 5 #ifndef CC_LAYER_TREE_HOST_H_ |
6 #define CC_LAYER_TREE_HOST_H_ | 6 #define CC_LAYER_TREE_HOST_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
12 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "cc/animation_events.h" | 16 #include "cc/animation_events.h" |
17 #include "cc/cc_export.h" | 17 #include "cc/cc_export.h" |
| 18 #include "cc/graphics_context.h" |
18 #include "cc/layer_tree_host_client.h" | 19 #include "cc/layer_tree_host_client.h" |
19 #include "cc/layer_tree_host_common.h" | 20 #include "cc/layer_tree_host_common.h" |
20 #include "cc/occlusion_tracker.h" | 21 #include "cc/occlusion_tracker.h" |
21 #include "cc/output_surface.h" | |
22 #include "cc/prioritized_resource_manager.h" | 22 #include "cc/prioritized_resource_manager.h" |
23 #include "cc/proxy.h" | 23 #include "cc/proxy.h" |
24 #include "cc/rate_limiter.h" | 24 #include "cc/rate_limiter.h" |
25 #include "cc/rendering_stats.h" | 25 #include "cc/rendering_stats.h" |
26 #include "cc/scoped_ptr_vector.h" | 26 #include "cc/scoped_ptr_vector.h" |
27 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
28 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
29 | 29 |
30 #if defined(COMPILER_GCC) | 30 #if defined(COMPILER_GCC) |
31 namespace BASE_HASH_NAMESPACE { | 31 namespace BASE_HASH_NAMESPACE { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 LayerTreeDebugState initialDebugState; | 96 LayerTreeDebugState initialDebugState; |
97 }; | 97 }; |
98 | 98 |
99 // Provides information on an Impl's rendering capabilities back to the LayerTre
eHost | 99 // Provides information on an Impl's rendering capabilities back to the LayerTre
eHost |
100 struct CC_EXPORT RendererCapabilities { | 100 struct CC_EXPORT RendererCapabilities { |
101 RendererCapabilities(); | 101 RendererCapabilities(); |
102 ~RendererCapabilities(); | 102 ~RendererCapabilities(); |
103 | 103 |
104 GLenum bestTextureFormat; | 104 GLenum bestTextureFormat; |
| 105 bool contextHasCachedFrontBuffer; |
105 bool usingPartialSwap; | 106 bool usingPartialSwap; |
106 bool usingAcceleratedPainting; | 107 bool usingAcceleratedPainting; |
107 bool usingSetVisibility; | 108 bool usingSetVisibility; |
108 bool usingSwapCompleteCallback; | 109 bool usingSwapCompleteCallback; |
109 bool usingGpuMemoryManager; | 110 bool usingGpuMemoryManager; |
110 bool usingDiscardFramebuffer; | 111 bool usingDiscardFramebuffer; |
111 bool usingEglImage; | 112 bool usingEglImage; |
112 bool allowPartialTextureUpdates; | 113 bool allowPartialTextureUpdates; |
113 int maxTextureSize; | 114 int maxTextureSize; |
114 }; | 115 }; |
(...skipping 14 matching lines...) Expand all Loading... |
129 | 130 |
130 // LayerTreeHost interface to Proxy. | 131 // LayerTreeHost interface to Proxy. |
131 void willBeginFrame() { m_client->willBeginFrame(); } | 132 void willBeginFrame() { m_client->willBeginFrame(); } |
132 void didBeginFrame() { m_client->didBeginFrame(); } | 133 void didBeginFrame() { m_client->didBeginFrame(); } |
133 void updateAnimations(base::TimeTicks monotonicFrameBeginTime); | 134 void updateAnimations(base::TimeTicks monotonicFrameBeginTime); |
134 void layout(); | 135 void layout(); |
135 void beginCommitOnImplThread(LayerTreeHostImpl*); | 136 void beginCommitOnImplThread(LayerTreeHostImpl*); |
136 void finishCommitOnImplThread(LayerTreeHostImpl*); | 137 void finishCommitOnImplThread(LayerTreeHostImpl*); |
137 void willCommit(); | 138 void willCommit(); |
138 void commitComplete(); | 139 void commitComplete(); |
139 scoped_ptr<OutputSurface> createOutputSurface(); | 140 scoped_ptr<GraphicsContext> createContext(); |
140 scoped_ptr<InputHandler> createInputHandler(); | 141 scoped_ptr<InputHandler> createInputHandler(); |
141 virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostI
mplClient*); | 142 virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostI
mplClient*); |
142 void didLoseOutputSurface(); | 143 void didLoseContext(); |
143 enum RecreateResult { | 144 enum RecreateResult { |
144 RecreateSucceeded, | 145 RecreateSucceeded, |
145 RecreateFailedButTryAgain, | 146 RecreateFailedButTryAgain, |
146 RecreateFailedAndGaveUp, | 147 RecreateFailedAndGaveUp, |
147 }; | 148 }; |
148 RecreateResult recreateOutputSurface(); | 149 RecreateResult recreateContext(); |
149 void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } | 150 void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } |
150 void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } | 151 void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } |
151 void deleteContentsTexturesOnImplThread(ResourceProvider*); | 152 void deleteContentsTexturesOnImplThread(ResourceProvider*); |
152 virtual void acquireLayerTextures(); | 153 virtual void acquireLayerTextures(); |
153 // Returns false if we should abort this frame due to initialization failure
. | 154 // Returns false if we should abort this frame due to initialization failure
. |
154 bool initializeRendererIfNeeded(); | 155 bool initializeRendererIfNeeded(); |
155 void updateLayers(ResourceUpdateQueue&, size_t contentsMemoryLimitBytes); | 156 void updateLayers(ResourceUpdateQueue&, size_t contentsMemoryLimitBytes); |
156 | 157 |
157 LayerTreeHostClient* client() { return m_client; } | 158 LayerTreeHostClient* client() { return m_client; } |
158 | 159 |
(...skipping 14 matching lines...) Expand all Loading... |
173 // Test only hook | 174 // Test only hook |
174 virtual void didDeferCommit(); | 175 virtual void didDeferCommit(); |
175 | 176 |
176 int commitNumber() const { return m_commitNumber; } | 177 int commitNumber() const { return m_commitNumber; } |
177 | 178 |
178 void renderingStats(RenderingStats*) const; | 179 void renderingStats(RenderingStats*) const; |
179 | 180 |
180 const RendererCapabilities& rendererCapabilities() const; | 181 const RendererCapabilities& rendererCapabilities() const; |
181 | 182 |
182 // Test only hook | 183 // Test only hook |
183 void loseOutputSurface(int numTimes); | 184 void loseContext(int numTimes); |
184 | 185 |
185 void setNeedsAnimate(); | 186 void setNeedsAnimate(); |
186 // virtual for testing | 187 // virtual for testing |
187 virtual void setNeedsCommit(); | 188 virtual void setNeedsCommit(); |
188 virtual void setNeedsFullTreeSync(); | 189 virtual void setNeedsFullTreeSync(); |
189 void setNeedsRedraw(); | 190 void setNeedsRedraw(); |
190 bool commitRequested() const; | 191 bool commitRequested() const; |
191 | 192 |
192 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl
ockTime); | 193 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl
ockTime); |
193 virtual void didAddAnimation(); | 194 virtual void didAddAnimation(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 277 |
277 base::CancelableClosure m_prepaintCallback; | 278 base::CancelableClosure m_prepaintCallback; |
278 | 279 |
279 LayerTreeHostClient* m_client; | 280 LayerTreeHostClient* m_client; |
280 scoped_ptr<Proxy> m_proxy; | 281 scoped_ptr<Proxy> m_proxy; |
281 | 282 |
282 int m_commitNumber; | 283 int m_commitNumber; |
283 RenderingStats m_renderingStats; | 284 RenderingStats m_renderingStats; |
284 | 285 |
285 bool m_rendererInitialized; | 286 bool m_rendererInitialized; |
286 bool m_outputSurfaceLost; | 287 bool m_contextLost; |
287 int m_numTimesRecreateShouldFail; | 288 int m_numTimesRecreateShouldFail; |
288 int m_numFailedRecreateAttempts; | 289 int m_numFailedRecreateAttempts; |
289 | 290 |
290 scoped_refptr<Layer> m_rootLayer; | 291 scoped_refptr<Layer> m_rootLayer; |
291 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; | 292 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; |
292 | 293 |
293 scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager; | 294 scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager; |
294 scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder; | 295 scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder; |
295 | 296 |
296 LayerTreeSettings m_settings; | 297 LayerTreeSettings m_settings; |
(...skipping 20 matching lines...) Expand all Loading... |
317 size_t m_partialTextureUpdateRequests; | 318 size_t m_partialTextureUpdateRequests; |
318 | 319 |
319 static bool s_needsFilterContext; | 320 static bool s_needsFilterContext; |
320 | 321 |
321 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 322 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
322 }; | 323 }; |
323 | 324 |
324 } // namespace cc | 325 } // namespace cc |
325 | 326 |
326 #endif // CC_LAYER_TREE_HOST_H_ | 327 #endif // CC_LAYER_TREE_HOST_H_ |
OLD | NEW |