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 CCLayerTreeHostImpl_h | 5 #ifndef CCLayerTreeHostImpl_h |
6 #define CCLayerTreeHostImpl_h | 6 #define CCLayerTreeHostImpl_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" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 FloatSize m_layoutViewportSize; | 97 FloatSize m_layoutViewportSize; |
98 }; | 98 }; |
99 | 99 |
100 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te | 100 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te |
101 class LayerTreeHostImpl : public InputHandlerClient, | 101 class LayerTreeHostImpl : public InputHandlerClient, |
102 public RendererClient, | 102 public RendererClient, |
103 public WebKit::WebCompositorOutputSurfaceClient { | 103 public WebKit::WebCompositorOutputSurfaceClient { |
104 typedef std::vector<LayerImpl*> LayerList; | 104 typedef std::vector<LayerImpl*> LayerList; |
105 | 105 |
106 public: | 106 public: |
107 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*); | 107 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*, Proxy*); |
108 virtual ~LayerTreeHostImpl(); | 108 virtual ~LayerTreeHostImpl(); |
109 | 109 |
110 // InputHandlerClient implementation | 110 // InputHandlerClient implementation |
111 virtual InputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, InputH
andlerClient::ScrollInputType) OVERRIDE; | 111 virtual InputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, InputH
andlerClient::ScrollInputType) OVERRIDE; |
112 virtual void scrollBy(const IntPoint&, const IntSize&) OVERRIDE; | 112 virtual void scrollBy(const IntPoint&, const IntSize&) OVERRIDE; |
113 virtual void scrollEnd() OVERRIDE; | 113 virtual void scrollEnd() OVERRIDE; |
114 virtual void pinchGestureBegin() OVERRIDE; | 114 virtual void pinchGestureBegin() OVERRIDE; |
115 virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE; | 115 virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE; |
116 virtual void pinchGestureEnd() OVERRIDE; | 116 virtual void pinchGestureEnd() OVERRIDE; |
117 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anc
horPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration)
OVERRIDE; | 117 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anc
horPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration)
OVERRIDE; |
(...skipping 28 matching lines...) Expand all Loading... |
146 void didDrawAllLayers(const FrameData&); | 146 void didDrawAllLayers(const FrameData&); |
147 | 147 |
148 // RendererClient implementation | 148 // RendererClient implementation |
149 virtual const IntSize& deviceViewportSize() const OVERRIDE; | 149 virtual const IntSize& deviceViewportSize() const OVERRIDE; |
150 virtual const LayerTreeSettings& settings() const OVERRIDE; | 150 virtual const LayerTreeSettings& settings() const OVERRIDE; |
151 virtual void didLoseContext() OVERRIDE; | 151 virtual void didLoseContext() OVERRIDE; |
152 virtual void onSwapBuffersComplete() OVERRIDE; | 152 virtual void onSwapBuffersComplete() OVERRIDE; |
153 virtual void setFullRootLayerDamage() OVERRIDE; | 153 virtual void setFullRootLayerDamage() OVERRIDE; |
154 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE; | 154 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE; |
155 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE; | 155 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE; |
| 156 virtual bool hasImplThread() const OVERRIDE; |
156 | 157 |
157 // WebCompositorOutputSurfaceClient implementation. | 158 // WebCompositorOutputSurfaceClient implementation. |
158 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) OVERRIDE; | 159 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) OVERRIDE; |
159 | 160 |
160 // Implementation | 161 // Implementation |
161 bool canDraw(); | 162 bool canDraw(); |
162 GraphicsContext* context() const; | 163 GraphicsContext* context() const; |
163 | 164 |
164 std::string layerTreeAsText() const; | 165 std::string layerTreeAsText() const; |
165 | 166 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 224 |
224 void setNeedsRedraw(); | 225 void setNeedsRedraw(); |
225 | 226 |
226 void renderingStats(RenderingStats*) const; | 227 void renderingStats(RenderingStats*) const; |
227 | 228 |
228 void updateRootScrollLayerImplTransform(); | 229 void updateRootScrollLayerImplTransform(); |
229 | 230 |
230 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 231 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
231 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } | 232 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } |
232 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } | 233 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } |
| 234 Proxy* proxy() const { return m_proxy; } |
233 | 235 |
234 class CullRenderPassesWithCachedTextures { | 236 class CullRenderPassesWithCachedTextures { |
235 public: | 237 public: |
236 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; | 238 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; |
237 | 239 |
238 // Iterates from the root first, in order to remove the surfaces closest | 240 // Iterates from the root first, in order to remove the surfaces closest |
239 // to the root with cached textures, and all surfaces that draw into | 241 // to the root with cached textures, and all surfaces that draw into |
240 // them. | 242 // them. |
241 size_t renderPassListBegin(const RenderPassList& list) const { return li
st.size() - 1; } | 243 size_t renderPassListBegin(const RenderPassList& list) const { return li
st.size() - 1; } |
242 size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; } | 244 size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; } |
(...skipping 12 matching lines...) Expand all Loading... |
255 // target becomes empty, then its target can be removed also. | 257 // target becomes empty, then its target can be removed also. |
256 size_t renderPassListBegin(const RenderPassList&) const { return 0; } | 258 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
257 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } | 259 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } |
258 size_t renderPassListNext(size_t it) const { return it + 1; } | 260 size_t renderPassListNext(size_t it) const { return it + 1; } |
259 }; | 261 }; |
260 | 262 |
261 template<typename RenderPassCuller> | 263 template<typename RenderPassCuller> |
262 static void removeRenderPasses(RenderPassCuller, FrameData&); | 264 static void removeRenderPasses(RenderPassCuller, FrameData&); |
263 | 265 |
264 protected: | 266 protected: |
265 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*); | 267 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*
); |
266 | 268 |
267 void animatePageScale(base::TimeTicks monotonicTime); | 269 void animatePageScale(base::TimeTicks monotonicTime); |
268 void animateScrollbars(base::TimeTicks monotonicTime); | 270 void animateScrollbars(base::TimeTicks monotonicTime); |
269 | 271 |
270 // Exposed for testing. | 272 // Exposed for testing. |
271 void calculateRenderSurfaceLayerList(LayerList&); | 273 void calculateRenderSurfaceLayerList(LayerList&); |
272 | 274 |
273 // Virtual for testing. | 275 // Virtual for testing. |
274 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); | 276 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClo
ckTime); |
275 | 277 |
276 // Virtual for testing. | 278 // Virtual for testing. |
277 virtual base::TimeDelta lowFrequencyAnimationInterval() const; | 279 virtual base::TimeDelta lowFrequencyAnimationInterval() const; |
278 | 280 |
279 LayerTreeHostImplClient* m_client; | 281 LayerTreeHostImplClient* m_client; |
| 282 Proxy* m_proxy; |
280 int m_sourceFrameNumber; | 283 int m_sourceFrameNumber; |
281 | 284 |
282 private: | 285 private: |
283 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); | 286 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); |
284 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); | 287 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); |
285 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, const IntSize& scr
ollOffset, float pageScale); | 288 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, const IntSize& scr
ollOffset, float pageScale); |
286 | 289 |
287 void setPageScaleDelta(float); | 290 void setPageScaleDelta(float); |
288 void updateMaxScrollPosition(); | 291 void updateMaxScrollPosition(); |
289 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); | 292 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 351 |
349 size_t m_numImplThreadScrolls; | 352 size_t m_numImplThreadScrolls; |
350 size_t m_numMainThreadScrolls; | 353 size_t m_numMainThreadScrolls; |
351 | 354 |
352 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 355 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
353 }; | 356 }; |
354 | 357 |
355 } // namespace cc | 358 } // namespace cc |
356 | 359 |
357 #endif | 360 #endif |
OLD | NEW |