| 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" | |
| 13 #include "cc/cc_export.h" | 12 #include "cc/cc_export.h" |
| 14 #include "cc/input_handler.h" | 13 #include "cc/input_handler.h" |
| 15 #include "cc/layer_tree_impl.h" | 14 #include "cc/layer_tree_impl.h" |
| 16 #include "cc/output_surface_client.h" | 15 #include "cc/output_surface_client.h" |
| 17 #include "cc/render_pass.h" | 16 #include "cc/render_pass.h" |
| 18 #include "cc/render_pass_sink.h" | 17 #include "cc/render_pass_sink.h" |
| 19 #include "cc/renderer.h" | 18 #include "cc/renderer.h" |
| 20 #include "cc/tile_manager.h" | 19 #include "cc/tile_manager.h" |
| 21 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
| 22 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 106 |
| 108 gfx::Vector2dF m_zoomedViewportOffset; | 107 gfx::Vector2dF m_zoomedViewportOffset; |
| 109 gfx::SizeF m_layoutViewportSize; | 108 gfx::SizeF m_layoutViewportSize; |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te | 111 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te |
| 113 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, | 112 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, |
| 114 public RendererClient, | 113 public RendererClient, |
| 115 public TileManagerClient, | 114 public TileManagerClient, |
| 116 public LayerTreeImplClient, | 115 public LayerTreeImplClient, |
| 117 public AnimationRegistrar, | |
| 118 public OutputSurfaceClient { | 116 public OutputSurfaceClient { |
| 119 typedef std::vector<LayerImpl*> LayerList; | 117 typedef std::vector<LayerImpl*> LayerList; |
| 120 typedef base::hash_set<LayerAnimationController*> AnimationControllerSet; | |
| 121 | 118 |
| 122 public: | 119 public: |
| 123 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*, Proxy*); | 120 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*, Proxy*); |
| 124 virtual ~LayerTreeHostImpl(); | 121 virtual ~LayerTreeHostImpl(); |
| 125 | 122 |
| 126 // InputHandlerClient implementation | 123 // InputHandlerClient implementation |
| 127 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle
rClient::ScrollInputType) OVERRIDE; | 124 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle
rClient::ScrollInputType) OVERRIDE; |
| 128 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE; | 125 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE; |
| 129 virtual void scrollEnd() OVERRIDE; | 126 virtual void scrollEnd() OVERRIDE; |
| 130 virtual void pinchGestureBegin() OVERRIDE; | 127 virtual void pinchGestureBegin() OVERRIDE; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); | 238 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); |
| 242 gfx::Transform implTransform() const; | 239 gfx::Transform implTransform() const; |
| 243 | 240 |
| 244 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); | 241 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); |
| 245 | 242 |
| 246 SkColor backgroundColor() const { return m_backgroundColor; } | 243 SkColor backgroundColor() const { return m_backgroundColor; } |
| 247 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | 244 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } |
| 248 | 245 |
| 249 bool hasTransparentBackground() const { return m_hasTransparentBackground; } | 246 bool hasTransparentBackground() const { return m_hasTransparentBackground; } |
| 250 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | 247 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } |
| 251 bool needsAnimateLayers() const { return !m_activeAnimationControllers.empty
(); } | 248 |
| 249 bool needsAnimateLayers() const { return m_needsAnimateLayers; } |
| 250 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } |
| 252 | 251 |
| 253 void setNeedsRedraw(); | 252 void setNeedsRedraw(); |
| 254 | 253 |
| 255 void renderingStats(RenderingStats*) const; | 254 void renderingStats(RenderingStats*) const; |
| 256 | 255 |
| 257 void updateRootScrollLayerImplTransform(); | 256 void updateRootScrollLayerImplTransform(); |
| 258 | 257 |
| 259 void sendManagedMemoryStats( | 258 void sendManagedMemoryStats( |
| 260 size_t memoryVisibleBytes, | 259 size_t memoryVisibleBytes, |
| 261 size_t memoryVisibleAndNearbyBytes, | 260 size_t memoryVisibleAndNearbyBytes, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 335 |
| 337 void sendDidLoseOutputSurfaceRecursive(LayerImpl*); | 336 void sendDidLoseOutputSurfaceRecursive(LayerImpl*); |
| 338 void clearRenderSurfaces(); | 337 void clearRenderSurfaces(); |
| 339 bool ensureRenderSurfaceLayerList(); | 338 bool ensureRenderSurfaceLayerList(); |
| 340 void clearCurrentlyScrollingLayer(); | 339 void clearCurrentlyScrollingLayer(); |
| 341 | 340 |
| 342 void animateScrollbarsRecursive(LayerImpl*, base::TimeTicks monotonicTime); | 341 void animateScrollbarsRecursive(LayerImpl*, base::TimeTicks monotonicTime); |
| 343 | 342 |
| 344 void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const; | 343 void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const; |
| 345 | 344 |
| 346 // AnimationRegistar implementation. | |
| 347 virtual void DidActivateAnimationController(LayerAnimationController*) OVERR
IDE; | |
| 348 virtual void DidDeactivateAnimationController(LayerAnimationController*) OVE
RRIDE; | |
| 349 virtual void RegisterAnimationController(LayerAnimationController*) OVERRIDE
; | |
| 350 virtual void UnregisterAnimationController(LayerAnimationController*) OVERRI
DE; | |
| 351 | |
| 352 scoped_ptr<OutputSurface> m_outputSurface; | 345 scoped_ptr<OutputSurface> m_outputSurface; |
| 353 | |
| 354 scoped_ptr<ResourceProvider> m_resourceProvider; | 346 scoped_ptr<ResourceProvider> m_resourceProvider; |
| 355 scoped_ptr<Renderer> m_renderer; | 347 scoped_ptr<Renderer> m_renderer; |
| 356 scoped_ptr<TileManager> m_tileManager; | 348 scoped_ptr<TileManager> m_tileManager; |
| 357 | 349 |
| 358 scoped_ptr<LayerTreeImpl> m_activeTree; | 350 scoped_ptr<LayerTreeImpl> m_activeTree; |
| 359 | 351 |
| 360 bool m_scrollDeltaIsInViewportSpace; | 352 bool m_scrollDeltaIsInViewportSpace; |
| 361 LayerTreeSettings m_settings; | 353 LayerTreeSettings m_settings; |
| 362 LayerTreeDebugState m_debugState; | 354 LayerTreeDebugState m_debugState; |
| 363 gfx::Size m_layoutViewportSize; | 355 gfx::Size m_layoutViewportSize; |
| 364 gfx::Size m_deviceViewportSize; | 356 gfx::Size m_deviceViewportSize; |
| 365 float m_deviceScaleFactor; | 357 float m_deviceScaleFactor; |
| 366 bool m_visible; | 358 bool m_visible; |
| 367 bool m_contentsTexturesPurged; | 359 bool m_contentsTexturesPurged; |
| 368 ManagedMemoryPolicy m_managedMemoryPolicy; | 360 ManagedMemoryPolicy m_managedMemoryPolicy; |
| 369 | 361 |
| 370 SkColor m_backgroundColor; | 362 SkColor m_backgroundColor; |
| 371 bool m_hasTransparentBackground; | 363 bool m_hasTransparentBackground; |
| 372 | 364 |
| 373 // If this is true, it is necessary to traverse the layer tree ticking the a
nimators. | 365 // If this is true, it is necessary to traverse the layer tree ticking the a
nimators. |
| 366 bool m_needsAnimateLayers; |
| 374 bool m_pinchGestureActive; | 367 bool m_pinchGestureActive; |
| 375 gfx::Point m_previousPinchAnchor; | 368 gfx::Point m_previousPinchAnchor; |
| 376 | 369 |
| 377 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; | 370 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; |
| 378 | 371 |
| 379 // This is used for ticking animations slowly when hidden. | 372 // This is used for ticking animations slowly when hidden. |
| 380 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; | 373 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; |
| 381 | 374 |
| 382 // List of visible layers for the most recently prepared frame. Used for | 375 // List of visible layers for the most recently prepared frame. Used for |
| 383 // rendering and input event hit testing. | 376 // rendering and input event hit testing. |
| 384 LayerList m_renderSurfaceLayerList; | 377 LayerList m_renderSurfaceLayerList; |
| 385 | 378 |
| 386 PinchZoomViewport m_pinchZoomViewport; | 379 PinchZoomViewport m_pinchZoomViewport; |
| 387 | 380 |
| 388 scoped_ptr<FrameRateCounter> m_fpsCounter; | 381 scoped_ptr<FrameRateCounter> m_fpsCounter; |
| 389 scoped_ptr<DebugRectHistory> m_debugRectHistory; | 382 scoped_ptr<DebugRectHistory> m_debugRectHistory; |
| 390 | 383 |
| 391 int64 m_numImplThreadScrolls; | 384 int64 m_numImplThreadScrolls; |
| 392 int64 m_numMainThreadScrolls; | 385 int64 m_numMainThreadScrolls; |
| 393 | 386 |
| 394 int64 m_cumulativeNumLayersDrawn; | 387 int64 m_cumulativeNumLayersDrawn; |
| 395 | 388 |
| 396 int64 m_cumulativeNumMissingTiles; | 389 int64 m_cumulativeNumMissingTiles; |
| 397 | 390 |
| 398 AnimationControllerSet m_activeAnimationControllers; | |
| 399 | |
| 400 #if !defined(NDEBUG) | |
| 401 AnimationControllerSet m_allAnimationControllers; | |
| 402 #endif | |
| 403 | |
| 404 size_t m_lastSentMemoryVisibleBytes; | 391 size_t m_lastSentMemoryVisibleBytes; |
| 405 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 392 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
| 406 size_t m_lastSentMemoryUseBytes; | 393 size_t m_lastSentMemoryUseBytes; |
| 407 | 394 |
| 408 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 395 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 409 }; | 396 }; |
| 410 | 397 |
| 411 } // namespace cc | 398 } // namespace cc |
| 412 | 399 |
| 413 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 400 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |