| 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" | |
| 19 #include "cc/layer_tree_host_client.h" | 18 #include "cc/layer_tree_host_client.h" |
| 20 #include "cc/layer_tree_host_common.h" | 19 #include "cc/layer_tree_host_common.h" |
| 21 #include "cc/occlusion_tracker.h" | 20 #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; | |
| 106 bool usingPartialSwap; | 105 bool usingPartialSwap; |
| 107 bool usingAcceleratedPainting; | 106 bool usingAcceleratedPainting; |
| 108 bool usingSetVisibility; | 107 bool usingSetVisibility; |
| 109 bool usingSwapCompleteCallback; | 108 bool usingSwapCompleteCallback; |
| 110 bool usingGpuMemoryManager; | 109 bool usingGpuMemoryManager; |
| 111 bool usingDiscardFramebuffer; | 110 bool usingDiscardFramebuffer; |
| 112 bool usingEglImage; | 111 bool usingEglImage; |
| 113 int maxTextureSize; | 112 int maxTextureSize; |
| 114 }; | 113 }; |
| 115 | 114 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 129 | 128 |
| 130 // LayerTreeHost interface to Proxy. | 129 // LayerTreeHost interface to Proxy. |
| 131 void willBeginFrame() { m_client->willBeginFrame(); } | 130 void willBeginFrame() { m_client->willBeginFrame(); } |
| 132 void didBeginFrame() { m_client->didBeginFrame(); } | 131 void didBeginFrame() { m_client->didBeginFrame(); } |
| 133 void updateAnimations(base::TimeTicks monotonicFrameBeginTime); | 132 void updateAnimations(base::TimeTicks monotonicFrameBeginTime); |
| 134 void layout(); | 133 void layout(); |
| 135 void beginCommitOnImplThread(LayerTreeHostImpl*); | 134 void beginCommitOnImplThread(LayerTreeHostImpl*); |
| 136 void finishCommitOnImplThread(LayerTreeHostImpl*); | 135 void finishCommitOnImplThread(LayerTreeHostImpl*); |
| 137 void willCommit(); | 136 void willCommit(); |
| 138 void commitComplete(); | 137 void commitComplete(); |
| 139 scoped_ptr<GraphicsContext> createContext(); | 138 scoped_ptr<OutputSurface> createOutputSurface(); |
| 140 scoped_ptr<InputHandler> createInputHandler(); | 139 scoped_ptr<InputHandler> createInputHandler(); |
| 141 virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostI
mplClient*); | 140 virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostI
mplClient*); |
| 142 void didLoseContext(); | 141 void didLoseOutputSurface(); |
| 143 enum RecreateResult { | 142 enum RecreateResult { |
| 144 RecreateSucceeded, | 143 RecreateSucceeded, |
| 145 RecreateFailedButTryAgain, | 144 RecreateFailedButTryAgain, |
| 146 RecreateFailedAndGaveUp, | 145 RecreateFailedAndGaveUp, |
| 147 }; | 146 }; |
| 148 RecreateResult recreateContext(); | 147 RecreateResult recreateOutputSurface(); |
| 149 void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } | 148 void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } |
| 150 void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } | 149 void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } |
| 151 void deleteContentsTexturesOnImplThread(ResourceProvider*); | 150 void deleteContentsTexturesOnImplThread(ResourceProvider*); |
| 152 virtual void acquireLayerTextures(); | 151 virtual void acquireLayerTextures(); |
| 153 // Returns false if we should abort this frame due to initialization failure
. | 152 // Returns false if we should abort this frame due to initialization failure
. |
| 154 bool initializeRendererIfNeeded(); | 153 bool initializeRendererIfNeeded(); |
| 155 void updateLayers(ResourceUpdateQueue&, size_t contentsMemoryLimitBytes); | 154 void updateLayers(ResourceUpdateQueue&, size_t contentsMemoryLimitBytes); |
| 156 | 155 |
| 157 LayerTreeHostClient* client() { return m_client; } | 156 LayerTreeHostClient* client() { return m_client; } |
| 158 | 157 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 173 // Test only hook | 172 // Test only hook |
| 174 virtual void didDeferCommit(); | 173 virtual void didDeferCommit(); |
| 175 | 174 |
| 176 int commitNumber() const { return m_commitNumber; } | 175 int commitNumber() const { return m_commitNumber; } |
| 177 | 176 |
| 178 void renderingStats(RenderingStats*) const; | 177 void renderingStats(RenderingStats*) const; |
| 179 | 178 |
| 180 const RendererCapabilities& rendererCapabilities() const; | 179 const RendererCapabilities& rendererCapabilities() const; |
| 181 | 180 |
| 182 // Test only hook | 181 // Test only hook |
| 183 void loseContext(int numTimes); | 182 void loseOutputSurface(int numTimes); |
| 184 | 183 |
| 185 void setNeedsAnimate(); | 184 void setNeedsAnimate(); |
| 186 // virtual for testing | 185 // virtual for testing |
| 187 virtual void setNeedsCommit(); | 186 virtual void setNeedsCommit(); |
| 188 virtual void setNeedsFullTreeSync(); | 187 virtual void setNeedsFullTreeSync(); |
| 189 void setNeedsRedraw(); | 188 void setNeedsRedraw(); |
| 190 bool commitRequested() const; | 189 bool commitRequested() const; |
| 191 | 190 |
| 192 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl
ockTime); | 191 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl
ockTime); |
| 193 virtual void didAddAnimation(); | 192 virtual void didAddAnimation(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 273 |
| 275 base::CancelableClosure m_prepaintCallback; | 274 base::CancelableClosure m_prepaintCallback; |
| 276 | 275 |
| 277 LayerTreeHostClient* m_client; | 276 LayerTreeHostClient* m_client; |
| 278 scoped_ptr<Proxy> m_proxy; | 277 scoped_ptr<Proxy> m_proxy; |
| 279 | 278 |
| 280 int m_commitNumber; | 279 int m_commitNumber; |
| 281 RenderingStats m_renderingStats; | 280 RenderingStats m_renderingStats; |
| 282 | 281 |
| 283 bool m_rendererInitialized; | 282 bool m_rendererInitialized; |
| 284 bool m_contextLost; | 283 bool m_outputSurfaceLost; |
| 285 int m_numTimesRecreateShouldFail; | 284 int m_numTimesRecreateShouldFail; |
| 286 int m_numFailedRecreateAttempts; | 285 int m_numFailedRecreateAttempts; |
| 287 | 286 |
| 288 scoped_refptr<Layer> m_rootLayer; | 287 scoped_refptr<Layer> m_rootLayer; |
| 289 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; | 288 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; |
| 290 | 289 |
| 291 scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager; | 290 scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager; |
| 292 scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder; | 291 scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder; |
| 293 | 292 |
| 294 LayerTreeSettings m_settings; | 293 LayerTreeSettings m_settings; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 315 size_t m_partialTextureUpdateRequests; | 314 size_t m_partialTextureUpdateRequests; |
| 316 | 315 |
| 317 static bool s_needsFilterContext; | 316 static bool s_needsFilterContext; |
| 318 | 317 |
| 319 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 318 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 320 }; | 319 }; |
| 321 | 320 |
| 322 } // namespace cc | 321 } // namespace cc |
| 323 | 322 |
| 324 #endif // CC_LAYER_TREE_HOST_H_ | 323 #endif // CC_LAYER_TREE_HOST_H_ |
| OLD | NEW |