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_H_ | 5 #ifndef CC_LAYER_TREE_HOST_H_ |
6 #define CC_LAYER_TREE_HOST_H_ | 6 #define CC_LAYER_TREE_HOST_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 size_t maxPartialTextureUpdates; | 68 size_t maxPartialTextureUpdates; |
69 gfx::Size defaultTileSize; | 69 gfx::Size defaultTileSize; |
70 gfx::Size maxUntiledLayerSize; | 70 gfx::Size maxUntiledLayerSize; |
71 gfx::Size minimumOcclusionTrackingSize; | 71 gfx::Size minimumOcclusionTrackingSize; |
72 | 72 |
73 bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter
|| showDebugRects(); } | 73 bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter
|| showDebugRects(); } |
74 bool showDebugRects() const { return showPaintRects || showPropertyChangedRe
cts || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceR
ects || showOccludingRects; } | 74 bool showDebugRects() const { return showPaintRects || showPropertyChangedRe
cts || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceR
ects || showOccludingRects; } |
75 }; | 75 }; |
76 | 76 |
77 // Provides information on an Impl's rendering capabilities back to the LayerTre
eHost | 77 // Provides information on an Impl's rendering capabilities back to the LayerTre
eHost |
78 struct CC_EXPORT RendererCapabilities { | 78 struct RendererCapabilities { |
79 RendererCapabilities(); | 79 RendererCapabilities(); |
80 ~RendererCapabilities(); | 80 ~RendererCapabilities(); |
81 | 81 |
82 GLenum bestTextureFormat; | 82 GLenum bestTextureFormat; |
83 bool contextHasCachedFrontBuffer; | 83 bool contextHasCachedFrontBuffer; |
84 bool usingPartialSwap; | 84 bool usingPartialSwap; |
85 bool usingAcceleratedPainting; | 85 bool usingAcceleratedPainting; |
86 bool usingSetVisibility; | 86 bool usingSetVisibility; |
87 bool usingSwapCompleteCallback; | 87 bool usingSwapCompleteCallback; |
88 bool usingGpuMemoryManager; | 88 bool usingGpuMemoryManager; |
89 bool usingDiscardFramebuffer; | 89 bool usingDiscardFramebuffer; |
90 bool usingEglImage; | 90 bool usingEglImage; |
91 int maxTextureSize; | 91 int maxTextureSize; |
92 }; | 92 }; |
93 | 93 |
94 class CC_EXPORT LayerTreeHost : public RateLimiterClient { | 94 class CC_EXPORT LayerTreeHost : public RateLimiterClient { |
95 public: | 95 public: |
96 static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTre
eSettings&, scoped_ptr<Thread> implThread); | 96 static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTre
eSettings&); |
97 virtual ~LayerTreeHost(); | 97 virtual ~LayerTreeHost(); |
98 | 98 |
99 void setSurfaceReady(); | 99 void setSurfaceReady(); |
100 | 100 |
101 // Returns true if any LayerTreeHost is alive. | 101 // Returns true if any LayerTreeHost is alive. |
102 static bool anyLayerTreeHostInstanceExists(); | 102 static bool anyLayerTreeHostInstanceExists(); |
103 | 103 |
104 static bool needsFilterContext() { return s_needsFilterContext; } | 104 static bool needsFilterContext() { return s_needsFilterContext; } |
105 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo
ntext = needsFilterContext; } | 105 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo
ntext = needsFilterContext; } |
106 bool needsSharedContext() const { return needsFilterContext() || settings().
acceleratePainting; } | 106 bool needsSharedContext() const { return needsFilterContext() || settings().
acceleratePainting; } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool bufferedUpdates(); | 205 bool bufferedUpdates(); |
206 bool requestPartialTextureUpdate(); | 206 bool requestPartialTextureUpdate(); |
207 | 207 |
208 void setDeviceScaleFactor(float); | 208 void setDeviceScaleFactor(float); |
209 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 209 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
210 | 210 |
211 void setFontAtlas(scoped_ptr<FontAtlas>); | 211 void setFontAtlas(scoped_ptr<FontAtlas>); |
212 | 212 |
213 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } | 213 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } |
214 | 214 |
215 Proxy* proxy() const { return m_proxy.get(); } | |
216 | |
217 protected: | 215 protected: |
218 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); | 216 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); |
219 bool initialize(scoped_ptr<Thread> implThread); | 217 bool initialize(); |
220 | 218 |
221 private: | 219 private: |
222 typedef std::vector<scoped_refptr<Layer> > LayerList; | 220 typedef std::vector<scoped_refptr<Layer> > LayerList; |
223 | 221 |
224 void initializeRenderer(); | 222 void initializeRenderer(); |
225 | 223 |
226 void update(Layer*, ResourceUpdateQueue&, const OcclusionTracker*); | 224 void update(Layer*, ResourceUpdateQueue&, const OcclusionTracker*); |
227 bool paintLayerContents(const LayerList&, ResourceUpdateQueue&); | 225 bool paintLayerContents(const LayerList&, ResourceUpdateQueue&); |
228 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); | 226 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); |
229 | 227 |
230 void updateLayers(Layer*, ResourceUpdateQueue&); | 228 void updateLayers(Layer*, ResourceUpdateQueue&); |
231 void triggerPrepaint(); | 229 void triggerPrepaint(); |
232 | 230 |
233 void prioritizeTextures(const LayerList&, OverdrawMetrics&); | 231 void prioritizeTextures(const LayerList&, OverdrawMetrics&); |
234 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); | 232 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); |
235 void setPrioritiesForLayers(const LayerList&); | 233 void setPrioritiesForLayers(const LayerList&); |
236 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); | 234 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); |
237 | 235 |
238 void animateLayers(base::TimeTicks monotonicTime); | 236 void animateLayers(base::TimeTicks monotonicTime); |
239 bool animateLayersRecursive(Layer* current, base::TimeTicks time); | 237 bool animateLayersRecursive(Layer* current, base::TimeTicks time); |
240 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base:
:Time wallClockTime); | 238 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base:
:Time wallClockTime); |
241 | 239 |
242 bool m_animating; | 240 bool m_animating; |
243 bool m_needsAnimateLayers; | 241 bool m_needsAnimateLayers; |
244 | 242 |
245 base::CancelableClosure m_prepaintCallback; | 243 base::CancelableClosure m_prepaintCallback; |
246 | 244 |
247 LayerTreeHostClient* m_client; | 245 LayerTreeHostClient* m_client; |
248 scoped_ptr<Proxy> m_proxy; | |
249 | 246 |
250 int m_commitNumber; | 247 int m_commitNumber; |
251 RenderingStats m_renderingStats; | 248 RenderingStats m_renderingStats; |
252 | 249 |
| 250 scoped_ptr<Proxy> m_proxy; |
253 bool m_rendererInitialized; | 251 bool m_rendererInitialized; |
254 bool m_contextLost; | 252 bool m_contextLost; |
255 int m_numTimesRecreateShouldFail; | 253 int m_numTimesRecreateShouldFail; |
256 int m_numFailedRecreateAttempts; | 254 int m_numFailedRecreateAttempts; |
257 | 255 |
258 scoped_refptr<Layer> m_rootLayer; | 256 scoped_refptr<Layer> m_rootLayer; |
259 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; | 257 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; |
260 scoped_ptr<FontAtlas> m_fontAtlas; | 258 scoped_ptr<FontAtlas> m_fontAtlas; |
261 | 259 |
262 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; | 260 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; |
(...skipping 22 matching lines...) Expand all Loading... |
285 size_t m_partialTextureUpdateRequests; | 283 size_t m_partialTextureUpdateRequests; |
286 | 284 |
287 static bool s_needsFilterContext; | 285 static bool s_needsFilterContext; |
288 | 286 |
289 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 287 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
290 }; | 288 }; |
291 | 289 |
292 } // namespace cc | 290 } // namespace cc |
293 | 291 |
294 #endif // CC_LAYER_TREE_HOST_H_ | 292 #endif // CC_LAYER_TREE_HOST_H_ |
OLD | NEW |