| 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/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "cc/animation_events.h" | 17 #include "cc/animation_events.h" |
| 18 #include "cc/cc_export.h" | 18 #include "cc/cc_export.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/layer_tree_settings.h" | 21 #include "cc/layer_tree_settings.h" |
| 22 #include "cc/occlusion_tracker.h" | 22 #include "cc/occlusion_tracker.h" |
| 23 #include "cc/output_surface.h" | 23 #include "cc/output_surface.h" |
| 24 #include "cc/proxy.h" | 24 #include "cc/proxy.h" |
| 25 #include "cc/rate_limiter.h" | 25 #include "cc/rate_limiter.h" |
| 26 #include "cc/rendering_stats.h" | |
| 27 #include "cc/scoped_ptr_vector.h" | 26 #include "cc/scoped_ptr_vector.h" |
| 28 #include "skia/ext/refptr.h" | 27 #include "skia/ext/refptr.h" |
| 29 #include "third_party/skia/include/core/SkColor.h" | 28 #include "third_party/skia/include/core/SkColor.h" |
| 30 #include "third_party/skia/include/core/SkPicture.h" | 29 #include "third_party/skia/include/core/SkPicture.h" |
| 31 #include "ui/gfx/rect.h" | 30 #include "ui/gfx/rect.h" |
| 32 | 31 |
| 33 #if defined(COMPILER_GCC) | 32 #if defined(COMPILER_GCC) |
| 34 namespace BASE_HASH_NAMESPACE { | 33 namespace BASE_HASH_NAMESPACE { |
| 35 template <> | 34 template <> |
| 36 struct hash<WebKit::WebGraphicsContext3D*> { | 35 struct hash<WebKit::WebGraphicsContext3D*> { |
| 37 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { | 36 size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { |
| 38 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 37 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| 39 } | 38 } |
| 40 }; | 39 }; |
| 41 } // namespace BASE_HASH_NAMESPACE | 40 } // namespace BASE_HASH_NAMESPACE |
| 42 #endif // COMPILER | 41 #endif // COMPILER |
| 43 | 42 |
| 44 namespace cc { | 43 namespace cc { |
| 45 | 44 |
| 46 class AnimationRegistrar; | 45 class AnimationRegistrar; |
| 47 class HeadsUpDisplayLayer; | 46 class HeadsUpDisplayLayer; |
| 48 class Layer; | 47 class Layer; |
| 49 class LayerTreeHostImpl; | 48 class LayerTreeHostImpl; |
| 50 class LayerTreeHostImplClient; | 49 class LayerTreeHostImplClient; |
| 51 class PrioritizedResourceManager; | 50 class PrioritizedResourceManager; |
| 52 class PrioritizedResource; | 51 class PrioritizedResource; |
| 53 class Region; | 52 class Region; |
| 53 class RenderingStatsInstrumentation; |
| 54 class ResourceProvider; | 54 class ResourceProvider; |
| 55 class ResourceUpdateQueue; | 55 class ResourceUpdateQueue; |
| 56 class TopControlsManager; | 56 class TopControlsManager; |
| 57 struct RenderingStats; |
| 57 struct ScrollAndScaleSet; | 58 struct ScrollAndScaleSet; |
| 58 | 59 |
| 59 // Provides information on an Impl's rendering capabilities back to the | 60 // Provides information on an Impl's rendering capabilities back to the |
| 60 // LayerTreeHost. | 61 // LayerTreeHost. |
| 61 struct CC_EXPORT RendererCapabilities { | 62 struct CC_EXPORT RendererCapabilities { |
| 62 RendererCapabilities(); | 63 RendererCapabilities(); |
| 63 ~RendererCapabilities(); | 64 ~RendererCapabilities(); |
| 64 | 65 |
| 65 unsigned best_texture_format; | 66 unsigned best_texture_format; |
| 66 bool using_partial_swap; | 67 bool using_partial_swap; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 139 |
| 139 void SetDeferCommits(bool defer_commits); | 140 void SetDeferCommits(bool defer_commits); |
| 140 | 141 |
| 141 // Test only hook | 142 // Test only hook |
| 142 virtual void DidDeferCommit(); | 143 virtual void DidDeferCommit(); |
| 143 | 144 |
| 144 int commit_number() const { return commit_number_; } | 145 int commit_number() const { return commit_number_; } |
| 145 | 146 |
| 146 void CollectRenderingStats(RenderingStats* stats) const; | 147 void CollectRenderingStats(RenderingStats* stats) const; |
| 147 | 148 |
| 149 RenderingStatsInstrumentation* rendering_stats_instrumentation() const { |
| 150 return rendering_stats_instrumentation_.get(); |
| 151 } |
| 152 |
| 148 const RendererCapabilities& GetRendererCapabilities() const; | 153 const RendererCapabilities& GetRendererCapabilities() const; |
| 149 | 154 |
| 150 void SetNeedsAnimate(); | 155 void SetNeedsAnimate(); |
| 151 virtual void SetNeedsCommit(); | 156 virtual void SetNeedsCommit(); |
| 152 virtual void SetNeedsFullTreeSync(); | 157 virtual void SetNeedsFullTreeSync(); |
| 153 void SetNeedsRedraw(); | 158 void SetNeedsRedraw(); |
| 154 bool CommitRequested() const; | 159 bool CommitRequested() const; |
| 155 | 160 |
| 156 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, | 161 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, |
| 157 base::Time wall_clock_time); | 162 base::Time wall_clock_time); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 241 |
| 237 private: | 242 private: |
| 238 typedef std::vector<scoped_refptr<Layer> > LayerList; | 243 typedef std::vector<scoped_refptr<Layer> > LayerList; |
| 239 | 244 |
| 240 bool InitializeProxy(scoped_ptr<Proxy> proxy); | 245 bool InitializeProxy(scoped_ptr<Proxy> proxy); |
| 241 void InitializeRenderer(); | 246 void InitializeRenderer(); |
| 242 | 247 |
| 243 bool PaintLayerContents(const LayerList& render_surface_layer_list, | 248 bool PaintLayerContents(const LayerList& render_surface_layer_list, |
| 244 ResourceUpdateQueue* quue); | 249 ResourceUpdateQueue* quue); |
| 245 bool PaintMasksForRenderSurface(Layer* render_surface_layer, | 250 bool PaintMasksForRenderSurface(Layer* render_surface_layer, |
| 246 ResourceUpdateQueue* queue); | 251 ResourceUpdateQueue* queue, |
| 252 RenderingStats* stats); |
| 247 | 253 |
| 248 void UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue); | 254 void UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue); |
| 249 void UpdateHudLayer(); | 255 void UpdateHudLayer(); |
| 250 void TriggerPrepaint(); | 256 void TriggerPrepaint(); |
| 251 | 257 |
| 252 void PrioritizeTextures(const LayerList& render_surface_layer_list, | 258 void PrioritizeTextures(const LayerList& render_surface_layer_list, |
| 253 OverdrawMetrics* metrics); | 259 OverdrawMetrics* metrics); |
| 254 void SetPrioritiesForSurfaces(size_t surface_memory_bytes); | 260 void SetPrioritiesForSurfaces(size_t surface_memory_bytes); |
| 255 void SetPrioritiesForLayers(const LayerList& update_list); | 261 void SetPrioritiesForLayers(const LayerList& update_list); |
| 256 size_t CalculateMemoryForRenderSurfaces(const LayerList& update_list); | 262 size_t CalculateMemoryForRenderSurfaces(const LayerList& update_list); |
| 257 | 263 |
| 258 void AnimateLayers(base::TimeTicks monotonic_time); | 264 void AnimateLayers(base::TimeTicks monotonic_time); |
| 259 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); | 265 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); |
| 260 void SetAnimationEventsRecursive(const AnimationEventsVector& events, | 266 void SetAnimationEventsRecursive(const AnimationEventsVector& events, |
| 261 Layer* layer, | 267 Layer* layer, |
| 262 base::Time wall_clock_time); | 268 base::Time wall_clock_time); |
| 263 | 269 |
| 264 bool animating_; | 270 bool animating_; |
| 265 bool needs_full_tree_sync_; | 271 bool needs_full_tree_sync_; |
| 266 bool needs_filter_context_; | 272 bool needs_filter_context_; |
| 267 | 273 |
| 268 base::CancelableClosure prepaint_callback_; | 274 base::CancelableClosure prepaint_callback_; |
| 269 | 275 |
| 270 LayerTreeHostClient* client_; | 276 LayerTreeHostClient* client_; |
| 271 scoped_ptr<Proxy> proxy_; | 277 scoped_ptr<Proxy> proxy_; |
| 272 | 278 |
| 273 int commit_number_; | 279 int commit_number_; |
| 274 RenderingStats rendering_stats_; | 280 scoped_ptr<RenderingStatsInstrumentation> rendering_stats_instrumentation_; |
| 275 | 281 |
| 276 bool renderer_initialized_; | 282 bool renderer_initialized_; |
| 277 bool output_surface_lost_; | 283 bool output_surface_lost_; |
| 278 int num_failed_recreate_attempts_; | 284 int num_failed_recreate_attempts_; |
| 279 | 285 |
| 280 scoped_refptr<Layer> root_layer_; | 286 scoped_refptr<Layer> root_layer_; |
| 281 scoped_refptr<HeadsUpDisplayLayer> hud_layer_; | 287 scoped_refptr<HeadsUpDisplayLayer> hud_layer_; |
| 282 | 288 |
| 283 scoped_ptr<PrioritizedResourceManager> contents_texture_manager_; | 289 scoped_ptr<PrioritizedResourceManager> contents_texture_manager_; |
| 284 scoped_ptr<PrioritizedResource> surface_memory_placeholder_; | 290 scoped_ptr<PrioritizedResource> surface_memory_placeholder_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 310 size_t partial_texture_update_requests_; | 316 size_t partial_texture_update_requests_; |
| 311 | 317 |
| 312 scoped_ptr<AnimationRegistrar> animation_registrar_; | 318 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 313 | 319 |
| 314 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 320 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 315 }; | 321 }; |
| 316 | 322 |
| 317 } // namespace cc | 323 } // namespace cc |
| 318 | 324 |
| 319 #endif // CC_LAYER_TREE_HOST_H_ | 325 #endif // CC_LAYER_TREE_HOST_H_ |
| OLD | NEW |