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" |
11 #include "CCAnimationEvents.h" | 11 #include "CCAnimationEvents.h" |
12 #include "CCInputHandler.h" | 12 #include "CCInputHandler.h" |
13 #include "CCLayerSorter.h" | 13 #include "CCLayerSorter.h" |
14 #include "CCRenderer.h" | 14 #include "CCRenderer.h" |
15 #include "CCRenderPass.h" | 15 #include "CCRenderPass.h" |
16 #include "CCRenderPassSink.h" | 16 #include "CCRenderPassSink.h" |
17 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
18 #include <public/WebCompositorOutputSurfaceClient.h> | 18 #include <public/WebCompositorOutputSurfaceClient.h> |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 class CCCompletionEvent; | 22 class CompletionEvent; |
23 class CCDebugRectHistory; | 23 class DebugRectHistory; |
24 class CCFrameRateCounter; | 24 class FrameRateCounter; |
25 class CCHeadsUpDisplayLayerImpl; | 25 class HeadsUpDisplayLayerImpl; |
26 class CCLayerImpl; | 26 class LayerImpl; |
27 class CCLayerTreeHostImplTimeSourceAdapter; | 27 class LayerTreeHostImplTimeSourceAdapter; |
28 class CCPageScaleAnimation; | 28 class PageScaleAnimation; |
29 class CCRenderPassDrawQuad; | 29 class RenderPassDrawQuad; |
30 class CCResourceProvider; | 30 class ResourceProvider; |
31 struct RendererCapabilities; | 31 struct RendererCapabilities; |
32 struct CCRenderingStats; | 32 struct RenderingStats; |
33 | 33 |
34 // CCLayerTreeHost->CCProxy callback interface. | 34 // LayerTreeHost->Proxy callback interface. |
35 class CCLayerTreeHostImplClient { | 35 class LayerTreeHostImplClient { |
36 public: | 36 public: |
37 virtual void didLoseContextOnImplThread() = 0; | 37 virtual void didLoseContextOnImplThread() = 0; |
38 virtual void onSwapBuffersCompleteOnImplThread() = 0; | 38 virtual void onSwapBuffersCompleteOnImplThread() = 0; |
39 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) = 0; | 39 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) = 0; |
40 virtual void onCanDrawStateChanged(bool canDraw) = 0; | 40 virtual void onCanDrawStateChanged(bool canDraw) = 0; |
41 virtual void setNeedsRedrawOnImplThread() = 0; | 41 virtual void setNeedsRedrawOnImplThread() = 0; |
42 virtual void setNeedsCommitOnImplThread() = 0; | 42 virtual void setNeedsCommitOnImplThread() = 0; |
43 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<CCAnimat
ionEventsVector>, double wallClockTime) = 0; | 43 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, double wallClockTime) = 0; |
44 // Returns true if resources were deleted by this call. | 44 // Returns true if resources were deleted by this call. |
45 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes) = 0; | 45 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes) = 0; |
46 }; | 46 }; |
47 | 47 |
48 // CCPinchZoomViewport models the bounds and offset of the viewport that is used
during a pinch-zoom operation. | 48 // PinchZoomViewport models the bounds and offset of the viewport that is used d
uring a pinch-zoom operation. |
49 // It tracks the layout-space dimensions of the viewport before any applied scal
e, and then tracks the layout-space | 49 // It tracks the layout-space dimensions of the viewport before any applied scal
e, and then tracks the layout-space |
50 // coordinates of the viewport respecting the pinch settings. | 50 // coordinates of the viewport respecting the pinch settings. |
51 class CCPinchZoomViewport { | 51 class PinchZoomViewport { |
52 public: | 52 public: |
53 CCPinchZoomViewport(); | 53 PinchZoomViewport(); |
54 | 54 |
55 float totalPageScaleFactor() const; | 55 float totalPageScaleFactor() const; |
56 | 56 |
57 void setPageScaleFactor(float factor) { m_pageScaleFactor = factor; } | 57 void setPageScaleFactor(float factor) { m_pageScaleFactor = factor; } |
58 float pageScaleFactor() const { return m_pageScaleFactor; } | 58 float pageScaleFactor() const { return m_pageScaleFactor; } |
59 | 59 |
60 void setPageScaleDelta(float delta); | 60 void setPageScaleDelta(float delta); |
61 float pageScaleDelta() const { return m_pageScaleDelta; } | 61 float pageScaleDelta() const { return m_pageScaleDelta; } |
62 | 62 |
63 float minPageScaleFactor() const { return m_minPageScaleFactor; } | 63 float minPageScaleFactor() const { return m_minPageScaleFactor; } |
(...skipping 25 matching lines...) Expand all Loading... |
89 float m_pageScaleFactor; | 89 float m_pageScaleFactor; |
90 float m_pageScaleDelta; | 90 float m_pageScaleDelta; |
91 float m_sentPageScaleDelta; | 91 float m_sentPageScaleDelta; |
92 float m_maxPageScaleFactor; | 92 float m_maxPageScaleFactor; |
93 float m_minPageScaleFactor; | 93 float m_minPageScaleFactor; |
94 | 94 |
95 FloatPoint m_pinchViewportScrollDelta; | 95 FloatPoint m_pinchViewportScrollDelta; |
96 FloatSize m_layoutViewportSize; | 96 FloatSize m_layoutViewportSize; |
97 }; | 97 }; |
98 | 98 |
99 // CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering
state | 99 // LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering sta
te |
100 class CCLayerTreeHostImpl : public CCInputHandlerClient, | 100 class LayerTreeHostImpl : public InputHandlerClient, |
101 public CCRendererClient, | 101 public RendererClient, |
102 public WebKit::WebCompositorOutputSurfaceClient { | 102 public WebKit::WebCompositorOutputSurfaceClient { |
103 typedef std::vector<CCLayerImpl*> CCLayerList; | 103 typedef std::vector<LayerImpl*> LayerList; |
104 | 104 |
105 public: | 105 public: |
106 static scoped_ptr<CCLayerTreeHostImpl> create(const CCLayerTreeSettings&, CC
LayerTreeHostImplClient*); | 106 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerT
reeHostImplClient*); |
107 virtual ~CCLayerTreeHostImpl(); | 107 virtual ~LayerTreeHostImpl(); |
108 | 108 |
109 // CCInputHandlerClient implementation | 109 // InputHandlerClient implementation |
110 virtual CCInputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, CCIn
putHandlerClient::ScrollInputType) OVERRIDE; | 110 virtual InputHandlerClient::ScrollStatus scrollBegin(const IntPoint&, InputH
andlerClient::ScrollInputType) OVERRIDE; |
111 virtual void scrollBy(const IntPoint&, const IntSize&) OVERRIDE; | 111 virtual void scrollBy(const IntPoint&, const IntSize&) OVERRIDE; |
112 virtual void scrollEnd() OVERRIDE; | 112 virtual void scrollEnd() OVERRIDE; |
113 virtual void pinchGestureBegin() OVERRIDE; | 113 virtual void pinchGestureBegin() OVERRIDE; |
114 virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE; | 114 virtual void pinchGestureUpdate(float, const IntPoint&) OVERRIDE; |
115 virtual void pinchGestureEnd() OVERRIDE; | 115 virtual void pinchGestureEnd() OVERRIDE; |
116 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anc
horPoint, float pageScale, double startTime, double duration) OVERRIDE; | 116 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool anc
horPoint, float pageScale, double startTime, double duration) OVERRIDE; |
117 virtual void scheduleAnimation() OVERRIDE; | 117 virtual void scheduleAnimation() OVERRIDE; |
118 | 118 |
119 struct FrameData : public CCRenderPassSink { | 119 struct FrameData : public RenderPassSink { |
120 FrameData(); | 120 FrameData(); |
121 ~FrameData(); | 121 ~FrameData(); |
122 | 122 |
123 Vector<IntRect> occludingScreenSpaceRects; | 123 Vector<IntRect> occludingScreenSpaceRects; |
124 CCRenderPassList renderPasses; | 124 RenderPassList renderPasses; |
125 CCRenderPassIdHashMap renderPassesById; | 125 RenderPassIdHashMap renderPassesById; |
126 CCLayerList* renderSurfaceLayerList; | 126 LayerList* renderSurfaceLayerList; |
127 CCLayerList willDrawLayers; | 127 LayerList willDrawLayers; |
128 | 128 |
129 // CCRenderPassSink implementation. | 129 // RenderPassSink implementation. |
130 virtual void appendRenderPass(scoped_ptr<CCRenderPass>) OVERRIDE; | 130 virtual void appendRenderPass(scoped_ptr<RenderPass>) OVERRIDE; |
131 }; | 131 }; |
132 | 132 |
133 // Virtual for testing. | 133 // Virtual for testing. |
134 virtual void beginCommit(); | 134 virtual void beginCommit(); |
135 virtual void commitComplete(); | 135 virtual void commitComplete(); |
136 virtual void animate(double monotonicTime, double wallClockTime); | 136 virtual void animate(double monotonicTime, double wallClockTime); |
137 | 137 |
138 // Returns false if problems occured preparing the frame, and we should try | 138 // Returns false if problems occured preparing the frame, and we should try |
139 // to avoid displaying the frame. If prepareToDraw is called, | 139 // to avoid displaying the frame. If prepareToDraw is called, |
140 // didDrawAllLayers must also be called, regardless of whether drawLayers is | 140 // didDrawAllLayers must also be called, regardless of whether drawLayers is |
141 // called between the two. | 141 // called between the two. |
142 virtual bool prepareToDraw(FrameData&); | 142 virtual bool prepareToDraw(FrameData&); |
143 virtual void drawLayers(const FrameData&); | 143 virtual void drawLayers(const FrameData&); |
144 // Must be called if and only if prepareToDraw was called. | 144 // Must be called if and only if prepareToDraw was called. |
145 void didDrawAllLayers(const FrameData&); | 145 void didDrawAllLayers(const FrameData&); |
146 | 146 |
147 // CCRendererClient implementation | 147 // RendererClient implementation |
148 virtual const IntSize& deviceViewportSize() const OVERRIDE; | 148 virtual const IntSize& deviceViewportSize() const OVERRIDE; |
149 virtual const CCLayerTreeSettings& settings() const OVERRIDE; | 149 virtual const LayerTreeSettings& settings() const OVERRIDE; |
150 virtual void didLoseContext() OVERRIDE; | 150 virtual void didLoseContext() OVERRIDE; |
151 virtual void onSwapBuffersComplete() OVERRIDE; | 151 virtual void onSwapBuffersComplete() OVERRIDE; |
152 virtual void setFullRootLayerDamage() OVERRIDE; | 152 virtual void setFullRootLayerDamage() OVERRIDE; |
153 virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE; | 153 virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE; |
154 | 154 |
155 // WebCompositorOutputSurfaceClient implementation. | 155 // WebCompositorOutputSurfaceClient implementation. |
156 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) OVERRIDE; | 156 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) OVERRIDE; |
157 | 157 |
158 // Implementation | 158 // Implementation |
159 bool canDraw(); | 159 bool canDraw(); |
160 CCGraphicsContext* context() const; | 160 GraphicsContext* context() const; |
161 | 161 |
162 std::string layerTreeAsText() const; | 162 std::string layerTreeAsText() const; |
163 | 163 |
164 void finishAllRendering(); | 164 void finishAllRendering(); |
165 int sourceAnimationFrameNumber() const; | 165 int sourceAnimationFrameNumber() const; |
166 | 166 |
167 bool initializeRenderer(scoped_ptr<CCGraphicsContext>); | 167 bool initializeRenderer(scoped_ptr<GraphicsContext>); |
168 bool isContextLost(); | 168 bool isContextLost(); |
169 CCRenderer* renderer() { return m_renderer.get(); } | 169 Renderer* renderer() { return m_renderer.get(); } |
170 const RendererCapabilities& rendererCapabilities() const; | 170 const RendererCapabilities& rendererCapabilities() const; |
171 | 171 |
172 bool swapBuffers(); | 172 bool swapBuffers(); |
173 | 173 |
174 void readback(void* pixels, const IntRect&); | 174 void readback(void* pixels, const IntRect&); |
175 | 175 |
176 void setRootLayer(scoped_ptr<CCLayerImpl>); | 176 void setRootLayer(scoped_ptr<LayerImpl>); |
177 CCLayerImpl* rootLayer() { return m_rootLayerImpl.get(); } | 177 LayerImpl* rootLayer() { return m_rootLayerImpl.get(); } |
178 | 178 |
179 void setHudLayer(CCHeadsUpDisplayLayerImpl* layerImpl) { m_hudLayerImpl = la
yerImpl; } | 179 void setHudLayer(HeadsUpDisplayLayerImpl* layerImpl) { m_hudLayerImpl = laye
rImpl; } |
180 CCHeadsUpDisplayLayerImpl* hudLayer() { return m_hudLayerImpl; } | 180 HeadsUpDisplayLayerImpl* hudLayer() { return m_hudLayerImpl; } |
181 | 181 |
182 // Release ownership of the current layer tree and replace it with an empty | 182 // Release ownership of the current layer tree and replace it with an empty |
183 // tree. Returns the root layer of the detached tree. | 183 // tree. Returns the root layer of the detached tree. |
184 scoped_ptr<CCLayerImpl> detachLayerTree(); | 184 scoped_ptr<LayerImpl> detachLayerTree(); |
185 | 185 |
186 CCLayerImpl* rootScrollLayer() const { return m_rootScrollLayerImpl; } | 186 LayerImpl* rootScrollLayer() const { return m_rootScrollLayerImpl; } |
187 | 187 |
188 bool visible() const { return m_visible; } | 188 bool visible() const { return m_visible; } |
189 void setVisible(bool); | 189 void setVisible(bool); |
190 | 190 |
191 int sourceFrameNumber() const { return m_sourceFrameNumber; } | 191 int sourceFrameNumber() const { return m_sourceFrameNumber; } |
192 void setSourceFrameNumber(int frameNumber) { m_sourceFrameNumber = frameNumb
er; } | 192 void setSourceFrameNumber(int frameNumber) { m_sourceFrameNumber = frameNumb
er; } |
193 | 193 |
194 bool contentsTexturesPurged() const { return m_contentsTexturesPurged; } | 194 bool contentsTexturesPurged() const { return m_contentsTexturesPurged; } |
195 void setContentsTexturesPurged(); | 195 void setContentsTexturesPurged(); |
196 void resetContentsTexturesPurged(); | 196 void resetContentsTexturesPurged(); |
197 size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBy
tes; } | 197 size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBy
tes; } |
198 void reduceContentsTextureMemoryOnImplThread(size_t limitBytes); | 198 void reduceContentsTextureMemoryOnImplThread(size_t limitBytes); |
199 | 199 |
200 void setViewportSize(const IntSize& layoutViewportSize, const IntSize& devic
eViewportSize); | 200 void setViewportSize(const IntSize& layoutViewportSize, const IntSize& devic
eViewportSize); |
201 const IntSize& layoutViewportSize() const { return m_layoutViewportSize; } | 201 const IntSize& layoutViewportSize() const { return m_layoutViewportSize; } |
202 | 202 |
203 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 203 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
204 void setDeviceScaleFactor(float); | 204 void setDeviceScaleFactor(float); |
205 | 205 |
206 float pageScaleFactor() const; | 206 float pageScaleFactor() const; |
207 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); | 207 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); |
208 | 208 |
209 scoped_ptr<CCScrollAndScaleSet> processScrollDeltas(); | 209 scoped_ptr<ScrollAndScaleSet> processScrollDeltas(); |
210 WebKit::WebTransformationMatrix implTransform() const; | 210 WebKit::WebTransformationMatrix implTransform() const; |
211 | 211 |
212 void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor,
float scale, double durationSec); | 212 void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor,
float scale, double durationSec); |
213 | 213 |
214 SkColor backgroundColor() const { return m_backgroundColor; } | 214 SkColor backgroundColor() const { return m_backgroundColor; } |
215 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | 215 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } |
216 | 216 |
217 bool hasTransparentBackground() const { return m_hasTransparentBackground; } | 217 bool hasTransparentBackground() const { return m_hasTransparentBackground; } |
218 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | 218 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } |
219 | 219 |
220 bool needsAnimateLayers() const { return m_needsAnimateLayers; } | 220 bool needsAnimateLayers() const { return m_needsAnimateLayers; } |
221 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } | 221 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; } |
222 | 222 |
223 void setNeedsRedraw(); | 223 void setNeedsRedraw(); |
224 | 224 |
225 void renderingStats(CCRenderingStats*) const; | 225 void renderingStats(RenderingStats*) const; |
226 | 226 |
227 void updateRootScrollLayerImplTransform(); | 227 void updateRootScrollLayerImplTransform(); |
228 | 228 |
229 CCFrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } | 229 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); } |
230 CCDebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get
(); } | 230 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get()
; } |
231 CCResourceProvider* resourceProvider() const { return m_resourceProvider.get
(); } | 231 ResourceProvider* resourceProvider() const { return m_resourceProvider.get()
; } |
232 | 232 |
233 class CullRenderPassesWithCachedTextures { | 233 class CullRenderPassesWithCachedTextures { |
234 public: | 234 public: |
235 bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData
&) const; | 235 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; |
236 | 236 |
237 // Iterates from the root first, in order to remove the surfaces closest | 237 // Iterates from the root first, in order to remove the surfaces closest |
238 // to the root with cached textures, and all surfaces that draw into | 238 // to the root with cached textures, and all surfaces that draw into |
239 // them. | 239 // them. |
240 size_t renderPassListBegin(const CCRenderPassList& list) const { return
list.size() - 1; } | 240 size_t renderPassListBegin(const RenderPassList& list) const { return li
st.size() - 1; } |
241 size_t renderPassListEnd(const CCRenderPassList&) const { return 0 - 1;
} | 241 size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; } |
242 size_t renderPassListNext(size_t it) const { return it - 1; } | 242 size_t renderPassListNext(size_t it) const { return it - 1; } |
243 | 243 |
244 CullRenderPassesWithCachedTextures(CCRenderer& renderer) : m_renderer(re
nderer) { } | 244 CullRenderPassesWithCachedTextures(Renderer& renderer) : m_renderer(rend
erer) { } |
245 private: | 245 private: |
246 CCRenderer& m_renderer; | 246 Renderer& m_renderer; |
247 }; | 247 }; |
248 | 248 |
249 class CullRenderPassesWithNoQuads { | 249 class CullRenderPassesWithNoQuads { |
250 public: | 250 public: |
251 bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData
&) const; | 251 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&)
const; |
252 | 252 |
253 // Iterates in draw order, so that when a surface is removed, and its | 253 // Iterates in draw order, so that when a surface is removed, and its |
254 // target becomes empty, then its target can be removed also. | 254 // target becomes empty, then its target can be removed also. |
255 size_t renderPassListBegin(const CCRenderPassList&) const { return 0; } | 255 size_t renderPassListBegin(const RenderPassList&) const { return 0; } |
256 size_t renderPassListEnd(const CCRenderPassList& list) const { return li
st.size(); } | 256 size_t renderPassListEnd(const RenderPassList& list) const { return list
.size(); } |
257 size_t renderPassListNext(size_t it) const { return it + 1; } | 257 size_t renderPassListNext(size_t it) const { return it + 1; } |
258 }; | 258 }; |
259 | 259 |
260 template<typename RenderPassCuller> | 260 template<typename RenderPassCuller> |
261 static void removeRenderPasses(RenderPassCuller, FrameData&); | 261 static void removeRenderPasses(RenderPassCuller, FrameData&); |
262 | 262 |
263 protected: | 263 protected: |
264 CCLayerTreeHostImpl(const CCLayerTreeSettings&, CCLayerTreeHostImplClient*); | 264 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*); |
265 | 265 |
266 void animatePageScale(double monotonicTime); | 266 void animatePageScale(double monotonicTime); |
267 void animateScrollbars(double monotonicTime); | 267 void animateScrollbars(double monotonicTime); |
268 | 268 |
269 // Exposed for testing. | 269 // Exposed for testing. |
270 void calculateRenderSurfaceLayerList(CCLayerList&); | 270 void calculateRenderSurfaceLayerList(LayerList&); |
271 | 271 |
272 // Virtual for testing. | 272 // Virtual for testing. |
273 virtual void animateLayers(double monotonicTime, double wallClockTime); | 273 virtual void animateLayers(double monotonicTime, double wallClockTime); |
274 | 274 |
275 // Virtual for testing. | 275 // Virtual for testing. |
276 virtual base::TimeDelta lowFrequencyAnimationInterval() const; | 276 virtual base::TimeDelta lowFrequencyAnimationInterval() const; |
277 | 277 |
278 CCLayerTreeHostImplClient* m_client; | 278 LayerTreeHostImplClient* m_client; |
279 int m_sourceFrameNumber; | 279 int m_sourceFrameNumber; |
280 | 280 |
281 private: | 281 private: |
282 void computeDoubleTapZoomDeltas(CCScrollAndScaleSet* scrollInfo); | 282 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo); |
283 void computePinchZoomDeltas(CCScrollAndScaleSet* scrollInfo); | 283 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo); |
284 void makeScrollAndScaleSet(CCScrollAndScaleSet* scrollInfo, const IntSize& s
crollOffset, float pageScale); | 284 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, const IntSize& scr
ollOffset, float pageScale); |
285 | 285 |
286 void setPageScaleDelta(float); | 286 void setPageScaleDelta(float); |
287 void updateMaxScrollPosition(); | 287 void updateMaxScrollPosition(); |
288 void trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, const CCLayerList
& renderSurfaceLayerList); | 288 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); |
289 | 289 |
290 // Returns false if the frame should not be displayed. This function should | 290 // Returns false if the frame should not be displayed. This function should |
291 // only be called from prepareToDraw, as didDrawAllLayers must be called | 291 // only be called from prepareToDraw, as didDrawAllLayers must be called |
292 // if this helper function is called. | 292 // if this helper function is called. |
293 bool calculateRenderPasses(FrameData&); | 293 bool calculateRenderPasses(FrameData&); |
294 void animateLayersRecursive(CCLayerImpl*, double monotonicTime, double wallC
lockTime, CCAnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers); | 294 void animateLayersRecursive(LayerImpl*, double monotonicTime, double wallClo
ckTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers); |
295 void setBackgroundTickingEnabled(bool); | 295 void setBackgroundTickingEnabled(bool); |
296 IntSize contentSize() const; | 296 IntSize contentSize() const; |
297 | 297 |
298 void sendDidLoseContextRecursive(CCLayerImpl*); | 298 void sendDidLoseContextRecursive(LayerImpl*); |
299 void clearRenderSurfaces(); | 299 void clearRenderSurfaces(); |
300 bool ensureRenderSurfaceLayerList(); | 300 bool ensureRenderSurfaceLayerList(); |
301 void clearCurrentlyScrollingLayer(); | 301 void clearCurrentlyScrollingLayer(); |
302 | 302 |
303 void animateScrollbarsRecursive(CCLayerImpl*, double monotonicTime); | 303 void animateScrollbarsRecursive(LayerImpl*, double monotonicTime); |
304 | 304 |
305 void dumpRenderSurfaces(std::string*, int indent, const CCLayerImpl*) const; | 305 void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const; |
306 | 306 |
307 scoped_ptr<CCGraphicsContext> m_context; | 307 scoped_ptr<GraphicsContext> m_context; |
308 scoped_ptr<CCResourceProvider> m_resourceProvider; | 308 scoped_ptr<ResourceProvider> m_resourceProvider; |
309 scoped_ptr<CCRenderer> m_renderer; | 309 scoped_ptr<Renderer> m_renderer; |
310 scoped_ptr<CCLayerImpl> m_rootLayerImpl; | 310 scoped_ptr<LayerImpl> m_rootLayerImpl; |
311 CCLayerImpl* m_rootScrollLayerImpl; | 311 LayerImpl* m_rootScrollLayerImpl; |
312 CCLayerImpl* m_currentlyScrollingLayerImpl; | 312 LayerImpl* m_currentlyScrollingLayerImpl; |
313 CCHeadsUpDisplayLayerImpl* m_hudLayerImpl; | 313 HeadsUpDisplayLayerImpl* m_hudLayerImpl; |
314 int m_scrollingLayerIdFromPreviousTree; | 314 int m_scrollingLayerIdFromPreviousTree; |
315 bool m_scrollDeltaIsInScreenSpace; | 315 bool m_scrollDeltaIsInScreenSpace; |
316 CCLayerTreeSettings m_settings; | 316 LayerTreeSettings m_settings; |
317 IntSize m_layoutViewportSize; | 317 IntSize m_layoutViewportSize; |
318 IntSize m_deviceViewportSize; | 318 IntSize m_deviceViewportSize; |
319 float m_deviceScaleFactor; | 319 float m_deviceScaleFactor; |
320 bool m_visible; | 320 bool m_visible; |
321 bool m_contentsTexturesPurged; | 321 bool m_contentsTexturesPurged; |
322 size_t m_memoryAllocationLimitBytes; | 322 size_t m_memoryAllocationLimitBytes; |
323 | 323 |
324 SkColor m_backgroundColor; | 324 SkColor m_backgroundColor; |
325 bool m_hasTransparentBackground; | 325 bool m_hasTransparentBackground; |
326 | 326 |
327 // If this is true, it is necessary to traverse the layer tree ticking the a
nimators. | 327 // If this is true, it is necessary to traverse the layer tree ticking the a
nimators. |
328 bool m_needsAnimateLayers; | 328 bool m_needsAnimateLayers; |
329 bool m_pinchGestureActive; | 329 bool m_pinchGestureActive; |
330 IntPoint m_previousPinchAnchor; | 330 IntPoint m_previousPinchAnchor; |
331 | 331 |
332 scoped_ptr<CCPageScaleAnimation> m_pageScaleAnimation; | 332 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation; |
333 | 333 |
334 // This is used for ticking animations slowly when hidden. | 334 // This is used for ticking animations slowly when hidden. |
335 scoped_ptr<CCLayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; | 335 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter; |
336 | 336 |
337 CCLayerSorter m_layerSorter; | 337 LayerSorter m_layerSorter; |
338 | 338 |
339 // List of visible layers for the most recently prepared frame. Used for | 339 // List of visible layers for the most recently prepared frame. Used for |
340 // rendering and input event hit testing. | 340 // rendering and input event hit testing. |
341 CCLayerList m_renderSurfaceLayerList; | 341 LayerList m_renderSurfaceLayerList; |
342 | 342 |
343 CCPinchZoomViewport m_pinchZoomViewport; | 343 PinchZoomViewport m_pinchZoomViewport; |
344 | 344 |
345 scoped_ptr<CCFrameRateCounter> m_fpsCounter; | 345 scoped_ptr<FrameRateCounter> m_fpsCounter; |
346 scoped_ptr<CCDebugRectHistory> m_debugRectHistory; | 346 scoped_ptr<DebugRectHistory> m_debugRectHistory; |
347 | 347 |
348 size_t m_numImplThreadScrolls; | 348 size_t m_numImplThreadScrolls; |
349 size_t m_numMainThreadScrolls; | 349 size_t m_numMainThreadScrolls; |
350 | 350 |
351 DISALLOW_COPY_AND_ASSIGN(CCLayerTreeHostImpl); | 351 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
352 }; | 352 }; |
353 | 353 |
354 } // namespace cc | 354 } // namespace cc |
355 | 355 |
356 #endif | 356 #endif |
OLD | NEW |