| 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 CC_EXPORT PinchZoomViewport { | 55 class 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 |
| 260 void sendManagedMemoryStats( | 262 void sendManagedMemoryStats( |
| 261 size_t memoryVisibleBytes, | 263 size_t memoryVisibleBytes, |
| 262 size_t memoryVisibleAndNearbyBytes, | 264 size_t memoryVisibleAndNearbyBytes, |
| 263 size_t memoryUseBytes); | 265 size_t memoryUseBytes); |
| 264 | 266 |
| 265 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 267 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
| 266 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } | 268 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } |
| 267 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } | 269 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } |
| 268 | 270 |
| 269 Proxy* proxy() const { return m_proxy; } | 271 Proxy* proxy() const { return m_proxy; } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 294 // Iterates in draw order, so that when a surface is removed, and its | 296 // Iterates in draw order, so that when a surface is removed, and its |
| 295 // target becomes empty, then its target can be removed also. | 297 // target becomes empty, then its target can be removed also. |
| 296 size_t renderPassListBegin(const RenderPassList&) const { return 0; } | 298 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
| 297 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } | 299 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } |
| 298 size_t renderPassListNext(size_t it) const { return it + 1; } | 300 size_t renderPassListNext(size_t it) const { return it + 1; } |
| 299 }; | 301 }; |
| 300 | 302 |
| 301 template<typename RenderPassCuller> | 303 template<typename RenderPassCuller> |
| 302 static void removeRenderPasses(RenderPassCuller, FrameData&); | 304 static void removeRenderPasses(RenderPassCuller, FrameData&); |
| 303 | 305 |
| 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 |
| 309 // Virtual for testing. | 318 // Virtual for testing. |
| 310 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); | 319 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); |
| 311 | 320 |
| 312 // Virtual for testing. | 321 // Virtual for testing. |
| 313 virtual base::TimeDelta lowFrequencyAnimationInterval() const; | 322 virtual base::TimeDelta lowFrequencyAnimationInterval() const; |
| 314 | 323 |
| 315 LayerTreeHostImplClient* m_client; | 324 LayerTreeHostImplClient* m_client; |
| 316 Proxy* m_proxy; | 325 Proxy* m_proxy; |
| 317 | 326 |
| 318 private: | 327 private: |
| 319 void animatePageScale(base::TimeTicks monotonicTime); | |
| 320 void animateScrollbars(base::TimeTicks monotonicTime); | |
| 321 | |
| 322 void updateDrawProperties(); | |
| 323 | |
| 324 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); | 328 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); |
| 325 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); | 329 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); |
| 326 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scro
llOffset, float pageScale); | 330 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scro
llOffset, float pageScale); |
| 327 | 331 |
| 328 void setPageScaleDelta(float); | 332 void setPageScaleDelta(float); |
| 329 void updateMaxScrollOffset(); | 333 void updateMaxScrollOffset(); |
| 330 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); | 334 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); |
| 331 | 335 |
| 332 // Returns false if the frame should not be displayed. This function should | 336 // Returns false if the frame should not be displayed. This function should |
| 333 // only be called from prepareToDraw, as didDrawAllLayers must be called | 337 // only be called from prepareToDraw, as didDrawAllLayers must be called |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 size_t m_lastSentMemoryVisibleBytes; | 401 size_t m_lastSentMemoryVisibleBytes; |
| 398 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 402 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
| 399 size_t m_lastSentMemoryUseBytes; | 403 size_t m_lastSentMemoryUseBytes; |
| 400 | 404 |
| 401 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 405 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 402 }; | 406 }; |
| 403 | 407 |
| 404 } // namespace cc | 408 } // namespace cc |
| 405 | 409 |
| 406 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 410 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |