| 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 CCLayerTreeHost_h | 5 #ifndef CCLayerTreeHost_h |
| 6 #define CCLayerTreeHost_h | 6 #define CCLayerTreeHost_h |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "IntRect.h" | |
| 11 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 12 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
| 13 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
| 14 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/time.h" | 15 #include "base/time.h" |
| 17 #include "cc/animation_events.h" | 16 #include "cc/animation_events.h" |
| 18 #include "cc/graphics_context.h" | 17 #include "cc/graphics_context.h" |
| 19 #include "cc/layer_tree_host_client.h" | 18 #include "cc/layer_tree_host_client.h" |
| 20 #include "cc/layer_tree_host_common.h" | 19 #include "cc/layer_tree_host_common.h" |
| 21 #include "cc/occlusion_tracker.h" | 20 #include "cc/occlusion_tracker.h" |
| 22 #include "cc/prioritized_texture_manager.h" | 21 #include "cc/prioritized_texture_manager.h" |
| 23 #include "cc/proxy.h" | 22 #include "cc/proxy.h" |
| 24 #include "cc/rate_limiter.h" | 23 #include "cc/rate_limiter.h" |
| 25 #include "cc/rendering_stats.h" | 24 #include "cc/rendering_stats.h" |
| 26 #include "cc/scoped_ptr_vector.h" | 25 #include "cc/scoped_ptr_vector.h" |
| 27 #include "third_party/skia/include/core/SkColor.h" | 26 #include "third_party/skia/include/core/SkColor.h" |
| 27 #include "ui/gfx/rect.h" |
| 28 | 28 |
| 29 #if defined(COMPILER_GCC) | 29 #if defined(COMPILER_GCC) |
| 30 namespace BASE_HASH_NAMESPACE { | 30 namespace BASE_HASH_NAMESPACE { |
| 31 template<> | 31 template<> |
| 32 struct hash<WebKit::WebGraphicsContext3D*> { | 32 struct hash<WebKit::WebGraphicsContext3D*> { |
| 33 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { | 33 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { |
| 34 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 34 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| 35 } | 35 } |
| 36 }; | 36 }; |
| 37 } // namespace BASE_HASH_NAMESPACE | 37 } // namespace BASE_HASH_NAMESPACE |
| 38 #endif // COMPILER | 38 #endif // COMPILER |
| 39 | 39 |
| 40 namespace cc { | 40 namespace cc { |
| 41 | 41 |
| 42 class FontAtlas; | 42 class FontAtlas; |
| 43 class IntRect; |
| 43 class Layer; | 44 class Layer; |
| 44 class LayerTreeHostImpl; | 45 class LayerTreeHostImpl; |
| 45 class LayerTreeHostImplClient; | 46 class LayerTreeHostImplClient; |
| 46 class PrioritizedTextureManager; | 47 class PrioritizedTextureManager; |
| 47 class ResourceUpdateQueue; | 48 class ResourceUpdateQueue; |
| 48 class HeadsUpDisplayLayer; | 49 class HeadsUpDisplayLayer; |
| 49 class Region; | 50 class Region; |
| 50 struct ScrollAndScaleSet; | 51 struct ScrollAndScaleSet; |
| 51 | 52 |
| 52 struct LayerTreeSettings { | 53 struct LayerTreeSettings { |
| 53 LayerTreeSettings(); | 54 LayerTreeSettings(); |
| 54 ~LayerTreeSettings(); | 55 ~LayerTreeSettings(); |
| 55 | 56 |
| 56 bool acceleratePainting; | 57 bool acceleratePainting; |
| 57 bool showFPSCounter; | 58 bool showFPSCounter; |
| 58 bool showPlatformLayerTree; | 59 bool showPlatformLayerTree; |
| 59 bool showPaintRects; | 60 bool showPaintRects; |
| 60 bool showPropertyChangedRects; | 61 bool showPropertyChangedRects; |
| 61 bool showSurfaceDamageRects; | 62 bool showSurfaceDamageRects; |
| 62 bool showScreenSpaceRects; | 63 bool showScreenSpaceRects; |
| 63 bool showReplicaScreenSpaceRects; | 64 bool showReplicaScreenSpaceRects; |
| 64 bool showOccludingRects; | 65 bool showOccludingRects; |
| 65 bool renderVSyncEnabled; | 66 bool renderVSyncEnabled; |
| 66 double refreshRate; | 67 double refreshRate; |
| 67 size_t maxPartialTextureUpdates; | 68 size_t maxPartialTextureUpdates; |
| 68 IntSize defaultTileSize; | 69 gfx::Size defaultTileSize; |
| 69 IntSize maxUntiledLayerSize; | 70 gfx::Size maxUntiledLayerSize; |
| 70 IntSize minimumOcclusionTrackingSize; | 71 gfx::Size minimumOcclusionTrackingSize; |
| 71 | 72 |
| 72 bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter
|| showDebugRects(); } | 73 bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter
|| showDebugRects(); } |
| 73 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; } |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 // 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 |
| 77 struct RendererCapabilities { | 78 struct RendererCapabilities { |
| 78 RendererCapabilities(); | 79 RendererCapabilities(); |
| 79 ~RendererCapabilities(); | 80 ~RendererCapabilities(); |
| 80 | 81 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 167 |
| 167 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl
ockTime); | 168 void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallCl
ockTime); |
| 168 virtual void didAddAnimation(); | 169 virtual void didAddAnimation(); |
| 169 | 170 |
| 170 Layer* rootLayer() { return m_rootLayer.get(); } | 171 Layer* rootLayer() { return m_rootLayer.get(); } |
| 171 const Layer* rootLayer() const { return m_rootLayer.get(); } | 172 const Layer* rootLayer() const { return m_rootLayer.get(); } |
| 172 void setRootLayer(scoped_refptr<Layer>); | 173 void setRootLayer(scoped_refptr<Layer>); |
| 173 | 174 |
| 174 const LayerTreeSettings& settings() const { return m_settings; } | 175 const LayerTreeSettings& settings() const { return m_settings; } |
| 175 | 176 |
| 176 void setViewportSize(const IntSize& layoutViewportSize, const IntSize& devic
eViewportSize); | 177 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& d
eviceViewportSize); |
| 177 | 178 |
| 178 const IntSize& layoutViewportSize() const { return m_layoutViewportSize; } | 179 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } |
| 179 const IntSize& deviceViewportSize() const { return m_deviceViewportSize; } | 180 const gfx::Size& deviceViewportSize() const { return m_deviceViewportSize; } |
| 180 | 181 |
| 181 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); | 182 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFa
ctor, float maxPageScaleFactor); |
| 182 | 183 |
| 183 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } | 184 void setBackgroundColor(SkColor color) { m_backgroundColor = color; } |
| 184 | 185 |
| 185 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } | 186 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackgro
und = transparent; } |
| 186 | 187 |
| 187 PrioritizedTextureManager* contentsTextureManager() const; | 188 PrioritizedTextureManager* contentsTextureManager() const; |
| 188 | 189 |
| 189 bool visible() const { return m_visible; } | 190 bool visible() const { return m_visible; } |
| 190 void setVisible(bool); | 191 void setVisible(bool); |
| 191 | 192 |
| 192 void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor,
float scale, base::TimeDelta duration); | 193 void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor,
float scale, base::TimeDelta duration); |
| 193 | 194 |
| 194 void applyScrollAndScale(const ScrollAndScaleSet&); | 195 void applyScrollAndScale(const ScrollAndScaleSet&); |
| 195 FloatPoint adjustEventPointForPinchZoom(const FloatPoint&) const; | 196 gfx::PointF adjustEventPointForPinchZoom(const gfx::PointF&) const; |
| 196 void setImplTransform(const WebKit::WebTransformationMatrix&); | 197 void setImplTransform(const WebKit::WebTransformationMatrix&); |
| 197 | 198 |
| 198 void startRateLimiter(WebKit::WebGraphicsContext3D*); | 199 void startRateLimiter(WebKit::WebGraphicsContext3D*); |
| 199 void stopRateLimiter(WebKit::WebGraphicsContext3D*); | 200 void stopRateLimiter(WebKit::WebGraphicsContext3D*); |
| 200 | 201 |
| 201 // RateLimitClient implementation | 202 // RateLimitClient implementation |
| 202 virtual void rateLimit() OVERRIDE; | 203 virtual void rateLimit() OVERRIDE; |
| 203 | 204 |
| 204 bool bufferedUpdates(); | 205 bool bufferedUpdates(); |
| 205 bool requestPartialTextureUpdate(); | 206 bool requestPartialTextureUpdate(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 255 |
| 255 scoped_refptr<Layer> m_rootLayer; | 256 scoped_refptr<Layer> m_rootLayer; |
| 256 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; | 257 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; |
| 257 scoped_ptr<FontAtlas> m_fontAtlas; | 258 scoped_ptr<FontAtlas> m_fontAtlas; |
| 258 | 259 |
| 259 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; | 260 scoped_ptr<PrioritizedTextureManager> m_contentsTextureManager; |
| 260 scoped_ptr<PrioritizedTexture> m_surfaceMemoryPlaceholder; | 261 scoped_ptr<PrioritizedTexture> m_surfaceMemoryPlaceholder; |
| 261 | 262 |
| 262 LayerTreeSettings m_settings; | 263 LayerTreeSettings m_settings; |
| 263 | 264 |
| 264 IntSize m_layoutViewportSize; | 265 gfx::Size m_layoutViewportSize; |
| 265 IntSize m_deviceViewportSize; | 266 gfx::Size m_deviceViewportSize; |
| 266 float m_deviceScaleFactor; | 267 float m_deviceScaleFactor; |
| 267 | 268 |
| 268 bool m_visible; | 269 bool m_visible; |
| 269 | 270 |
| 270 typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimi
ter> > RateLimiterMap; | 271 typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimi
ter> > RateLimiterMap; |
| 271 RateLimiterMap m_rateLimiters; | 272 RateLimiterMap m_rateLimiters; |
| 272 | 273 |
| 273 float m_pageScaleFactor; | 274 float m_pageScaleFactor; |
| 274 float m_minPageScaleFactor, m_maxPageScaleFactor; | 275 float m_minPageScaleFactor, m_maxPageScaleFactor; |
| 275 WebKit::WebTransformationMatrix m_implTransform; | 276 WebKit::WebTransformationMatrix m_implTransform; |
| 276 bool m_triggerIdleUpdates; | 277 bool m_triggerIdleUpdates; |
| 277 | 278 |
| 278 SkColor m_backgroundColor; | 279 SkColor m_backgroundColor; |
| 279 bool m_hasTransparentBackground; | 280 bool m_hasTransparentBackground; |
| 280 | 281 |
| 281 typedef ScopedPtrVector<PrioritizedTexture> TextureList; | 282 typedef ScopedPtrVector<PrioritizedTexture> TextureList; |
| 282 size_t m_partialTextureUpdateRequests; | 283 size_t m_partialTextureUpdateRequests; |
| 283 | 284 |
| 284 static bool s_needsFilterContext; | 285 static bool s_needsFilterContext; |
| 285 | 286 |
| 286 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 287 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 287 }; | 288 }; |
| 288 | 289 |
| 289 } // namespace cc | 290 } // namespace cc |
| 290 | 291 |
| 291 #endif | 292 #endif |
| OLD | NEW |