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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/containers/hash_tables.h" | |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "cc/animation/animation_events.h" | 15 #include "cc/animation/animation_events.h" |
15 #include "cc/animation/animation_registrar.h" | 16 #include "cc/animation/animation_registrar.h" |
16 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
17 #include "cc/input/input_handler.h" | 18 #include "cc/input/input_handler.h" |
18 #include "cc/input/layer_scroll_offset_delegate.h" | 19 #include "cc/input/layer_scroll_offset_delegate.h" |
19 #include "cc/input/top_controls_manager_client.h" | 20 #include "cc/input/top_controls_manager_client.h" |
20 #include "cc/layers/layer_lists.h" | 21 #include "cc/layers/layer_lists.h" |
21 #include "cc/layers/render_pass_sink.h" | 22 #include "cc/layers/render_pass_sink.h" |
22 #include "cc/output/begin_frame_args.h" | 23 #include "cc/output/begin_frame_args.h" |
23 #include "cc/output/managed_memory_policy.h" | 24 #include "cc/output/managed_memory_policy.h" |
24 #include "cc/output/output_surface_client.h" | 25 #include "cc/output/output_surface_client.h" |
25 #include "cc/output/renderer.h" | 26 #include "cc/output/renderer.h" |
26 #include "cc/quads/render_pass.h" | 27 #include "cc/quads/render_pass.h" |
28 #include "cc/resources/resource_provider.h" | |
27 #include "cc/resources/tile_manager.h" | 29 #include "cc/resources/tile_manager.h" |
30 #include "cc/resources/ui_resource_manager.h" | |
28 #include "skia/ext/refptr.h" | 31 #include "skia/ext/refptr.h" |
29 #include "third_party/skia/include/core/SkColor.h" | 32 #include "third_party/skia/include/core/SkColor.h" |
30 #include "third_party/skia/include/core/SkPicture.h" | 33 #include "third_party/skia/include/core/SkPicture.h" |
31 #include "ui/gfx/rect.h" | 34 #include "ui/gfx/rect.h" |
32 | 35 |
33 namespace cc { | 36 namespace cc { |
34 | 37 |
35 class CompletionEvent; | 38 class CompletionEvent; |
36 class CompositorFrameMetadata; | 39 class CompositorFrameMetadata; |
37 class DebugRectHistory; | 40 class DebugRectHistory; |
38 class FrameRateCounter; | 41 class FrameRateCounter; |
39 class LayerImpl; | 42 class LayerImpl; |
40 class LayerTreeHostImplTimeSourceAdapter; | 43 class LayerTreeHostImplTimeSourceAdapter; |
41 class LayerTreeImpl; | 44 class LayerTreeImpl; |
42 class PageScaleAnimation; | 45 class PageScaleAnimation; |
43 class PaintTimeCounter; | 46 class PaintTimeCounter; |
44 class MemoryHistory; | 47 class MemoryHistory; |
45 class RenderingStatsInstrumentation; | 48 class RenderingStatsInstrumentation; |
46 class RenderPassDrawQuad; | 49 class RenderPassDrawQuad; |
47 class ResourceProvider; | |
48 class TopControlsManager; | 50 class TopControlsManager; |
49 struct RendererCapabilities; | 51 struct RendererCapabilities; |
50 | 52 |
51 // LayerTreeHost->Proxy callback interface. | 53 // LayerTreeHost->Proxy callback interface. |
52 class LayerTreeHostImplClient { | 54 class LayerTreeHostImplClient { |
53 public: | 55 public: |
54 virtual void DidTryInitializeRendererOnImplThread( | 56 virtual void DidTryInitializeRendererOnImplThread( |
55 bool success, | 57 bool success, |
56 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; | 58 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; |
57 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 59 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
(...skipping 12 matching lines...) Expand all Loading... | |
70 virtual bool ReduceContentsTextureMemoryOnImplThread( | 72 virtual bool ReduceContentsTextureMemoryOnImplThread( |
71 size_t limit_bytes, | 73 size_t limit_bytes, |
72 int priority_cutoff) = 0; | 74 int priority_cutoff) = 0; |
73 virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0; | 75 virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0; |
74 virtual void SendManagedMemoryStats() = 0; | 76 virtual void SendManagedMemoryStats() = 0; |
75 virtual bool IsInsideDraw() = 0; | 77 virtual bool IsInsideDraw() = 0; |
76 virtual void RenewTreePriority() = 0; | 78 virtual void RenewTreePriority() = 0; |
77 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; | 79 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; |
78 virtual void DidActivatePendingTree() = 0; | 80 virtual void DidActivatePendingTree() = 0; |
79 | 81 |
82 virtual void UIResourceCreatedOnImplThread(UIResourceId uid) = 0; | |
aelias_OOO_until_Jul13
2013/07/10 23:07:22
"UIResourceReadyOnImplThread" would be a better na
powei
2013/07/11 23:54:44
Done.
| |
83 virtual void UIResourceLostOnImplThread(UIResourceId uid) = 0; | |
84 | |
80 protected: | 85 protected: |
81 virtual ~LayerTreeHostImplClient() {} | 86 virtual ~LayerTreeHostImplClient() {} |
82 }; | 87 }; |
83 | 88 |
84 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 89 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
85 // state. | 90 // state. |
86 class CC_EXPORT LayerTreeHostImpl | 91 class CC_EXPORT LayerTreeHostImpl |
87 : public InputHandler, | 92 : public InputHandler, |
88 public RendererClient, | 93 public RendererClient, |
89 public TileManagerClient, | 94 public TileManagerClient, |
(...skipping 277 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 bool async); | |
aelias_OOO_until_Jul13
2013/07/10 23:07:22
Sorry, I meant to delete this "async" boolean from
powei
2013/07/11 23:54:44
Done.
| |
385 // Deletes a UI resource. May safely be called more than once. | |
386 void DeleteUIResource(UIResourceId uid); | |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 base::TimeTicks time); | 445 base::TimeTicks time); |
434 | 446 |
435 static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer); | 447 static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer); |
436 | 448 |
437 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; | 449 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; |
438 | 450 |
439 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); | 451 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); |
440 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 452 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
441 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 453 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
442 | 454 |
455 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> | |
456 UIResourceMap; | |
457 UIResourceMap ui_resource_map_; | |
458 | |
443 scoped_ptr<OutputSurface> output_surface_; | 459 scoped_ptr<OutputSurface> output_surface_; |
444 | 460 |
445 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- | 461 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- |
446 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). | 462 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). |
447 scoped_ptr<ResourceProvider> resource_provider_; | 463 scoped_ptr<ResourceProvider> resource_provider_; |
448 scoped_ptr<TileManager> tile_manager_; | 464 scoped_ptr<TileManager> tile_manager_; |
449 scoped_ptr<Renderer> renderer_; | 465 scoped_ptr<Renderer> renderer_; |
450 | 466 |
451 // Tree currently being drawn. | 467 // Tree currently being drawn. |
452 scoped_ptr<LayerTreeImpl> active_tree_; | 468 scoped_ptr<LayerTreeImpl> active_tree_; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
532 scoped_ptr<AnimationRegistrar> animation_registrar_; | 548 scoped_ptr<AnimationRegistrar> animation_registrar_; |
533 | 549 |
534 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 550 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
535 | 551 |
536 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 552 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
537 }; | 553 }; |
538 | 554 |
539 } // namespace cc | 555 } // namespace cc |
540 | 556 |
541 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 557 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |