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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 bool needsAnimateLayers() const { return m_needsAnimateLayers; } | 248 bool needsAnimateLayers() const { return m_needsAnimateLayers; } |
249 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } | 249 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } |
250 | 250 |
251 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} | 251 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} |
252 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } | 252 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } |
253 | 253 |
254 void setNeedsRedraw(); | 254 void setNeedsRedraw(); |
255 | 255 |
256 void renderingStats(RenderingStats*) const; | 256 void renderingStats(RenderingStats*) const; |
257 | 257 |
258 void updateRootScrollLayerImplTransform(); | |
259 | |
260 void sendManagedMemoryStats( | 258 void sendManagedMemoryStats( |
261 size_t memoryVisibleBytes, | 259 size_t memoryVisibleBytes, |
262 size_t memoryVisibleAndNearbyBytes, | 260 size_t memoryVisibleAndNearbyBytes, |
263 size_t memoryUseBytes); | 261 size_t memoryUseBytes); |
264 | 262 |
265 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 263 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
266 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } | 264 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } |
267 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } | 265 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } |
268 | 266 |
269 Proxy* proxy() const { return m_proxy; } | 267 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 | 292 // Iterates in draw order, so that when a surface is removed, and its |
295 // target becomes empty, then its target can be removed also. | 293 // target becomes empty, then its target can be removed also. |
296 size_t renderPassListBegin(const RenderPassList&) const { return 0; } | 294 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
297 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } | 295 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } |
298 size_t renderPassListNext(size_t it) const { return it + 1; } | 296 size_t renderPassListNext(size_t it) const { return it + 1; } |
299 }; | 297 }; |
300 | 298 |
301 template<typename RenderPassCuller> | 299 template<typename RenderPassCuller> |
302 static void removeRenderPasses(RenderPassCuller, FrameData&); | 300 static void removeRenderPasses(RenderPassCuller, FrameData&); |
303 | 301 |
| 302 float totalPageScaleFactorForTesting() const { return m_pinchZoomViewport.to
talPageScaleFactor(); } |
| 303 |
304 protected: | 304 protected: |
305 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); | 305 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); |
306 | 306 |
307 void animatePageScale(base::TimeTicks monotonicTime); | |
308 void animateScrollbars(base::TimeTicks monotonicTime); | |
309 | |
310 void updateDrawProperties(); | |
311 | |
312 // Exposed for testing. | |
313 void calculateRenderSurfaceLayerList(LayerList&); | |
314 void resetNeedsUpdateDrawPropertiesForTesting() { m_needsUpdateDrawPropertie
s = false; } | |
315 | |
316 // Virtual for testing. | 307 // Virtual for testing. |
317 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); | 308 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); |
318 | 309 |
319 // Virtual for testing. | 310 // Virtual for testing. |
320 virtual base::TimeDelta lowFrequencyAnimationInterval() const; | 311 virtual base::TimeDelta lowFrequencyAnimationInterval() const; |
321 | 312 |
322 LayerTreeHostImplClient* m_client; | 313 LayerTreeHostImplClient* m_client; |
323 Proxy* m_proxy; | 314 Proxy* m_proxy; |
324 | 315 |
325 private: | 316 private: |
| 317 void animatePageScale(base::TimeTicks monotonicTime); |
| 318 void animateScrollbars(base::TimeTicks monotonicTime); |
| 319 |
| 320 void updateDrawProperties(); |
| 321 |
326 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); | 322 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); |
327 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); | 323 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); |
328 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scro
llOffset, float pageScale); | 324 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scro
llOffset, float pageScale); |
329 | 325 |
330 void setPageScaleDelta(float); | 326 void setPageScaleDelta(float); |
331 void updateMaxScrollOffset(); | 327 void updateMaxScrollOffset(); |
332 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); | 328 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); |
333 | 329 |
334 // Returns false if the frame should not be displayed. This function should | 330 // Returns false if the frame should not be displayed. This function should |
335 // only be called from prepareToDraw, as didDrawAllLayers must be called | 331 // only be called from prepareToDraw, as didDrawAllLayers must be called |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 size_t m_lastSentMemoryVisibleBytes; | 394 size_t m_lastSentMemoryVisibleBytes; |
399 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 395 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
400 size_t m_lastSentMemoryUseBytes; | 396 size_t m_lastSentMemoryUseBytes; |
401 | 397 |
402 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 398 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
403 }; | 399 }; |
404 | 400 |
405 } // namespace cc | 401 } // namespace cc |
406 | 402 |
407 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 403 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |