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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 class LayerTreeHostImplTimeSourceAdapter; | 30 class LayerTreeHostImplTimeSourceAdapter; |
31 class PageScaleAnimation; | 31 class PageScaleAnimation; |
32 class RenderPassDrawQuad; | 32 class RenderPassDrawQuad; |
33 class ResourceProvider; | 33 class ResourceProvider; |
34 struct RendererCapabilities; | 34 struct RendererCapabilities; |
35 struct RenderingStats; | 35 struct RenderingStats; |
36 | 36 |
37 // LayerTreeHost->Proxy callback interface. | 37 // LayerTreeHost->Proxy callback interface. |
38 class LayerTreeHostImplClient { | 38 class LayerTreeHostImplClient { |
39 public: | 39 public: |
40 virtual void didLoseOutputSurfaceOnImplThread() = 0; | 40 virtual void didLoseContextOnImplThread() = 0; |
41 virtual void onSwapBuffersCompleteOnImplThread() = 0; | 41 virtual void onSwapBuffersCompleteOnImplThread() = 0; |
42 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe
lta interval) = 0; | 42 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe
lta interval) = 0; |
43 virtual void onCanDrawStateChanged(bool canDraw) = 0; | 43 virtual void onCanDrawStateChanged(bool canDraw) = 0; |
44 virtual void setNeedsRedrawOnImplThread() = 0; | 44 virtual void setNeedsRedrawOnImplThread() = 0; |
45 virtual void setNeedsCommitOnImplThread() = 0; | 45 virtual void setNeedsCommitOnImplThread() = 0; |
46 virtual void setNeedsManageTilesOnImplThread() = 0; | 46 virtual void setNeedsManageTilesOnImplThread() = 0; |
47 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) = 0; | 47 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) = 0; |
48 // Returns true if resources were deleted by this call. | 48 // Returns true if resources were deleted by this call. |
49 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) = 0; | 49 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) = 0; |
50 virtual void sendManagedMemoryStats() = 0; | 50 virtual void sendManagedMemoryStats() = 0; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // didDrawAllLayers must also be called, regardless of whether drawLayers is | 158 // didDrawAllLayers must also be called, regardless of whether drawLayers is |
159 // called between the two. | 159 // called between the two. |
160 virtual bool prepareToDraw(FrameData&); | 160 virtual bool prepareToDraw(FrameData&); |
161 virtual void drawLayers(FrameData&); | 161 virtual void drawLayers(FrameData&); |
162 // Must be called if and only if prepareToDraw was called. | 162 // Must be called if and only if prepareToDraw was called. |
163 void didDrawAllLayers(const FrameData&); | 163 void didDrawAllLayers(const FrameData&); |
164 | 164 |
165 // RendererClient implementation | 165 // RendererClient implementation |
166 virtual const gfx::Size& deviceViewportSize() const OVERRIDE; | 166 virtual const gfx::Size& deviceViewportSize() const OVERRIDE; |
167 virtual const LayerTreeSettings& settings() const OVERRIDE; | 167 virtual const LayerTreeSettings& settings() const OVERRIDE; |
168 virtual void didLoseOutputSurface() OVERRIDE; | 168 virtual void didLoseContext() OVERRIDE; |
169 virtual void onSwapBuffersComplete() OVERRIDE; | 169 virtual void onSwapBuffersComplete() OVERRIDE; |
170 virtual void setFullRootLayerDamage() OVERRIDE; | 170 virtual void setFullRootLayerDamage() OVERRIDE; |
171 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE; | 171 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERR
IDE; |
172 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE; | 172 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) O
VERRIDE; |
173 virtual bool hasImplThread() const OVERRIDE; | 173 virtual bool hasImplThread() const OVERRIDE; |
174 | 174 |
175 // TileManagerClient implementation. | 175 // TileManagerClient implementation. |
176 virtual void ScheduleManageTiles() OVERRIDE; | 176 virtual void ScheduleManageTiles() OVERRIDE; |
177 virtual void ScheduleRedraw() OVERRIDE; | 177 virtual void ScheduleRedraw() OVERRIDE; |
178 | 178 |
179 // WebCompositorOutputSurfaceClient implementation. | 179 // WebCompositorOutputSurfaceClient implementation. |
180 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) OVERRIDE; | 180 virtual void onVSyncParametersChanged(double monotonicTimebase, double inter
valInSeconds) OVERRIDE; |
181 | 181 |
182 // Implementation | 182 // Implementation |
183 bool canDraw(); | 183 bool canDraw(); |
184 OutputSurface* outputSurface() const; | 184 GraphicsContext* context() const; |
185 | 185 |
186 std::string layerTreeAsText() const; | 186 std::string layerTreeAsText() const; |
187 | 187 |
188 void finishAllRendering(); | 188 void finishAllRendering(); |
189 int sourceAnimationFrameNumber() const; | 189 int sourceAnimationFrameNumber() const; |
190 | 190 |
191 bool initializeRenderer(scoped_ptr<OutputSurface>); | 191 bool initializeRenderer(scoped_ptr<GraphicsContext>); |
192 bool isContextLost(); | 192 bool isContextLost(); |
193 TileManager* tileManager() { return m_tileManager.get(); } | 193 TileManager* tileManager() { return m_tileManager.get(); } |
194 Renderer* renderer() { return m_renderer.get(); } | 194 Renderer* renderer() { return m_renderer.get(); } |
195 const RendererCapabilities& rendererCapabilities() const; | 195 const RendererCapabilities& rendererCapabilities() const; |
196 | 196 |
197 bool swapBuffers(); | 197 bool swapBuffers(); |
198 | 198 |
199 void readback(void* pixels, const gfx::Rect&); | 199 void readback(void* pixels, const gfx::Rect&); |
200 | 200 |
201 void setRootLayer(scoped_ptr<LayerImpl>); | 201 void setRootLayer(scoped_ptr<LayerImpl>); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); | 317 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& re
nderSurfaceLayerList); |
318 | 318 |
319 // Returns false if the frame should not be displayed. This function should | 319 // Returns false if the frame should not be displayed. This function should |
320 // only be called from prepareToDraw, as didDrawAllLayers must be called | 320 // only be called from prepareToDraw, as didDrawAllLayers must be called |
321 // if this helper function is called. | 321 // if this helper function is called. |
322 bool calculateRenderPasses(FrameData&); | 322 bool calculateRenderPasses(FrameData&); |
323 void animateLayersRecursive(LayerImpl*, base::TimeTicks monotonicTime, base:
:Time wallClockTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimat
eLayers); | 323 void animateLayersRecursive(LayerImpl*, base::TimeTicks monotonicTime, base:
:Time wallClockTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimat
eLayers); |
324 void setBackgroundTickingEnabled(bool); | 324 void setBackgroundTickingEnabled(bool); |
325 gfx::Size contentSize() const; | 325 gfx::Size contentSize() const; |
326 | 326 |
327 void sendDidLoseOutputSurfaceRecursive(LayerImpl*); | 327 void sendDidLoseContextRecursive(LayerImpl*); |
328 void clearRenderSurfaces(); | 328 void clearRenderSurfaces(); |
329 bool ensureRenderSurfaceLayerList(); | 329 bool ensureRenderSurfaceLayerList(); |
330 void clearCurrentlyScrollingLayer(); | 330 void clearCurrentlyScrollingLayer(); |
331 | 331 |
332 void animateScrollbarsRecursive(LayerImpl*, base::TimeTicks monotonicTime); | 332 void animateScrollbarsRecursive(LayerImpl*, base::TimeTicks monotonicTime); |
333 | 333 |
334 void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const; | 334 void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const; |
335 | 335 |
336 scoped_ptr<OutputSurface> m_outputSurface; | 336 scoped_ptr<GraphicsContext> m_context; |
337 scoped_ptr<ResourceProvider> m_resourceProvider; | 337 scoped_ptr<ResourceProvider> m_resourceProvider; |
338 scoped_ptr<Renderer> m_renderer; | 338 scoped_ptr<Renderer> m_renderer; |
339 scoped_ptr<TileManager> m_tileManager; | 339 scoped_ptr<TileManager> m_tileManager; |
340 scoped_ptr<LayerImpl> m_rootLayerImpl; | 340 scoped_ptr<LayerImpl> m_rootLayerImpl; |
341 LayerImpl* m_rootScrollLayerImpl; | 341 LayerImpl* m_rootScrollLayerImpl; |
342 LayerImpl* m_currentlyScrollingLayerImpl; | 342 LayerImpl* m_currentlyScrollingLayerImpl; |
343 HeadsUpDisplayLayerImpl* m_hudLayerImpl; | 343 HeadsUpDisplayLayerImpl* m_hudLayerImpl; |
344 int m_scrollingLayerIdFromPreviousTree; | 344 int m_scrollingLayerIdFromPreviousTree; |
345 bool m_scrollDeltaIsInViewportSpace; | 345 bool m_scrollDeltaIsInViewportSpace; |
346 LayerTreeSettings m_settings; | 346 LayerTreeSettings m_settings; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 size_t m_numMainThreadScrolls; | 380 size_t m_numMainThreadScrolls; |
381 | 381 |
382 size_t m_cumulativeNumLayersDrawn; | 382 size_t m_cumulativeNumLayersDrawn; |
383 | 383 |
384 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 384 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
385 }; | 385 }; |
386 | 386 |
387 } // namespace cc | 387 } // namespace cc |
388 | 388 |
389 #endif // CC_LAYER_TREE_HOST_IMPL_H_ | 389 #endif // CC_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |