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