OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SURFACES_SURFACE_AGGREGATOR_H_ | 5 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_ |
6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_ | 6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <set> | 9 #include <set> |
9 #include <unordered_map> | 10 #include <unordered_map> |
10 #include <unordered_set> | 11 #include <unordered_set> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "cc/quads/draw_quad.h" | 15 #include "cc/quads/draw_quad.h" |
16 #include "cc/quads/render_pass.h" | 16 #include "cc/quads/render_pass.h" |
17 #include "cc/resources/transferable_resource.h" | 17 #include "cc/resources/transferable_resource.h" |
18 #include "cc/surfaces/surface_id.h" | 18 #include "cc/surfaces/surface_id.h" |
19 #include "cc/surfaces/surfaces_export.h" | 19 #include "cc/surfaces/surfaces_export.h" |
20 | 20 |
21 namespace cc { | 21 namespace cc { |
22 | 22 |
23 class CompositorFrame; | 23 class CompositorFrame; |
24 class DelegatedFrameData; | 24 class DelegatedFrameData; |
25 class ResourceProvider; | 25 class ResourceProvider; |
26 class Surface; | 26 class Surface; |
27 class SurfaceDrawQuad; | 27 class SurfaceDrawQuad; |
28 class SurfaceManager; | 28 class SurfaceManager; |
29 | 29 |
30 class CC_SURFACES_EXPORT SurfaceAggregator { | 30 class CC_SURFACES_EXPORT SurfaceAggregator { |
31 public: | 31 public: |
32 using SurfaceIndexMap = std::unordered_map<SurfaceId, int, SurfaceIdHash>; | 32 using SurfaceIndexMap = std::unordered_map<SurfaceId, int, SurfaceIdHash>; |
33 | 33 |
34 SurfaceAggregator(SurfaceManager* manager, | 34 SurfaceAggregator(SurfaceManager* manager, |
35 ResourceProvider* provider, | 35 ResourceProvider* provider, |
36 bool aggregate_only_damaged); | 36 bool aggregate_only_damaged); |
37 ~SurfaceAggregator(); | 37 ~SurfaceAggregator(); |
38 | 38 |
39 scoped_ptr<CompositorFrame> Aggregate(SurfaceId surface_id); | 39 std::unique_ptr<CompositorFrame> Aggregate(SurfaceId surface_id); |
40 void ReleaseResources(SurfaceId surface_id); | 40 void ReleaseResources(SurfaceId surface_id); |
41 SurfaceIndexMap& previous_contained_surfaces() { | 41 SurfaceIndexMap& previous_contained_surfaces() { |
42 return previous_contained_surfaces_; | 42 return previous_contained_surfaces_; |
43 } | 43 } |
44 void SetFullDamageForSurface(SurfaceId surface_id); | 44 void SetFullDamageForSurface(SurfaceId surface_id); |
45 | 45 |
46 private: | 46 private: |
47 struct ClipData { | 47 struct ClipData { |
48 ClipData() : is_clipped(false) {} | 48 ClipData() : is_clipped(false) {} |
49 ClipData(bool is_clipped, const gfx::Rect& rect) | 49 ClipData(bool is_clipped, const gfx::Rect& rect) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 gfx::Rect DamageRectForSurface(const Surface* surface, | 99 gfx::Rect DamageRectForSurface(const Surface* surface, |
100 const RenderPass& source, | 100 const RenderPass& source, |
101 const gfx::Rect& full_rect) const; | 101 const gfx::Rect& full_rect) const; |
102 | 102 |
103 SurfaceManager* manager_; | 103 SurfaceManager* manager_; |
104 ResourceProvider* provider_; | 104 ResourceProvider* provider_; |
105 | 105 |
106 class RenderPassIdAllocator; | 106 class RenderPassIdAllocator; |
107 using RenderPassIdAllocatorMap = | 107 using RenderPassIdAllocatorMap = |
108 std::unordered_map<SurfaceId, | 108 std::unordered_map<SurfaceId, |
109 scoped_ptr<RenderPassIdAllocator>, | 109 std::unique_ptr<RenderPassIdAllocator>, |
110 SurfaceIdHash>; | 110 SurfaceIdHash>; |
111 RenderPassIdAllocatorMap render_pass_allocator_map_; | 111 RenderPassIdAllocatorMap render_pass_allocator_map_; |
112 int next_render_pass_id_; | 112 int next_render_pass_id_; |
113 const bool aggregate_only_damaged_; | 113 const bool aggregate_only_damaged_; |
114 | 114 |
115 using SurfaceToResourceChildIdMap = | 115 using SurfaceToResourceChildIdMap = |
116 std::unordered_map<SurfaceId, int, SurfaceIdHash>; | 116 std::unordered_map<SurfaceId, int, SurfaceIdHash>; |
117 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; | 117 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; |
118 | 118 |
119 // The following state is only valid for the duration of one Aggregate call | 119 // The following state is only valid for the duration of one Aggregate call |
(...skipping 27 matching lines...) Expand all Loading... |
147 TransferableResourceArray* dest_resource_list_; | 147 TransferableResourceArray* dest_resource_list_; |
148 | 148 |
149 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; | 149 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); | 151 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); |
152 }; | 152 }; |
153 | 153 |
154 } // namespace cc | 154 } // namespace cc |
155 | 155 |
156 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ | 156 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ |
OLD | NEW |