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