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 "cc/resources/ui_resource_manager_client.h" | |
28 #include "skia/ext/refptr.h" | 32 #include "skia/ext/refptr.h" |
29 #include "third_party/skia/include/core/SkColor.h" | 33 #include "third_party/skia/include/core/SkColor.h" |
30 #include "third_party/skia/include/core/SkPicture.h" | 34 #include "third_party/skia/include/core/SkPicture.h" |
31 #include "ui/gfx/rect.h" | 35 #include "ui/gfx/rect.h" |
32 | 36 |
33 namespace cc { | 37 namespace cc { |
34 | 38 |
35 class CompletionEvent; | 39 class CompletionEvent; |
36 class CompositorFrameMetadata; | 40 class CompositorFrameMetadata; |
37 class DebugRectHistory; | 41 class DebugRectHistory; |
38 class FrameRateCounter; | 42 class FrameRateCounter; |
39 class LayerImpl; | 43 class LayerImpl; |
40 class LayerTreeHostImplTimeSourceAdapter; | 44 class LayerTreeHostImplTimeSourceAdapter; |
41 class LayerTreeImpl; | 45 class LayerTreeImpl; |
42 class PageScaleAnimation; | 46 class PageScaleAnimation; |
43 class PaintTimeCounter; | 47 class PaintTimeCounter; |
44 class MemoryHistory; | 48 class MemoryHistory; |
45 class RenderingStatsInstrumentation; | 49 class RenderingStatsInstrumentation; |
46 class RenderPassDrawQuad; | 50 class RenderPassDrawQuad; |
47 class ResourceProvider; | |
48 class TopControlsManager; | 51 class TopControlsManager; |
52 class UIResourceBitmap; | |
49 struct RendererCapabilities; | 53 struct RendererCapabilities; |
54 struct UIResourceRequest; | |
50 | 55 |
51 // LayerTreeHost->Proxy callback interface. | 56 // LayerTreeHost->Proxy callback interface. |
52 class LayerTreeHostImplClient { | 57 class LayerTreeHostImplClient { |
53 public: | 58 public: |
54 virtual void DidTryInitializeRendererOnImplThread( | 59 virtual void DidTryInitializeRendererOnImplThread( |
55 bool success, | 60 bool success, |
56 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; | 61 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; |
57 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 62 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
58 virtual void OnSwapBuffersCompleteOnImplThread() = 0; | 63 virtual void OnSwapBuffersCompleteOnImplThread() = 0; |
59 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) = 0; | 64 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) = 0; |
(...skipping 10 matching lines...) Expand all Loading... | |
70 virtual bool ReduceContentsTextureMemoryOnImplThread( | 75 virtual bool ReduceContentsTextureMemoryOnImplThread( |
71 size_t limit_bytes, | 76 size_t limit_bytes, |
72 int priority_cutoff) = 0; | 77 int priority_cutoff) = 0; |
73 virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0; | 78 virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0; |
74 virtual void SendManagedMemoryStats() = 0; | 79 virtual void SendManagedMemoryStats() = 0; |
75 virtual bool IsInsideDraw() = 0; | 80 virtual bool IsInsideDraw() = 0; |
76 virtual void RenewTreePriority() = 0; | 81 virtual void RenewTreePriority() = 0; |
77 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; | 82 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; |
78 virtual void DidActivatePendingTree() = 0; | 83 virtual void DidActivatePendingTree() = 0; |
79 | 84 |
85 virtual void UIResourceLostOnImplThread(UIResourceId uid) = 0; | |
86 | |
80 protected: | 87 protected: |
81 virtual ~LayerTreeHostImplClient() {} | 88 virtual ~LayerTreeHostImplClient() {} |
82 }; | 89 }; |
83 | 90 |
84 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 91 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
85 // state. | 92 // state. |
86 class CC_EXPORT LayerTreeHostImpl | 93 class CC_EXPORT LayerTreeHostImpl |
87 : public InputHandler, | 94 : public InputHandler, |
88 public RendererClient, | 95 public RendererClient, |
89 public TileManagerClient, | 96 public TileManagerClient, |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 base::TimeTicks CurrentFrameTimeTicks(); | 374 base::TimeTicks CurrentFrameTimeTicks(); |
368 base::Time CurrentFrameTime(); | 375 base::Time CurrentFrameTime(); |
369 | 376 |
370 virtual base::TimeTicks CurrentPhysicalTimeTicks() const; | 377 virtual base::TimeTicks CurrentPhysicalTimeTicks() const; |
371 | 378 |
372 scoped_ptr<base::Value> AsValue() const; | 379 scoped_ptr<base::Value> AsValue() const; |
373 scoped_ptr<base::Value> ActivationStateAsValue() const; | 380 scoped_ptr<base::Value> ActivationStateAsValue() const; |
374 | 381 |
375 bool page_scale_animation_active() const { return !!page_scale_animation_; } | 382 bool page_scale_animation_active() const { return !!page_scale_animation_; } |
376 | 383 |
384 void CreateUIResource(UIResourceId uid, | |
385 scoped_refptr<UIResourceBitmap> bitmap); | |
386 // Deletes a UI resource. May safely be called more than once. | |
387 void DeleteUIResource(UIResourceId uid); | |
388 | |
389 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; | |
390 | |
391 typedef std::list<UIResourceRequest> UIResourceRequestQueue; | |
392 void set_ui_resource_request_queue(const UIResourceRequestQueue& queue) { | |
393 ui_resource_request_queue_ = queue; | |
394 } | |
395 | |
377 protected: | 396 protected: |
378 LayerTreeHostImpl( | 397 LayerTreeHostImpl( |
379 const LayerTreeSettings& settings, | 398 const LayerTreeSettings& settings, |
380 LayerTreeHostImplClient* client, | 399 LayerTreeHostImplClient* client, |
381 Proxy* proxy, | 400 Proxy* proxy, |
382 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 401 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
383 virtual void ActivatePendingTree(); | 402 virtual void ActivatePendingTree(); |
384 | 403 |
385 // Virtual for testing. | 404 // Virtual for testing. |
386 virtual void AnimateLayers(base::TimeTicks monotonic_time, | 405 virtual void AnimateLayers(base::TimeTicks monotonic_time, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 base::TimeTicks time); | 452 base::TimeTicks time); |
434 | 453 |
435 static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer); | 454 static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer); |
436 | 455 |
437 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; | 456 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; |
438 | 457 |
439 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); | 458 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); |
440 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 459 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
441 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); | 460 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
442 | 461 |
462 UIResourceRequestQueue ui_resource_request_queue_; | |
aelias_OOO_until_Jul13
2013/07/23 00:06:48
This should live on the layer_tree_impl, since it'
powei
2013/07/24 02:28:29
Done.
| |
463 | |
464 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> | |
465 UIResourceMap; | |
enne (OOO)
2013/07/22 23:09:15
style nit: weird indentation.
powei
2013/07/24 02:28:29
Done.
| |
466 UIResourceMap ui_resource_map_; | |
467 | |
443 scoped_ptr<OutputSurface> output_surface_; | 468 scoped_ptr<OutputSurface> output_surface_; |
444 | 469 |
445 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- | 470 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- |
446 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). | 471 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). |
447 scoped_ptr<ResourceProvider> resource_provider_; | 472 scoped_ptr<ResourceProvider> resource_provider_; |
448 scoped_ptr<TileManager> tile_manager_; | 473 scoped_ptr<TileManager> tile_manager_; |
449 scoped_ptr<Renderer> renderer_; | 474 scoped_ptr<Renderer> renderer_; |
450 | 475 |
451 // Tree currently being drawn. | 476 // Tree currently being drawn. |
452 scoped_ptr<LayerTreeImpl> active_tree_; | 477 scoped_ptr<LayerTreeImpl> active_tree_; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
532 scoped_ptr<AnimationRegistrar> animation_registrar_; | 557 scoped_ptr<AnimationRegistrar> animation_registrar_; |
533 | 558 |
534 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 559 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
535 | 560 |
536 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 561 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
537 }; | 562 }; |
538 | 563 |
539 } // namespace cc | 564 } // namespace cc |
540 | 565 |
541 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 566 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |