| 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_IMPL_H_ | 5 #ifndef CC_LAYER_TREE_HOST_IMPL_H_ |
| 6 #define CC_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_LAYER_TREE_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include "FloatPoint.h" | 8 #include "FloatPoint.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 gfx::SizeF m_layoutViewportSize; | 100 gfx::SizeF m_layoutViewportSize; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te | 103 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te |
| 104 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, | 104 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, |
| 105 public RendererClient, | 105 public RendererClient, |
| 106 public NON_EXPORTED_BASE(WebKit::WebComposit
orOutputSurfaceClient) { | 106 public NON_EXPORTED_BASE(WebKit::WebComposit
orOutputSurfaceClient) { |
| 107 typedef std::vector<LayerImpl*> LayerList; | 107 typedef std::vector<LayerImpl*> LayerList; |
| 108 | 108 |
| 109 public: | 109 public: |
| 110 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*, Proxy*); | 110 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*); |
| 111 virtual ~LayerTreeHostImpl(); | 111 virtual ~LayerTreeHostImpl(); |
| 112 | 112 |
| 113 // InputHandlerClient implementation | 113 // InputHandlerClient implementation |
| 114 virtual InputHandlerClient::ScrollStatus scrollBegin(const gfx::Point&, Inpu
tHandlerClient::ScrollInputType) OVERRIDE; | 114 virtual InputHandlerClient::ScrollStatus scrollBegin(const gfx::Point&, Inpu
tHandlerClient::ScrollInputType) OVERRIDE; |
| 115 virtual void scrollBy(const gfx::Point&, const IntSize&) OVERRIDE; | 115 virtual void scrollBy(const gfx::Point&, const IntSize&) OVERRIDE; |
| 116 virtual void scrollEnd() OVERRIDE; | 116 virtual void scrollEnd() OVERRIDE; |
| 117 virtual void pinchGestureBegin() OVERRIDE; | 117 virtual void pinchGestureBegin() OVERRIDE; |
| 118 virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE; | 118 virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE; |
| 119 virtual void pinchGestureEnd() OVERRIDE; | 119 virtual void pinchGestureEnd() OVERRIDE; |
| 120 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anc
horPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration)
OVERRIDE; | 120 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anc
horPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration)
OVERRIDE; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 149 void didDrawAllLayers(const FrameData&); | 149 void didDrawAllLayers(const FrameData&); |
| 150 | 150 |
| 151 // RendererClient implementation | 151 // RendererClient implementation |
| 152 virtual const gfx::Size& deviceViewportSize() const OVERRIDE; | 152 virtual const gfx::Size& deviceViewportSize() const OVERRIDE; |
| 153 virtual const LayerTreeSettings& settings() const OVERRIDE; | 153 virtual const LayerTreeSettings& settings() const OVERRIDE; |
| 154 virtual void didLoseContext() OVERRIDE; | 154 virtual void didLoseContext() OVERRIDE; |
| 155 virtual void onSwapBuffersComplete() OVERRIDE; | 155 virtual void onSwapBuffersComplete() OVERRIDE; |
| 156 virtual void setFullRootLayerDamage() OVERRIDE; | 156 virtual void setFullRootLayerDamage() OVERRIDE; |
| 157 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE; | 157 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE; |
| 158 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE; | 158 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE; |
| 159 virtual bool hasImplThread() const OVERRIDE; | |
| 160 | 159 |
| 161 // WebCompositorOutputSurfaceClient implementation. | 160 // WebCompositorOutputSurfaceClient implementation. |
| 162 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) OVERRIDE; | 161 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) OVERRIDE; |
| 163 | 162 |
| 164 // Implementation | 163 // Implementation |
| 165 bool canDraw(); | 164 bool canDraw(); |
| 166 GraphicsContext* context() const; | 165 GraphicsContext* context() const; |
| 167 | 166 |
| 168 std::string layerTreeAsText() const; | 167 std::string layerTreeAsText() const; |
| 169 | 168 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 226 |
| 228 void setNeedsRedraw(); | 227 void setNeedsRedraw(); |
| 229 | 228 |
| 230 void renderingStats(RenderingStats*) const; | 229 void renderingStats(RenderingStats*) const; |
| 231 | 230 |
| 232 void updateRootScrollLayerImplTransform(); | 231 void updateRootScrollLayerImplTransform(); |
| 233 | 232 |
| 234 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 233 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
| 235 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } | 234 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } |
| 236 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } | 235 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } |
| 237 Proxy* proxy() const { return m_proxy; } | |
| 238 | 236 |
| 239 class CC_EXPORT CullRenderPassesWithCachedTextures { | 237 class CC_EXPORT CullRenderPassesWithCachedTextures { |
| 240 public: | 238 public: |
| 241 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; | 239 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; |
| 242 | 240 |
| 243 // Iterates from the root first, in order to remove the surfaces closest | 241 // Iterates from the root first, in order to remove the surfaces closest |
| 244 // to the root with cached textures, and all surfaces that draw into | 242 // to the root with cached textures, and all surfaces that draw into |
| 245 // them. | 243 // them. |
| 246 size_t renderPassListBegin(const RenderPassList& list) const { return li
st.size() - 1; } | 244 size_t renderPassListBegin(const RenderPassList& list) const { return li
st.size() - 1; } |
| 247 size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; } | 245 size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 260 // target becomes empty, then its target can be removed also. | 258 // target becomes empty, then its target can be removed also. |
| 261 size_t renderPassListBegin(const RenderPassList&) const { return 0; } | 259 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
| 262 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } | 260 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } |
| 263 size_t renderPassListNext(size_t it) const { return it + 1; } | 261 size_t renderPassListNext(size_t it) const { return it + 1; } |
| 264 }; | 262 }; |
| 265 | 263 |
| 266 template<typename RenderPassCuller> | 264 template<typename RenderPassCuller> |
| 267 static void removeRenderPasses(RenderPassCuller, FrameData&); | 265 static void removeRenderPasses(RenderPassCuller, FrameData&); |
| 268 | 266 |
| 269 protected: | 267 protected: |
| 270 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); | 268 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*); |
| 271 | 269 |
| 272 void animatePageScale(base::TimeTicks monotonicTime); | 270 void animatePageScale(base::TimeTicks monotonicTime); |
| 273 void animateScrollbars(base::TimeTicks monotonicTime); | 271 void animateScrollbars(base::TimeTicks monotonicTime); |
| 274 | 272 |
| 275 // Exposed for testing. | 273 // Exposed for testing. |
| 276 void calculateRenderSurfaceLayerList(LayerList&); | 274 void calculateRenderSurfaceLayerList(LayerList&); |
| 277 | 275 |
| 278 // Virtual for testing. | 276 // Virtual for testing. |
| 279 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); | 277 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); |
| 280 | 278 |
| 281 // Virtual for testing. | 279 // Virtual for testing. |
| 282 virtual base::TimeDelta lowFrequencyAnimationInterval() const; | 280 virtual base::TimeDelta lowFrequencyAnimationInterval() const; |
| 283 | 281 |
| 284 LayerTreeHostImplClient* m_client; | 282 LayerTreeHostImplClient* m_client; |
| 285 Proxy* m_proxy; | |
| 286 int m_sourceFrameNumber; | 283 int m_sourceFrameNumber; |
| 287 | 284 |
| 288 private: | 285 private: |
| 289 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); | 286 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); |
| 290 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); | 287 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); |
| 291 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, const IntSize& scr
ollOffset, float pageScale); | 288 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, const IntSize& scr
ollOffset, float pageScale); |
| 292 | 289 |
| 293 void setPageScaleDelta(float); | 290 void setPageScaleDelta(float); |
| 294 void updateMaxScrollPosition(); | 291 void updateMaxScrollPosition(); |
| 295 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); | 292 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 351 |
| 355 size_t m_numImplThreadScrolls; | 352 size_t m_numImplThreadScrolls; |
| 356 size_t m_numMainThreadScrolls; | 353 size_t m_numMainThreadScrolls; |
| 357 | 354 |
| 358 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 355 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 359 }; | 356 }; |
| 360 | 357 |
| 361 } // namespace cc | 358 } // namespace cc |
| 362 | 359 |
| 363 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 360 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |