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" |
11 #include "cc/animation_events.h" | 11 #include "cc/animation_events.h" |
| 12 #include "cc/animation_registrar.h" |
12 #include "cc/cc_export.h" | 13 #include "cc/cc_export.h" |
13 #include "cc/input_handler.h" | 14 #include "cc/input_handler.h" |
14 #include "cc/output_surface_client.h" | 15 #include "cc/output_surface_client.h" |
15 #include "cc/render_pass.h" | 16 #include "cc/render_pass.h" |
16 #include "cc/render_pass_sink.h" | 17 #include "cc/render_pass_sink.h" |
17 #include "cc/renderer.h" | 18 #include "cc/renderer.h" |
18 #include "cc/tile_manager.h" | 19 #include "cc/tile_manager.h" |
19 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
20 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
21 | 22 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); | 242 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); |
242 gfx::Transform implTransform() const; | 243 gfx::Transform implTransform() const; |
243 | 244 |
244 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); | 245 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); |
245 | 246 |
246 SkColor backgroundColor() const { return m_backgroundColor; } | 247 SkColor backgroundColor() const { return m_backgroundColor; } |
247 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | 248 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } |
248 | 249 |
249 bool hasTransparentBackground() const { return m_hasTransparentBackground; } | 250 bool hasTransparentBackground() const { return m_hasTransparentBackground; } |
250 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | 251 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } |
251 | 252 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima
tion_controllers().empty(); } |
252 bool needsAnimateLayers() const { return m_needsAnimateLayers; } | |
253 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } | |
254 | 253 |
255 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} | 254 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} |
256 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } | 255 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } |
257 | 256 |
258 void setNeedsRedraw(); | 257 void setNeedsRedraw(); |
259 | 258 |
260 void renderingStats(RenderingStats*) const; | 259 void renderingStats(RenderingStats*) const; |
261 | 260 |
262 void sendManagedMemoryStats( | 261 void sendManagedMemoryStats( |
263 size_t memoryVisibleBytes, | 262 size_t memoryVisibleBytes, |
264 size_t memoryVisibleAndNearbyBytes, | 263 size_t memoryVisibleAndNearbyBytes, |
265 size_t memoryUseBytes); | 264 size_t memoryUseBytes); |
266 | 265 |
267 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 266 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
268 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } | 267 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } |
269 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } | 268 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } |
270 | 269 |
271 Proxy* proxy() const { return m_proxy; } | 270 Proxy* proxy() const { return m_proxy; } |
272 | 271 |
| 272 AnimationRegistrar* animationRegistrar() const { return m_animationRegistrar
.get(); } |
| 273 |
273 void setDebugState(const LayerTreeDebugState& debugState) { m_debugState = d
ebugState; } | 274 void setDebugState(const LayerTreeDebugState& debugState) { m_debugState = d
ebugState; } |
274 const LayerTreeDebugState& debugState() const { return m_debugState; } | 275 const LayerTreeDebugState& debugState() const { return m_debugState; } |
275 | 276 |
276 class CC_EXPORT CullRenderPassesWithCachedTextures { | 277 class CC_EXPORT CullRenderPassesWithCachedTextures { |
277 public: | 278 public: |
278 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; | 279 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; |
279 | 280 |
280 // Iterates from the root first, in order to remove the surfaces closest | 281 // Iterates from the root first, in order to remove the surfaces closest |
281 // to the root with cached textures, and all surfaces that draw into | 282 // to the root with cached textures, and all surfaces that draw into |
282 // them. | 283 // them. |
(...skipping 24 matching lines...) Expand all Loading... |
307 | 308 |
308 protected: | 309 protected: |
309 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); | 310 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); |
310 | 311 |
311 // Virtual for testing. | 312 // Virtual for testing. |
312 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); | 313 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); |
313 | 314 |
314 // Virtual for testing. | 315 // Virtual for testing. |
315 virtual base::TimeDelta lowFrequencyAnimationInterval() const; | 316 virtual base::TimeDelta lowFrequencyAnimationInterval() const; |
316 | 317 |
| 318 const AnimationRegistrar::AnimationControllerMap& activeAnimationControllers
() const { return m_animationRegistrar->active_animation_controllers(); } |
| 319 |
317 LayerTreeHostImplClient* m_client; | 320 LayerTreeHostImplClient* m_client; |
318 Proxy* m_proxy; | 321 Proxy* m_proxy; |
319 | 322 |
320 private: | 323 private: |
321 void animatePageScale(base::TimeTicks monotonicTime); | 324 void animatePageScale(base::TimeTicks monotonicTime); |
322 void animateScrollbars(base::TimeTicks monotonicTime); | 325 void animateScrollbars(base::TimeTicks monotonicTime); |
323 | 326 |
324 void updateDrawProperties(); | 327 void updateDrawProperties(); |
325 | 328 |
326 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); | 329 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 gfx::Size m_layoutViewportSize; | 365 gfx::Size m_layoutViewportSize; |
363 gfx::Size m_deviceViewportSize; | 366 gfx::Size m_deviceViewportSize; |
364 float m_deviceScaleFactor; | 367 float m_deviceScaleFactor; |
365 bool m_visible; | 368 bool m_visible; |
366 bool m_contentsTexturesPurged; | 369 bool m_contentsTexturesPurged; |
367 ManagedMemoryPolicy m_managedMemoryPolicy; | 370 ManagedMemoryPolicy m_managedMemoryPolicy; |
368 | 371 |
369 SkColor m_backgroundColor; | 372 SkColor m_backgroundColor; |
370 bool m_hasTransparentBackground; | 373 bool m_hasTransparentBackground; |
371 | 374 |
372 // If this is true, it is necessary to traverse the layer tree ticking the a
nimators. | |
373 bool m_needsAnimateLayers; | |
374 bool m_needsUpdateDrawProperties; | 375 bool m_needsUpdateDrawProperties; |
375 bool m_pinchGestureActive; | 376 bool m_pinchGestureActive; |
376 gfx::Point m_previousPinchAnchor; | 377 gfx::Point m_previousPinchAnchor; |
377 | 378 |
378 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; | 379 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; |
379 | 380 |
380 // This is used for ticking animations slowly when hidden. | 381 // This is used for ticking animations slowly when hidden. |
381 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; | 382 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; |
382 | 383 |
383 // List of visible layers for the most recently prepared frame. Used for | 384 // List of visible layers for the most recently prepared frame. Used for |
384 // rendering and input event hit testing. | 385 // rendering and input event hit testing. |
385 LayerList m_renderSurfaceLayerList; | 386 LayerList m_renderSurfaceLayerList; |
386 | 387 |
387 PinchZoomViewport m_pinchZoomViewport; | 388 PinchZoomViewport m_pinchZoomViewport; |
388 | 389 |
389 scoped_ptr<FrameRateCounter> m_fpsCounter; | 390 scoped_ptr<FrameRateCounter> m_fpsCounter; |
390 scoped_ptr<DebugRectHistory> m_debugRectHistory; | 391 scoped_ptr<DebugRectHistory> m_debugRectHistory; |
391 | 392 |
392 int64 m_numImplThreadScrolls; | 393 int64 m_numImplThreadScrolls; |
393 int64 m_numMainThreadScrolls; | 394 int64 m_numMainThreadScrolls; |
394 | 395 |
395 int64 m_cumulativeNumLayersDrawn; | 396 int64 m_cumulativeNumLayersDrawn; |
396 | 397 |
397 int64 m_cumulativeNumMissingTiles; | 398 int64 m_cumulativeNumMissingTiles; |
398 | 399 |
399 size_t m_lastSentMemoryVisibleBytes; | 400 size_t m_lastSentMemoryVisibleBytes; |
400 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 401 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
401 size_t m_lastSentMemoryUseBytes; | 402 size_t m_lastSentMemoryUseBytes; |
402 | 403 |
| 404 scoped_ptr<AnimationRegistrar> m_animationRegistrar; |
| 405 |
403 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 406 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
404 }; | 407 }; |
405 | 408 |
406 } // namespace cc | 409 } // namespace cc |
407 | 410 |
408 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 411 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |