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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 class ResourceUpdateQueue; | 48 class ResourceUpdateQueue; |
49 class HeadsUpDisplayLayer; | 49 class HeadsUpDisplayLayer; |
50 class Region; | 50 class Region; |
51 struct ScrollAndScaleSet; | 51 struct ScrollAndScaleSet; |
52 | 52 |
53 struct CC_EXPORT LayerTreeSettings { | 53 struct CC_EXPORT LayerTreeSettings { |
54 LayerTreeSettings(); | 54 LayerTreeSettings(); |
55 ~LayerTreeSettings(); | 55 ~LayerTreeSettings(); |
56 | 56 |
57 bool acceleratePainting; | 57 bool acceleratePainting; |
58 bool showFPSCounter; | |
59 bool showPlatformLayerTree; | 58 bool showPlatformLayerTree; |
60 bool showPaintRects; | 59 bool showPaintRects; |
61 bool showPropertyChangedRects; | 60 bool showPropertyChangedRects; |
62 bool showSurfaceDamageRects; | 61 bool showSurfaceDamageRects; |
63 bool showScreenSpaceRects; | 62 bool showScreenSpaceRects; |
64 bool showReplicaScreenSpaceRects; | 63 bool showReplicaScreenSpaceRects; |
65 bool showOccludingRects; | 64 bool showOccludingRects; |
66 bool renderVSyncEnabled; | 65 bool renderVSyncEnabled; |
67 double refreshRate; | 66 double refreshRate; |
68 size_t maxPartialTextureUpdates; | 67 size_t maxPartialTextureUpdates; |
69 gfx::Size defaultTileSize; | 68 gfx::Size defaultTileSize; |
70 gfx::Size maxUntiledLayerSize; | 69 gfx::Size maxUntiledLayerSize; |
71 gfx::Size minimumOcclusionTrackingSize; | 70 gfx::Size minimumOcclusionTrackingSize; |
72 | 71 |
73 bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter
|| showDebugRects(); } | 72 bool showDebugInfo() const { return showPlatformLayerTree || showDebugRects(
); } |
74 bool showDebugRects() const { return showPaintRects || showPropertyChangedRe
cts || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceR
ects || showOccludingRects; } | 73 bool showDebugRects() const { return showPaintRects || showPropertyChangedRe
cts || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceR
ects || showOccludingRects; } |
75 }; | 74 }; |
76 | 75 |
77 // Provides information on an Impl's rendering capabilities back to the LayerTre
eHost | 76 // Provides information on an Impl's rendering capabilities back to the LayerTre
eHost |
78 struct RendererCapabilities { | 77 struct RendererCapabilities { |
79 RendererCapabilities(); | 78 RendererCapabilities(); |
80 ~RendererCapabilities(); | 79 ~RendererCapabilities(); |
81 | 80 |
82 GLenum bestTextureFormat; | 81 GLenum bestTextureFormat; |
83 bool contextHasCachedFrontBuffer; | 82 bool contextHasCachedFrontBuffer; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 200 |
202 // RateLimitClient implementation | 201 // RateLimitClient implementation |
203 virtual void rateLimit() OVERRIDE; | 202 virtual void rateLimit() OVERRIDE; |
204 | 203 |
205 bool bufferedUpdates(); | 204 bool bufferedUpdates(); |
206 bool requestPartialTextureUpdate(); | 205 bool requestPartialTextureUpdate(); |
207 | 206 |
208 void setDeviceScaleFactor(float); | 207 void setDeviceScaleFactor(float); |
209 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 208 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
210 | 209 |
| 210 void setShowFPSCounter(bool show); |
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 protected: | 215 protected: |
216 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); | 216 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); |
217 bool initialize(); | 217 bool initialize(); |
218 | 218 |
219 private: | 219 private: |
220 typedef std::vector<scoped_refptr<Layer> > LayerList; | 220 typedef std::vector<scoped_refptr<Layer> > LayerList; |
221 | 221 |
222 void initializeRenderer(); | 222 void initializeRenderer(); |
223 | 223 |
224 void update(Layer*, ResourceUpdateQueue&, const OcclusionTracker*); | 224 void update(Layer*, ResourceUpdateQueue&, const OcclusionTracker*); |
225 bool paintLayerContents(const LayerList&, ResourceUpdateQueue&); | 225 bool paintLayerContents(const LayerList&, ResourceUpdateQueue&); |
226 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); | 226 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); |
227 | 227 |
228 void updateLayers(Layer*, ResourceUpdateQueue&); | 228 void updateLayers(Layer*, ResourceUpdateQueue&); |
229 void triggerPrepaint(); | 229 void triggerPrepaint(); |
230 | 230 |
231 void prioritizeTextures(const LayerList&, OverdrawMetrics&); | 231 void prioritizeTextures(const LayerList&, OverdrawMetrics&); |
232 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); | 232 void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); |
233 void setPrioritiesForLayers(const LayerList&); | 233 void setPrioritiesForLayers(const LayerList&); |
234 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); | 234 size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); |
235 | 235 |
236 void animateLayers(base::TimeTicks monotonicTime); | 236 void animateLayers(base::TimeTicks monotonicTime); |
237 bool animateLayersRecursive(Layer* current, base::TimeTicks time); | 237 bool animateLayersRecursive(Layer* current, base::TimeTicks time); |
238 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base:
:Time wallClockTime); | 238 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base:
:Time wallClockTime); |
239 | 239 |
| 240 void createHUDLayerIfNeeded(); |
| 241 |
240 bool m_animating; | 242 bool m_animating; |
241 bool m_needsAnimateLayers; | 243 bool m_needsAnimateLayers; |
242 | 244 |
243 base::CancelableClosure m_prepaintCallback; | 245 base::CancelableClosure m_prepaintCallback; |
244 | 246 |
245 LayerTreeHostClient* m_client; | 247 LayerTreeHostClient* m_client; |
246 | 248 |
247 int m_commitNumber; | 249 int m_commitNumber; |
248 RenderingStats m_renderingStats; | 250 RenderingStats m_renderingStats; |
249 | 251 |
250 scoped_ptr<Proxy> m_proxy; | 252 scoped_ptr<Proxy> m_proxy; |
251 bool m_rendererInitialized; | 253 bool m_rendererInitialized; |
252 bool m_contextLost; | 254 bool m_contextLost; |
253 int m_numTimesRecreateShouldFail; | 255 int m_numTimesRecreateShouldFail; |
254 int m_numFailedRecreateAttempts; | 256 int m_numFailedRecreateAttempts; |
255 | 257 |
256 scoped_refptr<Layer> m_rootLayer; | 258 scoped_refptr<Layer> m_rootLayer; |
257 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; | 259 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; |
258 scoped_ptr<FontAtlas> m_fontAtlas; | |
259 | 260 |
260 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; | 261 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; |
261 scoped_ptr<PrioritizedTexture> m_surfaceMemoryPlaceholder; | 262 scoped_ptr<PrioritizedTexture> m_surfaceMemoryPlaceholder; |
262 | 263 |
263 LayerTreeSettings m_settings; | 264 LayerTreeSettings m_settings; |
264 | 265 |
265 gfx::Size m_layoutViewportSize; | 266 gfx::Size m_layoutViewportSize; |
266 gfx::Size m_deviceViewportSize; | 267 gfx::Size m_deviceViewportSize; |
267 float m_deviceScaleFactor; | 268 float m_deviceScaleFactor; |
268 | 269 |
(...skipping 14 matching lines...) Expand all Loading... |
283 size_t m_partialTextureUpdateRequests; | 284 size_t m_partialTextureUpdateRequests; |
284 | 285 |
285 static bool s_needsFilterContext; | 286 static bool s_needsFilterContext; |
286 | 287 |
287 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 288 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
288 }; | 289 }; |
289 | 290 |
290 } // namespace cc | 291 } // namespace cc |
291 | 292 |
292 #endif // CC_LAYER_TREE_HOST_H_ | 293 #endif // CC_LAYER_TREE_HOST_H_ |
OLD | NEW |