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