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; |
29 class LayerTreeHostImplTimeSourceAdapter; | 30 class LayerTreeHostImplTimeSourceAdapter; |
30 class LayerTreeImpl; | 31 class LayerTreeImpl; |
31 class PageScaleAnimation; | 32 class PageScaleAnimation; |
32 class RenderPassDrawQuad; | 33 class RenderPassDrawQuad; |
33 class ResourceProvider; | 34 class ResourceProvider; |
| 35 class TopControlsManager; |
34 struct RendererCapabilities; | 36 struct RendererCapabilities; |
35 struct RenderingStats; | 37 struct RenderingStats; |
36 | 38 |
37 // LayerTreeHost->Proxy callback interface. | 39 // LayerTreeHost->Proxy callback interface. |
38 class LayerTreeHostImplClient { | 40 class LayerTreeHostImplClient { |
39 public: | 41 public: |
40 virtual void didLoseOutputSurfaceOnImplThread() = 0; | 42 virtual void didLoseOutputSurfaceOnImplThread() = 0; |
41 virtual void onSwapBuffersCompleteOnImplThread() = 0; | 43 virtual void onSwapBuffersCompleteOnImplThread() = 0; |
42 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe
lta interval) = 0; | 44 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe
lta interval) = 0; |
43 virtual void onCanDrawStateChanged(bool canDraw) = 0; | 45 virtual void onCanDrawStateChanged(bool canDraw) = 0; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 float m_deviceScaleFactor; | 108 float m_deviceScaleFactor; |
107 | 109 |
108 gfx::Vector2dF m_zoomedViewportOffset; | 110 gfx::Vector2dF m_zoomedViewportOffset; |
109 gfx::SizeF m_layoutViewportSize; | 111 gfx::SizeF m_layoutViewportSize; |
110 }; | 112 }; |
111 | 113 |
112 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te | 114 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te |
113 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, | 115 class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient, |
114 public RendererClient, | 116 public RendererClient, |
115 public TileManagerClient, | 117 public TileManagerClient, |
116 public OutputSurfaceClient { | 118 public OutputSurfaceClient, |
| 119 public TopControlsDelegate { |
117 typedef std::vector<LayerImpl*> LayerList; | 120 typedef std::vector<LayerImpl*> LayerList; |
118 | 121 |
119 public: | 122 public: |
120 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*, Proxy*); | 123 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*, Proxy*); |
121 virtual ~LayerTreeHostImpl(); | 124 virtual ~LayerTreeHostImpl(); |
122 | 125 |
123 // InputHandlerClient implementation | 126 // InputHandlerClient implementation |
124 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle
rClient::ScrollInputType) OVERRIDE; | 127 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandle
rClient::ScrollInputType) OVERRIDE; |
125 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE; | 128 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE; |
126 virtual void scrollEnd() OVERRIDE; | 129 virtual void scrollEnd() OVERRIDE; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 bool initializeRenderer(scoped_ptr<OutputSurface>); | 201 bool initializeRenderer(scoped_ptr<OutputSurface>); |
199 bool isContextLost(); | 202 bool isContextLost(); |
200 TileManager* tileManager() { return m_tileManager.get(); } | 203 TileManager* tileManager() { return m_tileManager.get(); } |
201 Renderer* renderer() { return m_renderer.get(); } | 204 Renderer* renderer() { return m_renderer.get(); } |
202 const RendererCapabilities& rendererCapabilities() const; | 205 const RendererCapabilities& rendererCapabilities() const; |
203 | 206 |
204 bool swapBuffers(); | 207 bool swapBuffers(); |
205 | 208 |
206 void readback(void* pixels, const gfx::Rect&); | 209 void readback(void* pixels, const gfx::Rect&); |
207 | 210 |
208 LayerTreeImpl* activeTree() { return m_activeTree.get(); } | 211 virtual LayerTreeImpl* activeTree() OVERRIDE; |
209 LayerTreeImpl* pendingTree() { return m_pendingTree.get(); } | 212 LayerTreeImpl* pendingTree() { return m_pendingTree.get(); } |
210 | 213 |
211 // TODO(nduca): Remove these in favor of LayerTreeImpl. | 214 // TODO(nduca): Remove these in favor of LayerTreeImpl. |
212 void setRootLayer(scoped_ptr<LayerImpl>); | 215 void setRootLayer(scoped_ptr<LayerImpl>); |
213 LayerImpl* rootLayer() const; | 216 LayerImpl* rootLayer() const; |
214 | 217 |
215 // Release ownership of the current layer tree and replace it with an empty | 218 // Release ownership of the current layer tree and replace it with an empty |
216 // tree. Returns the root layer of the detached tree. | 219 // tree. Returns the root layer of the detached tree. |
217 scoped_ptr<LayerImpl> detachLayerTree(); | 220 scoped_ptr<LayerImpl> detachLayerTree(); |
218 | 221 |
(...skipping 27 matching lines...) Expand all Loading... |
246 SkColor backgroundColor() const { return m_backgroundColor; } | 249 SkColor backgroundColor() const { return m_backgroundColor; } |
247 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | 250 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } |
248 | 251 |
249 bool hasTransparentBackground() const { return m_hasTransparentBackground; } | 252 bool hasTransparentBackground() const { return m_hasTransparentBackground; } |
250 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | 253 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } |
251 | 254 |
252 bool needsAnimateLayers() const { return m_needsAnimateLayers; } | 255 bool needsAnimateLayers() const { return m_needsAnimateLayers; } |
253 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } | 256 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } |
254 | 257 |
255 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} | 258 bool needsUpdateDrawProperties() const { return m_needsUpdateDrawProperties;
} |
256 void setNeedsUpdateDrawProperties() { m_needsUpdateDrawProperties = true; } | 259 virtual void setNeedsUpdateDrawProperties() OVERRIDE; |
257 | 260 |
258 void setNeedsRedraw(); | 261 virtual void setNeedsRedraw() OVERRIDE; |
259 | 262 |
260 void renderingStats(RenderingStats*) const; | 263 void renderingStats(RenderingStats*) const; |
261 | 264 |
262 void updateRootScrollLayerImplTransform(); | 265 void updateRootScrollLayerImplTransform(); |
263 | 266 |
264 void sendManagedMemoryStats( | 267 void sendManagedMemoryStats( |
265 size_t memoryVisibleBytes, | 268 size_t memoryVisibleBytes, |
266 size_t memoryVisibleAndNearbyBytes, | 269 size_t memoryVisibleAndNearbyBytes, |
267 size_t memoryUseBytes); | 270 size_t memoryUseBytes); |
268 | 271 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 375 |
373 SkColor m_backgroundColor; | 376 SkColor m_backgroundColor; |
374 bool m_hasTransparentBackground; | 377 bool m_hasTransparentBackground; |
375 | 378 |
376 // If this is true, it is necessary to traverse the layer tree ticking the a
nimators. | 379 // If this is true, it is necessary to traverse the layer tree ticking the a
nimators. |
377 bool m_needsAnimateLayers; | 380 bool m_needsAnimateLayers; |
378 bool m_needsUpdateDrawProperties; | 381 bool m_needsUpdateDrawProperties; |
379 bool m_pinchGestureActive; | 382 bool m_pinchGestureActive; |
380 gfx::Point m_previousPinchAnchor; | 383 gfx::Point m_previousPinchAnchor; |
381 | 384 |
| 385 scoped_ptr<TopControlsManager> m_topControlsManager; |
| 386 |
382 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; | 387 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; |
383 | 388 |
384 // This is used for ticking animations slowly when hidden. | 389 // This is used for ticking animations slowly when hidden. |
385 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; | 390 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; |
386 | 391 |
387 // List of visible layers for the most recently prepared frame. Used for | 392 // List of visible layers for the most recently prepared frame. Used for |
388 // rendering and input event hit testing. | 393 // rendering and input event hit testing. |
389 LayerList m_renderSurfaceLayerList; | 394 LayerList m_renderSurfaceLayerList; |
390 | 395 |
391 PinchZoomViewport m_pinchZoomViewport; | 396 PinchZoomViewport m_pinchZoomViewport; |
(...skipping 11 matching lines...) Expand all Loading... |
403 size_t m_lastSentMemoryVisibleBytes; | 408 size_t m_lastSentMemoryVisibleBytes; |
404 size_t m_lastSentMemoryVisibleAndNearbyBytes; | 409 size_t m_lastSentMemoryVisibleAndNearbyBytes; |
405 size_t m_lastSentMemoryUseBytes; | 410 size_t m_lastSentMemoryUseBytes; |
406 | 411 |
407 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 412 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
408 }; | 413 }; |
409 | 414 |
410 } // namespace cc | 415 } // namespace cc |
411 | 416 |
412 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 417 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |