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" |
11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
12 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "cc/animation_events.h" | 16 #include "cc/animation_events.h" |
17 #include "cc/cc_export.h" | 17 #include "cc/cc_export.h" |
18 #include "cc/graphics_context.h" | 18 #include "cc/graphics_context.h" |
19 #include "cc/heads_up_display_layer.h" | |
19 #include "cc/layer_tree_host_client.h" | 20 #include "cc/layer_tree_host_client.h" |
20 #include "cc/layer_tree_host_common.h" | 21 #include "cc/layer_tree_host_common.h" |
21 #include "cc/occlusion_tracker.h" | 22 #include "cc/occlusion_tracker.h" |
22 #include "cc/prioritized_resource_manager.h" | 23 #include "cc/prioritized_resource_manager.h" |
23 #include "cc/proxy.h" | 24 #include "cc/proxy.h" |
24 #include "cc/rate_limiter.h" | 25 #include "cc/rate_limiter.h" |
25 #include "cc/rendering_stats.h" | 26 #include "cc/rendering_stats.h" |
26 #include "cc/scoped_ptr_vector.h" | 27 #include "cc/scoped_ptr_vector.h" |
27 #include "third_party/skia/include/core/SkColor.h" | 28 #include "third_party/skia/include/core/SkColor.h" |
28 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
29 | 30 |
30 #if defined(COMPILER_GCC) | 31 #if defined(COMPILER_GCC) |
31 namespace BASE_HASH_NAMESPACE { | 32 namespace BASE_HASH_NAMESPACE { |
32 template<> | 33 template<> |
33 struct hash<WebKit::WebGraphicsContext3D*> { | 34 struct hash<WebKit::WebGraphicsContext3D*> { |
34 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { | 35 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { |
35 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 36 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
36 } | 37 } |
37 }; | 38 }; |
38 } // namespace BASE_HASH_NAMESPACE | 39 } // namespace BASE_HASH_NAMESPACE |
39 #endif // COMPILER | 40 #endif // COMPILER |
40 | 41 |
41 namespace cc { | 42 namespace cc { |
42 | 43 |
43 class FontAtlas; | |
44 class Layer; | 44 class Layer; |
45 class LayerTreeHostImpl; | 45 class LayerTreeHostImpl; |
46 class LayerTreeHostImplClient; | 46 class LayerTreeHostImplClient; |
47 class PrioritizedResourceManager; | 47 class PrioritizedResourceManager; |
48 class ResourceUpdateQueue; | 48 class ResourceUpdateQueue; |
49 class HeadsUpDisplayLayer; | |
50 class Region; | 49 class Region; |
51 struct ScrollAndScaleSet; | 50 struct ScrollAndScaleSet; |
52 | 51 |
53 struct CC_EXPORT LayerTreeSettings { | 52 struct CC_EXPORT LayerTreeSwitches { |
egraether
2012/11/22 00:23:15
New structure LayerTreeSwitches holds values that
danakj
2012/11/26 19:57:18
This is great. The only concern I have here is tha
danakj
2012/11/26 19:58:25
Nat suggested LayerTreeDebugState, which I like. L
| |
54 LayerTreeSettings(); | 53 LayerTreeSwitches(); |
55 ~LayerTreeSettings(); | 54 ~LayerTreeSwitches(); |
56 | 55 |
57 bool acceleratePainting; | 56 bool showFPSCounter; |
57 bool showPlatformLayerTree; | |
58 bool showDebugBorders; | 58 bool showDebugBorders; |
egraether
2012/11/22 00:23:15
Also holds showDebugBorders
| |
59 bool showPlatformLayerTree; | 59 |
60 bool showPaintRects; | 60 bool showPaintRects; |
61 bool showPropertyChangedRects; | 61 bool showPropertyChangedRects; |
62 bool showSurfaceDamageRects; | 62 bool showSurfaceDamageRects; |
63 bool showScreenSpaceRects; | 63 bool showScreenSpaceRects; |
64 bool showReplicaScreenSpaceRects; | 64 bool showReplicaScreenSpaceRects; |
65 bool showOccludingRects; | 65 bool showOccludingRects; |
66 bool showNonOccludingRects; | 66 bool showNonOccludingRects; |
67 | |
68 bool showHudInfo() const; | |
69 bool showHudRects() const; | |
danakj
2012/11/26 19:57:18
I like the name changes here a lot.
| |
70 | |
71 LayerTreeSwitches merge(const LayerTreeSwitches& other) const; | |
danakj
2012/11/26 19:57:18
How about a static method that takes two instances
| |
72 }; | |
73 | |
74 struct CC_EXPORT LayerTreeSettings { | |
75 LayerTreeSettings(); | |
76 ~LayerTreeSettings(); | |
77 | |
78 bool acceleratePainting; | |
67 bool renderVSyncEnabled; | 79 bool renderVSyncEnabled; |
68 bool perTilePaintingEnabled; | 80 bool perTilePaintingEnabled; |
69 bool partialSwapEnabled; | 81 bool partialSwapEnabled; |
70 bool acceleratedAnimationEnabled; | 82 bool acceleratedAnimationEnabled; |
71 bool pageScalePinchZoomEnabled; | 83 bool pageScalePinchZoomEnabled; |
72 bool backgroundColorInsteadOfCheckerboard; | 84 bool backgroundColorInsteadOfCheckerboard; |
73 bool showOverdrawInTracing; | 85 bool showOverdrawInTracing; |
74 double refreshRate; | 86 double refreshRate; |
75 size_t maxPartialTextureUpdates; | 87 size_t maxPartialTextureUpdates; |
76 gfx::Size defaultTileSize; | 88 gfx::Size defaultTileSize; |
77 gfx::Size maxUntiledLayerSize; | 89 gfx::Size maxUntiledLayerSize; |
78 gfx::Size minimumOcclusionTrackingSize; | 90 gfx::Size minimumOcclusionTrackingSize; |
79 | 91 |
80 bool showDebugInfo() const { return showPlatformLayerTree || showDebugRects( ); } | 92 LayerTreeSwitches initialSwitchSettings; |
egraether
2012/11/22 00:23:15
Initial switch values from the commandline get sto
danakj
2012/11/26 19:57:18
initialSwitchValues? (or initialToggleValues?)
"S
| |
81 bool showDebugRects() const { return showPaintRects || showPropertyChangedRe cts || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceR ects || showOccludingRects || showNonOccludingRects; } | |
82 }; | 93 }; |
83 | 94 |
84 // Provides information on an Impl's rendering capabilities back to the LayerTre eHost | 95 // Provides information on an Impl's rendering capabilities back to the LayerTre eHost |
85 struct CC_EXPORT RendererCapabilities { | 96 struct CC_EXPORT RendererCapabilities { |
86 RendererCapabilities(); | 97 RendererCapabilities(); |
87 ~RendererCapabilities(); | 98 ~RendererCapabilities(); |
88 | 99 |
89 GLenum bestTextureFormat; | 100 GLenum bestTextureFormat; |
90 bool contextHasCachedFrontBuffer; | 101 bool contextHasCachedFrontBuffer; |
91 bool usingPartialSwap; | 102 bool usingPartialSwap; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 | 186 |
176 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl ockTime); | 187 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl ockTime); |
177 virtual void didAddAnimation(); | 188 virtual void didAddAnimation(); |
178 | 189 |
179 Layer* rootLayer() { return m_rootLayer.get(); } | 190 Layer* rootLayer() { return m_rootLayer.get(); } |
180 const Layer* rootLayer() const { return m_rootLayer.get(); } | 191 const Layer* rootLayer() const { return m_rootLayer.get(); } |
181 void setRootLayer(scoped_refptr<Layer>); | 192 void setRootLayer(scoped_refptr<Layer>); |
182 | 193 |
183 const LayerTreeSettings& settings() const { return m_settings; } | 194 const LayerTreeSettings& settings() const { return m_settings; } |
184 | 195 |
196 void setSwitches(const LayerTreeSwitches& switches); | |
197 const LayerTreeSwitches& switches() const { return m_switches; } | |
198 | |
185 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& d eviceViewportSize); | 199 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& d eviceViewportSize); |
186 | 200 |
187 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } | 201 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } |
188 const gfx::Size& deviceViewportSize() const { return m_deviceViewportSize; } | 202 const gfx::Size& deviceViewportSize() const { return m_deviceViewportSize; } |
189 | 203 |
190 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa ctor, float maxPageScaleFactor); | 204 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa ctor, float maxPageScaleFactor); |
191 | 205 |
192 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | 206 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } |
193 | 207 |
194 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro und = transparent; } | 208 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro und = transparent; } |
(...skipping 14 matching lines...) Expand all Loading... | |
209 | 223 |
210 // RateLimitClient implementation | 224 // RateLimitClient implementation |
211 virtual void rateLimit() OVERRIDE; | 225 virtual void rateLimit() OVERRIDE; |
212 | 226 |
213 bool bufferedUpdates(); | 227 bool bufferedUpdates(); |
214 bool requestPartialTextureUpdate(); | 228 bool requestPartialTextureUpdate(); |
215 | 229 |
216 void setDeviceScaleFactor(float); | 230 void setDeviceScaleFactor(float); |
217 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 231 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
218 | 232 |
219 void setShowFPSCounter(bool show); | |
220 void setFontAtlas(scoped_ptr<FontAtlas>); | 233 void setFontAtlas(scoped_ptr<FontAtlas>); |
221 | 234 |
222 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } | 235 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } |
223 | 236 |
224 Proxy* proxy() const { return m_proxy.get(); } | 237 Proxy* proxy() const { return m_proxy.get(); } |
225 | 238 |
226 protected: | 239 protected: |
227 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); | 240 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); |
228 bool initialize(scoped_ptr<Thread> implThread); | 241 bool initialize(scoped_ptr<Thread> implThread); |
229 | 242 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 int m_numTimesRecreateShouldFail; | 279 int m_numTimesRecreateShouldFail; |
267 int m_numFailedRecreateAttempts; | 280 int m_numFailedRecreateAttempts; |
268 | 281 |
269 scoped_refptr<Layer> m_rootLayer; | 282 scoped_refptr<Layer> m_rootLayer; |
270 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; | 283 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; |
271 | 284 |
272 scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager; | 285 scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager; |
273 scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder; | 286 scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder; |
274 | 287 |
275 LayerTreeSettings m_settings; | 288 LayerTreeSettings m_settings; |
289 LayerTreeSwitches m_switches; | |
276 | 290 |
277 gfx::Size m_layoutViewportSize; | 291 gfx::Size m_layoutViewportSize; |
278 gfx::Size m_deviceViewportSize; | 292 gfx::Size m_deviceViewportSize; |
279 float m_deviceScaleFactor; | 293 float m_deviceScaleFactor; |
280 | 294 |
281 bool m_visible; | 295 bool m_visible; |
282 | 296 |
283 typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimi ter> > RateLimiterMap; | 297 typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimi ter> > RateLimiterMap; |
284 RateLimiterMap m_rateLimiters; | 298 RateLimiterMap m_rateLimiters; |
285 | 299 |
286 float m_pageScaleFactor; | 300 float m_pageScaleFactor; |
287 float m_minPageScaleFactor, m_maxPageScaleFactor; | 301 float m_minPageScaleFactor, m_maxPageScaleFactor; |
288 WebKit::WebTransformationMatrix m_implTransform; | 302 WebKit::WebTransformationMatrix m_implTransform; |
289 bool m_triggerIdleUpdates; | 303 bool m_triggerIdleUpdates; |
290 | 304 |
291 SkColor m_backgroundColor; | 305 SkColor m_backgroundColor; |
292 bool m_hasTransparentBackground; | 306 bool m_hasTransparentBackground; |
293 | 307 |
294 typedef ScopedPtrVector<PrioritizedResource> TextureList; | 308 typedef ScopedPtrVector<PrioritizedResource> TextureList; |
295 size_t m_partialTextureUpdateRequests; | 309 size_t m_partialTextureUpdateRequests; |
296 | 310 |
297 static bool s_needsFilterContext; | 311 static bool s_needsFilterContext; |
298 | 312 |
299 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 313 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
300 }; | 314 }; |
301 | 315 |
302 } // namespace cc | 316 } // namespace cc |
303 | 317 |
304 #endif // CC_LAYER_TREE_HOST_H_ | 318 #endif // CC_LAYER_TREE_HOST_H_ |
OLD | NEW |