| 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 <set> | 8 #include <set> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| 11 | 11 |
| 12 #include "base/containers/hash_tables.h" | |
| 13 #include "base/containers/scoped_ptr_hash_map.h" | |
| 14 #include "base/macros.h" | 12 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 16 #include "cc/quads/draw_quad.h" | 14 #include "cc/quads/draw_quad.h" |
| 17 #include "cc/quads/render_pass.h" | 15 #include "cc/quads/render_pass.h" |
| 18 #include "cc/resources/transferable_resource.h" | 16 #include "cc/resources/transferable_resource.h" |
| 19 #include "cc/surfaces/surface_id.h" | 17 #include "cc/surfaces/surface_id.h" |
| 20 #include "cc/surfaces/surfaces_export.h" | 18 #include "cc/surfaces/surfaces_export.h" |
| 21 | 19 |
| 22 namespace cc { | 20 namespace cc { |
| 23 | 21 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const gfx::Transform& target_transform, | 81 const gfx::Transform& target_transform, |
| 84 const ClipData& clip_rect, | 82 const ClipData& clip_rect, |
| 85 RenderPass* dest_pass); | 83 RenderPass* dest_pass); |
| 86 SharedQuadState* CopySharedQuadState(const SharedQuadState* source_sqs, | 84 SharedQuadState* CopySharedQuadState(const SharedQuadState* source_sqs, |
| 87 const gfx::Transform& target_transform, | 85 const gfx::Transform& target_transform, |
| 88 const ClipData& clip_rect, | 86 const ClipData& clip_rect, |
| 89 RenderPass* dest_render_pass); | 87 RenderPass* dest_render_pass); |
| 90 void CopyQuadsToPass( | 88 void CopyQuadsToPass( |
| 91 const QuadList& source_quad_list, | 89 const QuadList& source_quad_list, |
| 92 const SharedQuadStateList& source_shared_quad_state_list, | 90 const SharedQuadStateList& source_shared_quad_state_list, |
| 93 const base::hash_map<ResourceId, ResourceId>& resource_to_child_map, | 91 const std::unordered_map<ResourceId, ResourceId>& resource_to_child_map, |
| 94 const gfx::Transform& target_transform, | 92 const gfx::Transform& target_transform, |
| 95 const ClipData& clip_rect, | 93 const ClipData& clip_rect, |
| 96 RenderPass* dest_pass, | 94 RenderPass* dest_pass, |
| 97 SurfaceId surface_id); | 95 SurfaceId surface_id); |
| 98 gfx::Rect PrewalkTree(SurfaceId surface_id, PrewalkResult* result); | 96 gfx::Rect PrewalkTree(SurfaceId surface_id, PrewalkResult* result); |
| 99 void CopyUndrawnSurfaces(PrewalkResult* prewalk); | 97 void CopyUndrawnSurfaces(PrewalkResult* prewalk); |
| 100 void CopyPasses(const DelegatedFrameData* frame_data, Surface* surface); | 98 void CopyPasses(const DelegatedFrameData* frame_data, Surface* surface); |
| 101 | 99 |
| 102 // Remove Surfaces that were referenced before but aren't currently | 100 // Remove Surfaces that were referenced before but aren't currently |
| 103 // referenced from the ResourceProvider. | 101 // referenced from the ResourceProvider. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 126 using SurfaceToResourceChildIdMap = | 124 using SurfaceToResourceChildIdMap = |
| 127 std::unordered_map<SurfaceId, int, SurfaceIdHash>; | 125 std::unordered_map<SurfaceId, int, SurfaceIdHash>; |
| 128 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; | 126 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; |
| 129 | 127 |
| 130 // The following state is only valid for the duration of one Aggregate call | 128 // The following state is only valid for the duration of one Aggregate call |
| 131 // and is only stored on the class to avoid having to pass through every | 129 // and is only stored on the class to avoid having to pass through every |
| 132 // function call. | 130 // function call. |
| 133 | 131 |
| 134 // This is the set of surfaces referenced in the aggregation so far, used to | 132 // This is the set of surfaces referenced in the aggregation so far, used to |
| 135 // detect cycles. | 133 // detect cycles. |
| 136 typedef std::set<SurfaceId> SurfaceSet; | 134 using SurfaceSet = std::set<SurfaceId>; |
| 137 SurfaceSet referenced_surfaces_; | 135 SurfaceSet referenced_surfaces_; |
| 138 | 136 |
| 139 // For each Surface used in the last aggregation, gives the frame_index at | 137 // For each Surface used in the last aggregation, gives the frame_index at |
| 140 // that time. | 138 // that time. |
| 141 SurfaceIndexMap previous_contained_surfaces_; | 139 SurfaceIndexMap previous_contained_surfaces_; |
| 142 SurfaceIndexMap contained_surfaces_; | 140 SurfaceIndexMap contained_surfaces_; |
| 143 | 141 |
| 144 // After surface validation, every Surface in this set is valid. | 142 // After surface validation, every Surface in this set is valid. |
| 145 std::unordered_set<SurfaceId, SurfaceIdHash> valid_surfaces_; | 143 std::unordered_set<SurfaceId, SurfaceIdHash> valid_surfaces_; |
| 146 | 144 |
| 147 // This is the pass list for the aggregated frame. | 145 // This is the pass list for the aggregated frame. |
| 148 RenderPassList* dest_pass_list_; | 146 RenderPassList* dest_pass_list_; |
| 149 | 147 |
| 150 // The root damage rect of the currently-aggregating frame. | 148 // The root damage rect of the currently-aggregating frame. |
| 151 gfx::Rect root_damage_rect_; | 149 gfx::Rect root_damage_rect_; |
| 152 | 150 |
| 153 // True if the frame that's currently being aggregated has copy requests. | 151 // True if the frame that's currently being aggregated has copy requests. |
| 154 // This is valid during Aggregate after PrewalkTree is called. | 152 // This is valid during Aggregate after PrewalkTree is called. |
| 155 bool has_copy_requests_; | 153 bool has_copy_requests_; |
| 156 | 154 |
| 157 // Resource list for the aggregated frame. | 155 // Resource list for the aggregated frame. |
| 158 TransferableResourceArray* dest_resource_list_; | 156 TransferableResourceArray* dest_resource_list_; |
| 159 | 157 |
| 160 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); | 158 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); |
| 161 }; | 159 }; |
| 162 | 160 |
| 163 } // namespace cc | 161 } // namespace cc |
| 164 | 162 |
| 165 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ | 163 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ |
| OLD | NEW |