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 Proxy* proxy() const { return m_proxy; } | 266 Proxy* proxy() const { return m_proxy; } |
269 | 267 |
(...skipping 23 matching lines...) Expand all Loading... | |
293 // Iterates in draw order, so that when a surface is removed, and its | 291 // Iterates in draw order, so that when a surface is removed, and its |
294 // target becomes empty, then its target can be removed also. | 292 // target becomes empty, then its target can be removed also. |
295 size_t renderPassListBegin(const RenderPassList&) const { return 0; } | 293 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
296 size_t renderPassListEnd(const RenderPassList& list) const { return list .size(); } | 294 size_t renderPassListEnd(const RenderPassList& list) const { return list .size(); } |
297 size_t renderPassListNext(size_t it) const { return it + 1; } | 295 size_t renderPassListNext(size_t it) const { return it + 1; } |
298 }; | 296 }; |
299 | 297 |
300 template<typename RenderPassCuller> | 298 template<typename RenderPassCuller> |
301 static void removeRenderPasses(RenderPassCuller, FrameData&); | 299 static void removeRenderPasses(RenderPassCuller, FrameData&); |
302 | 300 |
301 // Exposed for testing. | |
302 float totalPageScaleFactor() const { return m_pinchZoomViewport.totalPageSca leFactor(); } | |
danakj
2012/12/13 00:03:37
totalPageScaleFactorForTesting() (can probly drop
| |
303 | |
303 protected: | 304 protected: |
304 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy* ); | 305 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy* ); |
305 | 306 |
306 void animatePageScale(base::TimeTicks monotonicTime); | |
307 void animateScrollbars(base::TimeTicks monotonicTime); | |
308 | |
309 void updateDrawProperties(); | |
310 | |
311 // Exposed for testing. | |
312 void calculateRenderSurfaceLayerList(LayerList&); | |
313 void resetNeedsUpdateDrawPropertiesForTesting() { m_needsUpdateDrawPropertie s = false; } | |
314 | |
315 // Virtual for testing. | 307 // Virtual for testing. |
316 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo ckTime); | 308 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo ckTime); |
317 | 309 |
318 // Virtual for testing. | 310 // Virtual for testing. |
319 virtual base::TimeDelta lowFrequencyAnimationInterval() const; | 311 virtual base::TimeDelta lowFrequencyAnimationInterval() const; |
320 | 312 |
321 LayerTreeHostImplClient* m_client; | 313 LayerTreeHostImplClient* m_client; |
322 Proxy* m_proxy; | 314 Proxy* m_proxy; |
323 | 315 |
324 private: | 316 private: |
317 void animatePageScale(base::TimeTicks monotonicTime); | |
318 void animateScrollbars(base::TimeTicks monotonicTime); | |
319 | |
320 void updateDrawProperties(); | |
321 void resetNeedsUpdateDrawPropertiesForTesting() { m_needsUpdateDrawPropertie s = false; } | |
danakj
2012/12/13 00:03:37
private fortesting method. can this be removed the
| |
322 | |
325 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); | 323 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); |
326 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); | 324 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); |
327 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scro llOffset, float pageScale); | 325 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scro llOffset, float pageScale); |
328 | 326 |
329 void setPageScaleDelta(float); | 327 void setPageScaleDelta(float); |
330 void updateMaxScrollOffset(); | 328 void updateMaxScrollOffset(); |
331 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re nderSurfaceLayerList); | 329 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re nderSurfaceLayerList); |
332 | 330 |
333 // Returns false if the frame should not be displayed. This function should | 331 // Returns false if the frame should not be displayed. This function should |
334 // only be called from prepareToDraw, as didDrawAllLayers must be called | 332 // only be called from prepareToDraw, as didDrawAllLayers must be called |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
397 size_t m_lastSentMemoryVisibleBytes; | 395 size_t m_lastSentMemoryVisibleBytes; |
398 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 396 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
399 size_t m_lastSentMemoryUseBytes; | 397 size_t m_lastSentMemoryUseBytes; |
400 | 398 |
401 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 399 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
402 }; | 400 }; |
403 | 401 |
404 } // namespace cc | 402 } // namespace cc |
405 | 403 |
406 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 404 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |