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/layer_tree_host_client.h" | 19 #include "cc/layer_tree_host_client.h" |
20 #include "cc/layer_tree_host_common.h" | 20 #include "cc/layer_tree_host_common.h" |
21 #include "cc/occlusion_tracker.h" | 21 #include "cc/occlusion_tracker.h" |
22 #include "cc/prioritized_texture_manager.h" | 22 #include "cc/prioritized_resource_manager.h" |
23 #include "cc/proxy.h" | 23 #include "cc/proxy.h" |
24 #include "cc/rate_limiter.h" | 24 #include "cc/rate_limiter.h" |
25 #include "cc/rendering_stats.h" | 25 #include "cc/rendering_stats.h" |
26 #include "cc/scoped_ptr_vector.h" | 26 #include "cc/scoped_ptr_vector.h" |
27 #include "third_party/skia/include/core/SkColor.h" | 27 #include "third_party/skia/include/core/SkColor.h" |
28 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
29 | 29 |
30 #if defined(COMPILER_GCC) | 30 #if defined(COMPILER_GCC) |
31 namespace BASE_HASH_NAMESPACE { | 31 namespace BASE_HASH_NAMESPACE { |
32 template<> | 32 template<> |
33 struct hash<WebKit::WebGraphicsContext3D*> { | 33 struct hash<WebKit::WebGraphicsContext3D*> { |
34 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { | 34 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { |
35 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 35 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
36 } | 36 } |
37 }; | 37 }; |
38 } // namespace BASE_HASH_NAMESPACE | 38 } // namespace BASE_HASH_NAMESPACE |
39 #endif // COMPILER | 39 #endif // COMPILER |
40 | 40 |
41 namespace cc { | 41 namespace cc { |
42 | 42 |
43 class FontAtlas; | 43 class FontAtlas; |
44 class Layer; | 44 class Layer; |
45 class LayerTreeHostImpl; | 45 class LayerTreeHostImpl; |
46 class LayerTreeHostImplClient; | 46 class LayerTreeHostImplClient; |
47 class PrioritizedTextureManager; | 47 class PrioritizedResourceManager; |
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; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } | 178 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } |
179 const gfx::Size& deviceViewportSize() const { return m_deviceViewportSize; } | 179 const gfx::Size& deviceViewportSize() const { return m_deviceViewportSize; } |
180 | 180 |
181 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); | 181 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); |
182 | 182 |
183 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | 183 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } |
184 | 184 |
185 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | 185 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } |
186 | 186 |
187 PrioritizedTextureManager* contentsTextureManager() const; | 187 PrioritizedResourceManager* contentsTextureManager() const; |
188 | 188 |
189 bool visible() const { return m_visible; } | 189 bool visible() const { return m_visible; } |
190 void setVisible(bool); | 190 void setVisible(bool); |
191 | 191 |
192 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); | 192 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, flo
at scale, base::TimeDelta duration); |
193 | 193 |
194 void applyScrollAndScale(const ScrollAndScaleSet&); | 194 void applyScrollAndScale(const ScrollAndScaleSet&); |
195 gfx::PointF adjustEventPointForPinchZoom(const gfx::PointF&) const; | 195 gfx::PointF adjustEventPointForPinchZoom(const gfx::PointF&) const; |
196 void setImplTransform(const WebKit::WebTransformationMatrix&); | 196 void setImplTransform(const WebKit::WebTransformationMatrix&); |
197 | 197 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 scoped_ptr<Proxy> m_proxy; | 252 scoped_ptr<Proxy> m_proxy; |
253 bool m_rendererInitialized; | 253 bool m_rendererInitialized; |
254 bool m_contextLost; | 254 bool m_contextLost; |
255 int m_numTimesRecreateShouldFail; | 255 int m_numTimesRecreateShouldFail; |
256 int m_numFailedRecreateAttempts; | 256 int m_numFailedRecreateAttempts; |
257 | 257 |
258 scoped_refptr<Layer> m_rootLayer; | 258 scoped_refptr<Layer> m_rootLayer; |
259 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; | 259 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; |
260 | 260 |
261 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; | 261 scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager; |
262 scoped_ptr<PrioritizedTexture> m_surfaceMemoryPlaceholder; | 262 scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder; |
263 | 263 |
264 LayerTreeSettings m_settings; | 264 LayerTreeSettings m_settings; |
265 | 265 |
266 gfx::Size m_layoutViewportSize; | 266 gfx::Size m_layoutViewportSize; |
267 gfx::Size m_deviceViewportSize; | 267 gfx::Size m_deviceViewportSize; |
268 float m_deviceScaleFactor; | 268 float m_deviceScaleFactor; |
269 | 269 |
270 bool m_visible; | 270 bool m_visible; |
271 | 271 |
272 typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimi
ter> > RateLimiterMap; | 272 typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimi
ter> > RateLimiterMap; |
273 RateLimiterMap m_rateLimiters; | 273 RateLimiterMap m_rateLimiters; |
274 | 274 |
275 float m_pageScaleFactor; | 275 float m_pageScaleFactor; |
276 float m_minPageScaleFactor, m_maxPageScaleFactor; | 276 float m_minPageScaleFactor, m_maxPageScaleFactor; |
277 WebKit::WebTransformationMatrix m_implTransform; | 277 WebKit::WebTransformationMatrix m_implTransform; |
278 bool m_triggerIdleUpdates; | 278 bool m_triggerIdleUpdates; |
279 | 279 |
280 SkColor m_backgroundColor; | 280 SkColor m_backgroundColor; |
281 bool m_hasTransparentBackground; | 281 bool m_hasTransparentBackground; |
282 | 282 |
283 typedef ScopedPtrVector<PrioritizedTexture> TextureList; | 283 typedef ScopedPtrVector<PrioritizedResource> TextureList; |
284 size_t m_partialTextureUpdateRequests; | 284 size_t m_partialTextureUpdateRequests; |
285 | 285 |
286 static bool s_needsFilterContext; | 286 static bool s_needsFilterContext; |
287 | 287 |
288 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 288 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
289 }; | 289 }; |
290 | 290 |
291 } // namespace cc | 291 } // namespace cc |
292 | 292 |
293 #endif // CC_LAYER_TREE_HOST_H_ | 293 #endif // CC_LAYER_TREE_HOST_H_ |
OLD | NEW |