| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 virtual void setNeedsManageTilesOnImplThread() = 0; | 45 virtual void setNeedsManageTilesOnImplThread() = 0; |
| 46 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) = 0; | 46 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) = 0; |
| 47 // Returns true if resources were deleted by this call. | 47 // Returns true if resources were deleted by this call. |
| 48 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) = 0; | 48 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) = 0; |
| 49 virtual void sendManagedMemoryStats() = 0; | 49 virtual void sendManagedMemoryStats() = 0; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // PinchZoomViewport models the bounds and offset of the viewport that is used d
uring a pinch-zoom operation. | 52 // PinchZoomViewport models the bounds and offset of the viewport that is used d
uring a pinch-zoom operation. |
| 53 // It tracks the layout-space dimensions of the viewport before any applied scal
e, and then tracks the layout-space | 53 // It tracks the layout-space dimensions of the viewport before any applied scal
e, and then tracks the layout-space |
| 54 // coordinates of the viewport respecting the pinch settings. | 54 // coordinates of the viewport respecting the pinch settings. |
| 55 class PinchZoomViewport { | 55 class CC_EXPORT PinchZoomViewport { |
| 56 public: | 56 public: |
| 57 PinchZoomViewport(); | 57 PinchZoomViewport(); |
| 58 | 58 |
| 59 float totalPageScaleFactor() const; | 59 float totalPageScaleFactor() const; |
| 60 | 60 |
| 61 void setPageScaleFactor(float factor) { m_pageScaleFactor = factor; } | 61 void setPageScaleFactor(float factor) { m_pageScaleFactor = factor; } |
| 62 float pageScaleFactor() const { return m_pageScaleFactor; } | 62 float pageScaleFactor() const { return m_pageScaleFactor; } |
| 63 | 63 |
| 64 void setPageScaleDelta(float delta); | 64 void setPageScaleDelta(float delta); |
| 65 float pageScaleDelta() const { return m_pageScaleDelta; } | 65 float pageScaleDelta() const { return m_pageScaleDelta; } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 bool needsAnimateLayers() const { return m_needsAnimateLayers; } | 250 bool needsAnimateLayers() const { return m_needsAnimateLayers; } |
| 251 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } | 251 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } |
| 252 | 252 |
| 253 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} | 253 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} |
| 254 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } | 254 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } |
| 255 | 255 |
| 256 void setNeedsRedraw(); | 256 void setNeedsRedraw(); |
| 257 | 257 |
| 258 void renderingStats(RenderingStats*) const; | 258 void renderingStats(RenderingStats*) const; |
| 259 | 259 |
| 260 void updateRootScrollLayerImplTransform(); | |
| 261 | |
| 262 void sendManagedMemoryStats( | 260 void sendManagedMemoryStats( |
| 263 size_t memoryVisibleBytes, | 261 size_t memoryVisibleBytes, |
| 264 size_t memoryVisibleAndNearbyBytes, | 262 size_t memoryVisibleAndNearbyBytes, |
| 265 size_t memoryUseBytes); | 263 size_t memoryUseBytes); |
| 266 | 264 |
| 267 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 265 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
| 268 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } | 266 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } |
| 269 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } | 267 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } |
| 270 | 268 |
| 271 Proxy* proxy() const { return m_proxy; } | 269 Proxy* proxy() const { return m_proxy; } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 296 // Iterates in draw order, so that when a surface is removed, and its | 294 // Iterates in draw order, so that when a surface is removed, and its |
| 297 // target becomes empty, then its target can be removed also. | 295 // target becomes empty, then its target can be removed also. |
| 298 size_t renderPassListBegin(const RenderPassList&) const { return 0; } | 296 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
| 299 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } | 297 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } |
| 300 size_t renderPassListNext(size_t it) const { return it + 1; } | 298 size_t renderPassListNext(size_t it) const { return it + 1; } |
| 301 }; | 299 }; |
| 302 | 300 |
| 303 template<typename RenderPassCuller> | 301 template<typename RenderPassCuller> |
| 304 static void removeRenderPasses(RenderPassCuller, FrameData&); | 302 static void removeRenderPasses(RenderPassCuller, FrameData&); |
| 305 | 303 |
| 304 float totalPageScaleFactorForTesting() const { return m_pinchZoomViewport.to
talPageScaleFactor(); } |
| 305 |
| 306 protected: | 306 protected: |
| 307 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); | 307 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); |
| 308 | 308 |
| 309 void animatePageScale(base::TimeTicks monotonicTime); | |
| 310 void animateScrollbars(base::TimeTicks monotonicTime); | |
| 311 | |
| 312 void updateDrawProperties(); | |
| 313 | |
| 314 // Exposed for testing. | |
| 315 void calculateRenderSurfaceLayerList(LayerList&); | |
| 316 void resetNeedsUpdateDrawPropertiesForTesting() { m_needsUpdateDrawPropertie
s = false; } | |
| 317 | |
| 318 // Virtual for testing. | 309 // Virtual for testing. |
| 319 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); | 310 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); |
| 320 | 311 |
| 321 // Virtual for testing. | 312 // Virtual for testing. |
| 322 virtual base::TimeDelta lowFrequencyAnimationInterval() const; | 313 virtual base::TimeDelta lowFrequencyAnimationInterval() const; |
| 323 | 314 |
| 324 LayerTreeHostImplClient* m_client; | 315 LayerTreeHostImplClient* m_client; |
| 325 Proxy* m_proxy; | 316 Proxy* m_proxy; |
| 326 | 317 |
| 327 private: | 318 private: |
| 319 void animatePageScale(base::TimeTicks monotonicTime); |
| 320 void animateScrollbars(base::TimeTicks monotonicTime); |
| 321 |
| 322 void updateDrawProperties(); |
| 323 |
| 328 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); | 324 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); |
| 329 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); | 325 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); |
| 330 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scro
llOffset, float pageScale); | 326 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scro
llOffset, float pageScale); |
| 331 | 327 |
| 332 void setPageScaleDelta(float); | 328 void setPageScaleDelta(float); |
| 333 void updateMaxScrollOffset(); | 329 void updateMaxScrollOffset(); |
| 334 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); | 330 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); |
| 335 | 331 |
| 336 // Returns false if the frame should not be displayed. This function should | 332 // Returns false if the frame should not be displayed. This function should |
| 337 // only be called from prepareToDraw, as didDrawAllLayers must be called | 333 // only be called from prepareToDraw, as didDrawAllLayers must be called |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 size_t m_lastSentMemoryVisibleBytes; | 397 size_t m_lastSentMemoryVisibleBytes; |
| 402 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 398 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
| 403 size_t m_lastSentMemoryUseBytes; | 399 size_t m_lastSentMemoryUseBytes; |
| 404 | 400 |
| 405 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 401 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 406 }; | 402 }; |
| 407 | 403 |
| 408 } // namespace cc | 404 } // namespace cc |
| 409 | 405 |
| 410 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 406 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |