| 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 <map> |
| 8 #include <memory> | 9 #include <memory> |
| 9 #include <set> | 10 #include <set> |
| 10 #include <unordered_map> | 11 #include <unordered_map> |
| 11 #include <unordered_set> | 12 #include <unordered_set> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 15 #include "cc/quads/draw_quad.h" | 16 #include "cc/quads/draw_quad.h" |
| 16 #include "cc/quads/render_pass.h" | 17 #include "cc/quads/render_pass.h" |
| 17 #include "cc/resources/transferable_resource.h" | 18 #include "cc/resources/transferable_resource.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 56 |
| 56 struct PrewalkResult { | 57 struct PrewalkResult { |
| 57 PrewalkResult(); | 58 PrewalkResult(); |
| 58 ~PrewalkResult(); | 59 ~PrewalkResult(); |
| 59 // This is the set of Surfaces that were referenced by another Surface, but | 60 // This is the set of Surfaces that were referenced by another Surface, but |
| 60 // not included in a SurfaceDrawQuad. | 61 // not included in a SurfaceDrawQuad. |
| 61 std::set<SurfaceId> undrawn_surfaces; | 62 std::set<SurfaceId> undrawn_surfaces; |
| 62 bool may_contain_video = false; | 63 bool may_contain_video = false; |
| 63 }; | 64 }; |
| 64 | 65 |
| 66 struct RenderPassInfo { |
| 67 // This is the id the pass is mapped to. |
| 68 RenderPassId id; |
| 69 // This is true if the pass was used in the last aggregated frame. |
| 70 bool in_use = true; |
| 71 }; |
| 72 |
| 65 ClipData CalculateClipRect(const ClipData& surface_clip, | 73 ClipData CalculateClipRect(const ClipData& surface_clip, |
| 66 const ClipData& quad_clip, | 74 const ClipData& quad_clip, |
| 67 const gfx::Transform& target_transform); | 75 const gfx::Transform& target_transform); |
| 68 | 76 |
| 69 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, | 77 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, |
| 70 const SurfaceId& surface_id); | 78 const SurfaceId& surface_id); |
| 71 | 79 |
| 72 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, | 80 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, |
| 73 const gfx::Transform& target_transform, | 81 const gfx::Transform& target_transform, |
| 74 const ClipData& clip_rect, | 82 const ClipData& clip_rect, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 101 void PropagateCopyRequestPasses(); | 109 void PropagateCopyRequestPasses(); |
| 102 | 110 |
| 103 int ChildIdForSurface(Surface* surface); | 111 int ChildIdForSurface(Surface* surface); |
| 104 gfx::Rect DamageRectForSurface(const Surface* surface, | 112 gfx::Rect DamageRectForSurface(const Surface* surface, |
| 105 const RenderPass& source, | 113 const RenderPass& source, |
| 106 const gfx::Rect& full_rect) const; | 114 const gfx::Rect& full_rect) const; |
| 107 | 115 |
| 108 SurfaceManager* manager_; | 116 SurfaceManager* manager_; |
| 109 ResourceProvider* provider_; | 117 ResourceProvider* provider_; |
| 110 | 118 |
| 111 class RenderPassIdAllocator; | 119 // Every Surface has its own RenderPass ID namespace. This structure maps |
| 120 // each source RenderPassID to a unified ID namespace that's used in the |
| 121 // aggregated frame. An entry is removed from the map if it's not used |
| 122 // for one output frame. |
| 112 using RenderPassIdAllocatorMap = | 123 using RenderPassIdAllocatorMap = |
| 113 std::unordered_map<SurfaceId, | 124 std::map<std::pair<SurfaceId, RenderPassId>, RenderPassInfo>; |
| 114 std::unique_ptr<RenderPassIdAllocator>, | |
| 115 SurfaceIdHash>; | |
| 116 RenderPassIdAllocatorMap render_pass_allocator_map_; | 125 RenderPassIdAllocatorMap render_pass_allocator_map_; |
| 117 int next_render_pass_id_; | 126 int next_render_pass_id_; |
| 118 const bool aggregate_only_damaged_; | 127 const bool aggregate_only_damaged_; |
| 119 bool output_is_secure_; | 128 bool output_is_secure_; |
| 120 | 129 |
| 121 using SurfaceToResourceChildIdMap = | 130 using SurfaceToResourceChildIdMap = |
| 122 std::unordered_map<SurfaceId, int, SurfaceIdHash>; | 131 std::unordered_map<SurfaceId, int, SurfaceIdHash>; |
| 123 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; | 132 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; |
| 124 | 133 |
| 125 // The following state is only valid for the duration of one Aggregate call | 134 // The following state is only valid for the duration of one Aggregate call |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 TransferableResourceArray* dest_resource_list_; | 177 TransferableResourceArray* dest_resource_list_; |
| 169 | 178 |
| 170 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; | 179 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; |
| 171 | 180 |
| 172 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); | 181 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); |
| 173 }; | 182 }; |
| 174 | 183 |
| 175 } // namespace cc | 184 } // namespace cc |
| 176 | 185 |
| 177 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ | 186 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ |
| OLD | NEW |