Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: cc/trees/layer_tree_host_impl.h

Issue 18191020: UI Resource Manager (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "cc/animation/animation_events.h" 14 #include "cc/animation/animation_events.h"
15 #include "cc/animation/animation_registrar.h" 15 #include "cc/animation/animation_registrar.h"
16 #include "cc/base/cc_export.h" 16 #include "cc/base/cc_export.h"
17 #include "cc/input/input_handler.h" 17 #include "cc/input/input_handler.h"
18 #include "cc/input/layer_scroll_offset_delegate.h" 18 #include "cc/input/layer_scroll_offset_delegate.h"
19 #include "cc/input/top_controls_manager_client.h" 19 #include "cc/input/top_controls_manager_client.h"
20 #include "cc/layers/layer_lists.h" 20 #include "cc/layers/layer_lists.h"
21 #include "cc/layers/render_pass_sink.h" 21 #include "cc/layers/render_pass_sink.h"
22 #include "cc/output/begin_frame_args.h" 22 #include "cc/output/begin_frame_args.h"
23 #include "cc/output/managed_memory_policy.h" 23 #include "cc/output/managed_memory_policy.h"
24 #include "cc/output/output_surface_client.h" 24 #include "cc/output/output_surface_client.h"
25 #include "cc/output/renderer.h" 25 #include "cc/output/renderer.h"
26 #include "cc/quads/render_pass.h" 26 #include "cc/quads/render_pass.h"
27 #include "cc/resources/resource_provider.h"
27 #include "cc/resources/tile_manager.h" 28 #include "cc/resources/tile_manager.h"
29 #include "cc/resources/ui_resource_manager.h"
28 #include "skia/ext/refptr.h" 30 #include "skia/ext/refptr.h"
29 #include "third_party/skia/include/core/SkColor.h" 31 #include "third_party/skia/include/core/SkColor.h"
30 #include "third_party/skia/include/core/SkPicture.h" 32 #include "third_party/skia/include/core/SkPicture.h"
31 #include "ui/gfx/rect.h" 33 #include "ui/gfx/rect.h"
32 34
33 namespace cc { 35 namespace cc {
34 36
35 class CompletionEvent; 37 class CompletionEvent;
36 class CompositorFrameMetadata; 38 class CompositorFrameMetadata;
37 class DebugRectHistory; 39 class DebugRectHistory;
38 class FrameRateCounter; 40 class FrameRateCounter;
39 class LayerImpl; 41 class LayerImpl;
40 class LayerTreeHostImplTimeSourceAdapter; 42 class LayerTreeHostImplTimeSourceAdapter;
41 class LayerTreeImpl; 43 class LayerTreeImpl;
42 class PageScaleAnimation; 44 class PageScaleAnimation;
43 class PaintTimeCounter; 45 class PaintTimeCounter;
44 class MemoryHistory; 46 class MemoryHistory;
45 class RenderingStatsInstrumentation; 47 class RenderingStatsInstrumentation;
46 class RenderPassDrawQuad; 48 class RenderPassDrawQuad;
47 class ResourceProvider;
48 class TopControlsManager; 49 class TopControlsManager;
49 struct RendererCapabilities; 50 struct RendererCapabilities;
50 51
51 // LayerTreeHost->Proxy callback interface. 52 // LayerTreeHost->Proxy callback interface.
52 class LayerTreeHostImplClient { 53 class LayerTreeHostImplClient {
53 public: 54 public:
54 virtual void DidTryInitializeRendererOnImplThread( 55 virtual void DidTryInitializeRendererOnImplThread(
55 bool success, 56 bool success,
56 scoped_refptr<ContextProvider> offscreen_context_provider) = 0; 57 scoped_refptr<ContextProvider> offscreen_context_provider) = 0;
57 virtual void DidLoseOutputSurfaceOnImplThread() = 0; 58 virtual void DidLoseOutputSurfaceOnImplThread() = 0;
(...skipping 12 matching lines...) Expand all
70 virtual bool ReduceContentsTextureMemoryOnImplThread( 71 virtual bool ReduceContentsTextureMemoryOnImplThread(
71 size_t limit_bytes, 72 size_t limit_bytes,
72 int priority_cutoff) = 0; 73 int priority_cutoff) = 0;
73 virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0; 74 virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0;
74 virtual void SendManagedMemoryStats() = 0; 75 virtual void SendManagedMemoryStats() = 0;
75 virtual bool IsInsideDraw() = 0; 76 virtual bool IsInsideDraw() = 0;
76 virtual void RenewTreePriority() = 0; 77 virtual void RenewTreePriority() = 0;
77 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0; 78 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0;
78 virtual void DidActivatePendingTree() = 0; 79 virtual void DidActivatePendingTree() = 0;
79 80
81 virtual void UIResourceCreatedOnImplThread(UIResourceId uid) = 0;
82 virtual void UIResourceLostOnImplThread(UIResourceId uid) = 0;
83
80 protected: 84 protected:
81 virtual ~LayerTreeHostImplClient() {} 85 virtual ~LayerTreeHostImplClient() {}
82 }; 86 };
83 87
84 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering 88 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
85 // state. 89 // state.
86 class CC_EXPORT LayerTreeHostImpl 90 class CC_EXPORT LayerTreeHostImpl
87 : public InputHandler, 91 : public InputHandler,
88 public RendererClient, 92 public RendererClient,
89 public TileManagerClient, 93 public TileManagerClient,
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 base::TimeTicks CurrentFrameTimeTicks(); 371 base::TimeTicks CurrentFrameTimeTicks();
368 base::Time CurrentFrameTime(); 372 base::Time CurrentFrameTime();
369 373
370 virtual base::TimeTicks CurrentPhysicalTimeTicks() const; 374 virtual base::TimeTicks CurrentPhysicalTimeTicks() const;
371 375
372 scoped_ptr<base::Value> AsValue() const; 376 scoped_ptr<base::Value> AsValue() const;
373 scoped_ptr<base::Value> ActivationStateAsValue() const; 377 scoped_ptr<base::Value> ActivationStateAsValue() const;
374 378
375 bool page_scale_animation_active() const { return !!page_scale_animation_; } 379 bool page_scale_animation_active() const { return !!page_scale_animation_; }
376 380
381 void CreateUIResource(UIResourceId uid,
382 scoped_refptr<UIResourceBitmap> bitmap,
383 bool async);
384 // Deletes a UI resource. May safely be called more than once.
385 void DeleteUIResource(UIResourceId uid);
386 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const;
387
377 protected: 388 protected:
378 LayerTreeHostImpl( 389 LayerTreeHostImpl(
379 const LayerTreeSettings& settings, 390 const LayerTreeSettings& settings,
380 LayerTreeHostImplClient* client, 391 LayerTreeHostImplClient* client,
381 Proxy* proxy, 392 Proxy* proxy,
382 RenderingStatsInstrumentation* rendering_stats_instrumentation); 393 RenderingStatsInstrumentation* rendering_stats_instrumentation);
383 virtual void ActivatePendingTree(); 394 virtual void ActivatePendingTree();
384 395
385 // Virtual for testing. 396 // Virtual for testing.
386 virtual void AnimateLayers(base::TimeTicks monotonic_time, 397 virtual void AnimateLayers(base::TimeTicks monotonic_time,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 base::TimeTicks time); 444 base::TimeTicks time);
434 445
435 static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer); 446 static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer);
436 447
437 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; 448 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const;
438 449
439 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); 450 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time);
440 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); 451 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy);
441 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); 452 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy);
442 453
454 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId>
455 UIResourceMap;
456 UIResourceMap ui_resource_map_;
457
443 scoped_ptr<OutputSurface> output_surface_; 458 scoped_ptr<OutputSurface> output_surface_;
444 459
445 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- 460 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile-
446 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). 461 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice().
447 scoped_ptr<ResourceProvider> resource_provider_; 462 scoped_ptr<ResourceProvider> resource_provider_;
448 scoped_ptr<TileManager> tile_manager_; 463 scoped_ptr<TileManager> tile_manager_;
449 scoped_ptr<Renderer> renderer_; 464 scoped_ptr<Renderer> renderer_;
450 465
451 // Tree currently being drawn. 466 // Tree currently being drawn.
452 scoped_ptr<LayerTreeImpl> active_tree_; 467 scoped_ptr<LayerTreeImpl> active_tree_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 scoped_ptr<AnimationRegistrar> animation_registrar_; 547 scoped_ptr<AnimationRegistrar> animation_registrar_;
533 548
534 RenderingStatsInstrumentation* rendering_stats_instrumentation_; 549 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
535 550
536 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 551 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
537 }; 552 };
538 553
539 } // namespace cc 554 } // namespace cc
540 555
541 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ 556 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698