Chromium Code Reviews| 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/cc_export.h" | 12 #include "cc/cc_export.h" |
| 13 #include "cc/input_handler.h" | 13 #include "cc/input_handler.h" |
| 14 #include "cc/output_surface_client.h" | 14 #include "cc/output_surface_client.h" |
| 15 #include "cc/render_pass.h" | 15 #include "cc/render_pass.h" |
| 16 #include "cc/render_pass_sink.h" | 16 #include "cc/render_pass_sink.h" |
| 17 #include "cc/renderer.h" | 17 #include "cc/renderer.h" |
| 18 #include "cc/tile_manager.h" | 18 #include "cc/tile_manager.h" |
| 19 #include "cc/top_controls_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 |
| 22 namespace cc { | 23 namespace cc { |
| 23 | 24 |
| 24 class CompletionEvent; | 25 class CompletionEvent; |
| 25 class CompositorFrameMetadata; | 26 class CompositorFrameMetadata; |
| 26 class DebugRectHistory; | 27 class DebugRectHistory; |
| 27 class FrameRateCounter; | 28 class FrameRateCounter; |
| 28 class LayerImpl; | 29 class LayerImpl; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 float m_deviceScaleFactor; | 107 float m_deviceScaleFactor; |
| 107 | 108 |
| 108 gfx::Vector2dF m_zoomedViewportOffset; | 109 gfx::Vector2dF m_zoomedViewportOffset; |
| 109 gfx::SizeF m_layoutViewportSize; | 110 gfx::SizeF m_layoutViewportSize; |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta te | 113 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta te |
| 113 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, | 114 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, |
| 114 public RendererClient, | 115 public RendererClient, |
| 115 public TileManagerClient, | 116 public TileManagerClient, |
| 116 public OutputSurfaceClient { | 117 public OutputSurfaceClient, |
| 118 public TopControlsDelegate { | |
| 117 typedef std::vector<LayerImpl*> LayerList; | 119 typedef std::vector<LayerImpl*> LayerList; |
| 118 | 120 |
| 119 public: | 121 public: |
| 120 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT reeHostImplClient*, Proxy*); | 122 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT reeHostImplClient*, Proxy*); |
| 121 virtual ~LayerTreeHostImpl(); | 123 virtual ~LayerTreeHostImpl(); |
| 122 | 124 |
| 123 // InputHandlerClient implementation | 125 // InputHandlerClient implementation |
| 124 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle rClient::ScrollInputType) OVERRIDE; | 126 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle rClient::ScrollInputType) OVERRIDE; |
| 125 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE; | 127 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE; |
| 126 virtual void scrollEnd() OVERRIDE; | 128 virtual void scrollEnd() OVERRIDE; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 bool initializeRenderer(scoped_ptr<OutputSurface>); | 200 bool initializeRenderer(scoped_ptr<OutputSurface>); |
| 199 bool isContextLost(); | 201 bool isContextLost(); |
| 200 TileManager* tileManager() { return m_tileManager.get(); } | 202 TileManager* tileManager() { return m_tileManager.get(); } |
| 201 Renderer* renderer() { return m_renderer.get(); } | 203 Renderer* renderer() { return m_renderer.get(); } |
| 202 const RendererCapabilities& rendererCapabilities() const; | 204 const RendererCapabilities& rendererCapabilities() const; |
| 203 | 205 |
| 204 bool swapBuffers(); | 206 bool swapBuffers(); |
| 205 | 207 |
| 206 void readback(void* pixels, const gfx::Rect&); | 208 void readback(void* pixels, const gfx::Rect&); |
| 207 | 209 |
| 208 LayerTreeImpl* activeTree() { return m_activeTree.get(); } | 210 virtual LayerTreeImpl* activeTree() OVERRIDE; |
|
jamesr
2012/12/19 22:56:29
document what interface this is overriding, i.e. "
Ted C
2012/12/20 00:42:39
Done.
| |
| 209 LayerTreeImpl* pendingTree() { return m_pendingTree.get(); } | 211 LayerTreeImpl* pendingTree() { return m_pendingTree.get(); } |
| 210 | 212 |
| 211 // TODO(nduca): Remove these in favor of LayerTreeImpl. | 213 // TODO(nduca): Remove these in favor of LayerTreeImpl. |
| 212 void setRootLayer(scoped_ptr<LayerImpl>); | 214 void setRootLayer(scoped_ptr<LayerImpl>); |
| 213 LayerImpl* rootLayer() const; | 215 LayerImpl* rootLayer() const; |
| 214 | 216 |
| 215 // Release ownership of the current layer tree and replace it with an empty | 217 // Release ownership of the current layer tree and replace it with an empty |
| 216 // tree. Returns the root layer of the detached tree. | 218 // tree. Returns the root layer of the detached tree. |
| 217 scoped_ptr<LayerImpl> detachLayerTree(); | 219 scoped_ptr<LayerImpl> detachLayerTree(); |
| 218 | 220 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 246 SkColor backgroundColor() const { return m_backgroundColor; } | 248 SkColor backgroundColor() const { return m_backgroundColor; } |
| 247 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | 249 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } |
| 248 | 250 |
| 249 bool hasTransparentBackground() const { return m_hasTransparentBackground; } | 251 bool hasTransparentBackground() const { return m_hasTransparentBackground; } |
| 250 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro und = transparent; } | 252 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro und = transparent; } |
| 251 | 253 |
| 252 bool needsAnimateLayers() const { return m_needsAnimateLayers; } | 254 bool needsAnimateLayers() const { return m_needsAnimateLayers; } |
| 253 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } | 255 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } |
| 254 | 256 |
| 255 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties; } | 257 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties; } |
| 256 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } | 258 virtual void setNeedsUpdateDrawProperties() OVERRIDE; |
| 257 | 259 |
| 258 void setNeedsRedraw(); | 260 virtual void setNeedsRedraw() OVERRIDE; |
| 259 | 261 |
| 260 void renderingStats(RenderingStats*) const; | 262 void renderingStats(RenderingStats*) const; |
| 261 | 263 |
| 262 void sendManagedMemoryStats( | 264 void sendManagedMemoryStats( |
| 263 size_t memoryVisibleBytes, | 265 size_t memoryVisibleBytes, |
| 264 size_t memoryVisibleAndNearbyBytes, | 266 size_t memoryVisibleAndNearbyBytes, |
| 265 size_t memoryUseBytes); | 267 size_t memoryUseBytes); |
| 266 | 268 |
| 267 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 269 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
| 268 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get() ; } | 270 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get() ; } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 | 370 |
| 369 SkColor m_backgroundColor; | 371 SkColor m_backgroundColor; |
| 370 bool m_hasTransparentBackground; | 372 bool m_hasTransparentBackground; |
| 371 | 373 |
| 372 // If this is true, it is necessary to traverse the layer tree ticking the a nimators. | 374 // If this is true, it is necessary to traverse the layer tree ticking the a nimators. |
| 373 bool m_needsAnimateLayers; | 375 bool m_needsAnimateLayers; |
| 374 bool m_needsUpdateDrawProperties; | 376 bool m_needsUpdateDrawProperties; |
| 375 bool m_pinchGestureActive; | 377 bool m_pinchGestureActive; |
| 376 gfx::Point m_previousPinchAnchor; | 378 gfx::Point m_previousPinchAnchor; |
| 377 | 379 |
| 380 scoped_ptr<TopControlsManager> m_topControlsManager; | |
| 381 | |
| 378 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; | 382 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; |
| 379 | 383 |
| 380 // This is used for ticking animations slowly when hidden. | 384 // This is used for ticking animations slowly when hidden. |
| 381 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; | 385 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; |
| 382 | 386 |
| 383 // List of visible layers for the most recently prepared frame. Used for | 387 // List of visible layers for the most recently prepared frame. Used for |
| 384 // rendering and input event hit testing. | 388 // rendering and input event hit testing. |
| 385 LayerList m_renderSurfaceLayerList; | 389 LayerList m_renderSurfaceLayerList; |
| 386 | 390 |
| 387 PinchZoomViewport m_pinchZoomViewport; | 391 PinchZoomViewport m_pinchZoomViewport; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 399 size_t m_lastSentMemoryVisibleBytes; | 403 size_t m_lastSentMemoryVisibleBytes; |
| 400 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 404 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
| 401 size_t m_lastSentMemoryUseBytes; | 405 size_t m_lastSentMemoryUseBytes; |
| 402 | 406 |
| 403 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 407 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 404 }; | 408 }; |
| 405 | 409 |
| 406 } // namespace cc | 410 } // namespace cc |
| 407 | 411 |
| 408 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 412 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |