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