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/animation_registrar.h" | 12 #include "cc/animation_registrar.h" |
| 13 #include "cc/cc_export.h" | 13 #include "cc/cc_export.h" |
| 14 #include "cc/input_handler.h" | 14 #include "cc/input_handler.h" |
| 15 #include "cc/output_surface_client.h" | 15 #include "cc/output_surface_client.h" |
| 16 #include "cc/render_pass.h" | 16 #include "cc/render_pass.h" |
| 17 #include "cc/render_pass_sink.h" | 17 #include "cc/render_pass_sink.h" |
| 18 #include "cc/renderer.h" | 18 #include "cc/renderer.h" |
| 19 #include "cc/tile_manager.h" | 19 #include "cc/tile_manager.h" |
| 20 #include "cc/top_controls_manager_client.h" | |
| 20 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
| 21 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
| 22 | 23 |
| 23 namespace cc { | 24 namespace cc { |
| 24 | 25 |
| 25 class CompletionEvent; | 26 class CompletionEvent; |
| 26 class CompositorFrameMetadata; | 27 class CompositorFrameMetadata; |
| 27 class DebugRectHistory; | 28 class DebugRectHistory; |
| 28 class FrameRateCounter; | 29 class FrameRateCounter; |
| 29 class LayerImpl; | 30 class LayerImpl; |
| 30 class LayerTreeHostImplTimeSourceAdapter; | 31 class LayerTreeHostImplTimeSourceAdapter; |
| 31 class LayerTreeImpl; | 32 class LayerTreeImpl; |
| 32 class PageScaleAnimation; | 33 class PageScaleAnimation; |
| 33 class RenderPassDrawQuad; | 34 class RenderPassDrawQuad; |
| 34 class ResourceProvider; | 35 class ResourceProvider; |
| 36 class TopControlsManager; | |
| 35 struct RendererCapabilities; | 37 struct RendererCapabilities; |
| 36 struct RenderingStats; | 38 struct RenderingStats; |
| 37 | 39 |
| 38 // LayerTreeHost->Proxy callback interface. | 40 // LayerTreeHost->Proxy callback interface. |
| 39 class LayerTreeHostImplClient { | 41 class LayerTreeHostImplClient { |
| 40 public: | 42 public: |
| 41 virtual void didLoseOutputSurfaceOnImplThread() = 0; | 43 virtual void didLoseOutputSurfaceOnImplThread() = 0; |
| 42 virtual void onSwapBuffersCompleteOnImplThread() = 0; | 44 virtual void onSwapBuffersCompleteOnImplThread() = 0; |
| 43 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe lta interval) = 0; | 45 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe lta interval) = 0; |
| 44 virtual void onCanDrawStateChanged(bool canDraw) = 0; | 46 virtual void onCanDrawStateChanged(bool canDraw) = 0; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 float m_deviceScaleFactor; | 110 float m_deviceScaleFactor; |
| 109 | 111 |
| 110 gfx::Vector2dF m_zoomedViewportOffset; | 112 gfx::Vector2dF m_zoomedViewportOffset; |
| 111 gfx::SizeF m_layoutViewportSize; | 113 gfx::SizeF m_layoutViewportSize; |
| 112 }; | 114 }; |
| 113 | 115 |
| 114 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta te | 116 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta te |
| 115 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, | 117 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, |
| 116 public RendererClient, | 118 public RendererClient, |
| 117 public TileManagerClient, | 119 public TileManagerClient, |
| 118 public OutputSurfaceClient { | 120 public OutputSurfaceClient, |
| 121 public TopControlsManagerClient { | |
| 119 typedef std::vector<LayerImpl*> LayerList; | 122 typedef std::vector<LayerImpl*> LayerList; |
| 120 | 123 |
| 121 public: | 124 public: |
| 122 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT reeHostImplClient*, Proxy*); | 125 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT reeHostImplClient*, Proxy*); |
| 123 virtual ~LayerTreeHostImpl(); | 126 virtual ~LayerTreeHostImpl(); |
| 124 | 127 |
| 125 // InputHandlerClient implementation | 128 // InputHandlerClient implementation |
| 126 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle rClient::ScrollInputType) OVERRIDE; | 129 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle rClient::ScrollInputType) OVERRIDE; |
| 127 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE; | 130 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE; |
| 128 virtual void scrollEnd() OVERRIDE; | 131 virtual void scrollEnd() OVERRIDE; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 bool initializeRenderer(scoped_ptr<OutputSurface>); | 203 bool initializeRenderer(scoped_ptr<OutputSurface>); |
| 201 bool isContextLost(); | 204 bool isContextLost(); |
| 202 TileManager* tileManager() { return m_tileManager.get(); } | 205 TileManager* tileManager() { return m_tileManager.get(); } |
| 203 Renderer* renderer() { return m_renderer.get(); } | 206 Renderer* renderer() { return m_renderer.get(); } |
| 204 const RendererCapabilities& rendererCapabilities() const; | 207 const RendererCapabilities& rendererCapabilities() const; |
| 205 | 208 |
| 206 bool swapBuffers(); | 209 bool swapBuffers(); |
| 207 | 210 |
| 208 void readback(void* pixels, const gfx::Rect&); | 211 void readback(void* pixels, const gfx::Rect&); |
| 209 | 212 |
| 210 LayerTreeImpl* activeTree() { return m_activeTree.get(); } | 213 virtual LayerTreeImpl* activeTree() OVERRIDE; // TopControlsManagerClient i mplementation. |
|
jamesr
2013/01/08 02:26:48
put this comment on the previous line
Ted C
2013/01/08 18:17:33
Done. (moved them all up as suggested below)
| |
| 211 const LayerTreeImpl* activeTree() const { return m_activeTree.get(); } | 214 const LayerTreeImpl* activeTree() const { return m_activeTree.get(); } |
| 212 LayerTreeImpl* pendingTree() { return m_pendingTree.get(); } | 215 LayerTreeImpl* pendingTree() { return m_pendingTree.get(); } |
| 213 const LayerTreeImpl* pendingTree() const { return m_pendingTree.get(); } | 216 const LayerTreeImpl* pendingTree() const { return m_pendingTree.get(); } |
| 214 void createPendingTree(); | 217 void createPendingTree(); |
| 215 virtual void activatePendingTreeIfNeeded(); | 218 virtual void activatePendingTreeIfNeeded(); |
| 216 | 219 |
| 217 // Shortcuts to layers on the active tree. | 220 // Shortcuts to layers on the active tree. |
| 218 LayerImpl* rootLayer() const; | 221 LayerImpl* rootLayer() const; |
| 219 LayerImpl* rootScrollLayer() const; | 222 LayerImpl* rootScrollLayer() const; |
| 220 LayerImpl* currentlyScrollingLayer() const; | 223 LayerImpl* currentlyScrollingLayer() const; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 237 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa ctor, float maxPageScaleFactor); | 240 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa ctor, float maxPageScaleFactor); |
| 238 | 241 |
| 239 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); | 242 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); |
| 240 gfx::Transform implTransform() const; | 243 gfx::Transform implTransform() const; |
| 241 | 244 |
| 242 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); |
| 243 | 246 |
| 244 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima tion_controllers().empty(); } | 247 bool needsAnimateLayers() const { return !m_animationRegistrar->active_anima tion_controllers().empty(); } |
| 245 | 248 |
| 246 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties; } | 249 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties; } |
| 247 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } | 250 virtual void setNeedsUpdateDrawProperties() OVERRIDE; // TopControlsManager Client implementation. |
|
jamesr
2013/01/08 02:26:48
put the comment on the previous line and just have
enne (OOO)
2013/01/08 06:23:05
You should also group all these functions, like In
Ted C
2013/01/08 18:17:33
Done.
| |
| 248 | 251 |
| 249 void setNeedsRedraw(); | 252 virtual void setNeedsRedraw() OVERRIDE; // TopControlsManagerClient impleme ntation. |
| 250 | 253 |
| 251 void renderingStats(RenderingStats*) const; | 254 void renderingStats(RenderingStats*) const; |
| 252 | 255 |
| 253 void sendManagedMemoryStats( | 256 void sendManagedMemoryStats( |
| 254 size_t memoryVisibleBytes, | 257 size_t memoryVisibleBytes, |
| 255 size_t memoryVisibleAndNearbyBytes, | 258 size_t memoryVisibleAndNearbyBytes, |
| 256 size_t memoryUseBytes); | 259 size_t memoryUseBytes); |
| 257 | 260 |
| 258 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 261 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
| 259 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get() ; } | 262 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get() ; } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 gfx::Size m_deviceViewportSize; | 364 gfx::Size m_deviceViewportSize; |
| 362 float m_deviceScaleFactor; | 365 float m_deviceScaleFactor; |
| 363 bool m_visible; | 366 bool m_visible; |
| 364 bool m_contentsTexturesPurged; | 367 bool m_contentsTexturesPurged; |
| 365 ManagedMemoryPolicy m_managedMemoryPolicy; | 368 ManagedMemoryPolicy m_managedMemoryPolicy; |
| 366 | 369 |
| 367 bool m_needsUpdateDrawProperties; | 370 bool m_needsUpdateDrawProperties; |
| 368 bool m_pinchGestureActive; | 371 bool m_pinchGestureActive; |
| 369 gfx::Point m_previousPinchAnchor; | 372 gfx::Point m_previousPinchAnchor; |
| 370 | 373 |
| 374 scoped_ptr<TopControlsManager> m_topControlsManager; | |
| 375 | |
| 371 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; | 376 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; |
| 372 | 377 |
| 373 // This is used for ticking animations slowly when hidden. | 378 // This is used for ticking animations slowly when hidden. |
| 374 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; | 379 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; |
| 375 | 380 |
| 376 PinchZoomViewport m_pinchZoomViewport; | 381 PinchZoomViewport m_pinchZoomViewport; |
| 377 | 382 |
| 378 scoped_ptr<FrameRateCounter> m_fpsCounter; | 383 scoped_ptr<FrameRateCounter> m_fpsCounter; |
| 379 scoped_ptr<DebugRectHistory> m_debugRectHistory; | 384 scoped_ptr<DebugRectHistory> m_debugRectHistory; |
| 380 | 385 |
| 381 int64 m_numImplThreadScrolls; | 386 int64 m_numImplThreadScrolls; |
| 382 int64 m_numMainThreadScrolls; | 387 int64 m_numMainThreadScrolls; |
| 383 | 388 |
| 384 int64 m_cumulativeNumLayersDrawn; | 389 int64 m_cumulativeNumLayersDrawn; |
| 385 | 390 |
| 386 int64 m_cumulativeNumMissingTiles; | 391 int64 m_cumulativeNumMissingTiles; |
| 387 | 392 |
| 388 size_t m_lastSentMemoryVisibleBytes; | 393 size_t m_lastSentMemoryVisibleBytes; |
| 389 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 394 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
| 390 size_t m_lastSentMemoryUseBytes; | 395 size_t m_lastSentMemoryUseBytes; |
| 391 | 396 |
| 392 scoped_ptr<AnimationRegistrar> m_animationRegistrar; | 397 scoped_ptr<AnimationRegistrar> m_animationRegistrar; |
| 393 | 398 |
| 394 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 399 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 395 }; | 400 }; |
| 396 | 401 |
| 397 } // namespace cc | 402 } // namespace cc |
| 398 | 403 |
| 399 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 404 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |