| 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_TREES_LAYER_TREE_HOST_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/containers/hash_tables.h" |
| 12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 14 #include "cc/animation/animation_events.h" | 16 #include "cc/animation/animation_events.h" |
| 15 #include "cc/animation/animation_registrar.h" | 17 #include "cc/animation/animation_registrar.h" |
| 16 #include "cc/base/cc_export.h" | 18 #include "cc/base/cc_export.h" |
| 17 #include "cc/input/input_handler.h" | 19 #include "cc/input/input_handler.h" |
| 18 #include "cc/input/layer_scroll_offset_delegate.h" | 20 #include "cc/input/layer_scroll_offset_delegate.h" |
| 19 #include "cc/input/top_controls_manager_client.h" | 21 #include "cc/input/top_controls_manager_client.h" |
| 20 #include "cc/layers/layer_lists.h" | 22 #include "cc/layers/layer_lists.h" |
| 21 #include "cc/layers/render_pass_sink.h" | 23 #include "cc/layers/render_pass_sink.h" |
| 22 #include "cc/output/begin_frame_args.h" | 24 #include "cc/output/begin_frame_args.h" |
| 23 #include "cc/output/managed_memory_policy.h" | 25 #include "cc/output/managed_memory_policy.h" |
| 24 #include "cc/output/output_surface_client.h" | 26 #include "cc/output/output_surface_client.h" |
| 25 #include "cc/output/renderer.h" | 27 #include "cc/output/renderer.h" |
| 26 #include "cc/quads/render_pass.h" | 28 #include "cc/quads/render_pass.h" |
| 29 #include "cc/resources/resource_provider.h" |
| 27 #include "cc/resources/tile_manager.h" | 30 #include "cc/resources/tile_manager.h" |
| 31 #include "skia/ext/refptr.h" |
| 28 #include "third_party/skia/include/core/SkColor.h" | 32 #include "third_party/skia/include/core/SkColor.h" |
| 29 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
| 30 | 34 |
| 31 namespace cc { | 35 namespace cc { |
| 32 | 36 |
| 33 class CompletionEvent; | 37 class CompletionEvent; |
| 34 class CompositorFrameMetadata; | 38 class CompositorFrameMetadata; |
| 35 class DebugRectHistory; | 39 class DebugRectHistory; |
| 36 class FrameRateCounter; | 40 class FrameRateCounter; |
| 37 class LayerImpl; | 41 class LayerImpl; |
| 38 class LayerTreeHostImplTimeSourceAdapter; | 42 class LayerTreeHostImplTimeSourceAdapter; |
| 39 class LayerTreeImpl; | 43 class LayerTreeImpl; |
| 40 class PageScaleAnimation; | 44 class PageScaleAnimation; |
| 41 class PaintTimeCounter; | 45 class PaintTimeCounter; |
| 42 class MemoryHistory; | 46 class MemoryHistory; |
| 43 class RenderingStatsInstrumentation; | 47 class RenderingStatsInstrumentation; |
| 44 class RenderPassDrawQuad; | 48 class RenderPassDrawQuad; |
| 45 class ResourceProvider; | |
| 46 class TopControlsManager; | 49 class TopControlsManager; |
| 50 class UIResourceBitmap; |
| 47 struct RendererCapabilities; | 51 struct RendererCapabilities; |
| 52 struct UIResourceRequest; |
| 48 | 53 |
| 49 // LayerTreeHost->Proxy callback interface. | 54 // LayerTreeHost->Proxy callback interface. |
| 50 class LayerTreeHostImplClient { | 55 class LayerTreeHostImplClient { |
| 51 public: | 56 public: |
| 52 virtual void DidTryInitializeRendererOnImplThread( | 57 virtual void DidTryInitializeRendererOnImplThread( |
| 53 bool success, | 58 bool success, |
| 54 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; | 59 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; |
| 55 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 60 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
| 56 virtual void OnSwapBuffersCompleteOnImplThread() = 0; | 61 virtual void OnSwapBuffersCompleteOnImplThread() = 0; |
| 57 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) = 0; | 62 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) = 0; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 base::TimeTicks CurrentFrameTimeTicks(); | 372 base::TimeTicks CurrentFrameTimeTicks(); |
| 368 base::Time CurrentFrameTime(); | 373 base::Time CurrentFrameTime(); |
| 369 | 374 |
| 370 virtual base::TimeTicks CurrentPhysicalTimeTicks() const; | 375 virtual base::TimeTicks CurrentPhysicalTimeTicks() const; |
| 371 | 376 |
| 372 scoped_ptr<base::Value> AsValue() const; | 377 scoped_ptr<base::Value> AsValue() const; |
| 373 scoped_ptr<base::Value> ActivationStateAsValue() const; | 378 scoped_ptr<base::Value> ActivationStateAsValue() const; |
| 374 | 379 |
| 375 bool page_scale_animation_active() const { return !!page_scale_animation_; } | 380 bool page_scale_animation_active() const { return !!page_scale_animation_; } |
| 376 | 381 |
| 382 void CreateUIResource(UIResourceId uid, |
| 383 scoped_refptr<UIResourceBitmap> bitmap); |
| 384 // Deletes a UI resource. May safely be called more than once. |
| 385 void DeleteUIResource(UIResourceId uid); |
| 386 |
| 387 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; |
| 388 |
| 377 protected: | 389 protected: |
| 378 LayerTreeHostImpl( | 390 LayerTreeHostImpl( |
| 379 const LayerTreeSettings& settings, | 391 const LayerTreeSettings& settings, |
| 380 LayerTreeHostImplClient* client, | 392 LayerTreeHostImplClient* client, |
| 381 Proxy* proxy, | 393 Proxy* proxy, |
| 382 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 394 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
| 383 virtual void ActivatePendingTree(); | 395 virtual void ActivatePendingTree(); |
| 384 | 396 |
| 385 // Virtual for testing. | 397 // Virtual for testing. |
| 386 virtual void AnimateLayers(base::TimeTicks monotonic_time, | 398 virtual void AnimateLayers(base::TimeTicks monotonic_time, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 base::TimeTicks time); | 448 base::TimeTicks time); |
| 437 | 449 |
| 438 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; | 450 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; |
| 439 | 451 |
| 440 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); | 452 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); |
| 441 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 453 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
| 442 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 454 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
| 443 | 455 |
| 444 void DidInitializeVisibleTile(); | 456 void DidInitializeVisibleTile(); |
| 445 | 457 |
| 458 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> |
| 459 UIResourceMap; |
| 460 UIResourceMap ui_resource_map_; |
| 461 |
| 446 scoped_ptr<OutputSurface> output_surface_; | 462 scoped_ptr<OutputSurface> output_surface_; |
| 447 | 463 |
| 448 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- | 464 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- |
| 449 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). | 465 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). |
| 450 scoped_ptr<ResourceProvider> resource_provider_; | 466 scoped_ptr<ResourceProvider> resource_provider_; |
| 451 scoped_ptr<TileManager> tile_manager_; | 467 scoped_ptr<TileManager> tile_manager_; |
| 452 scoped_ptr<Renderer> renderer_; | 468 scoped_ptr<Renderer> renderer_; |
| 453 | 469 |
| 454 // Tree currently being drawn. | 470 // Tree currently being drawn. |
| 455 scoped_ptr<LayerTreeImpl> active_tree_; | 471 scoped_ptr<LayerTreeImpl> active_tree_; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 557 |
| 542 // Optional callback to notify of new tree activations. | 558 // Optional callback to notify of new tree activations. |
| 543 base::Closure tree_activation_callback_; | 559 base::Closure tree_activation_callback_; |
| 544 | 560 |
| 545 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 561 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 546 }; | 562 }; |
| 547 | 563 |
| 548 } // namespace cc | 564 } // namespace cc |
| 549 | 565 |
| 550 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 566 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |