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 #include "cc/surfaces/surface_aggregator.h" | 5 #include "cc/surfaces/surface_aggregator.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 provider_->SetChildNeedsSyncPoints( | 124 provider_->SetChildNeedsSyncPoints( |
125 child_id, surface->factory()->needs_sync_points()); | 125 child_id, surface->factory()->needs_sync_points()); |
126 } | 126 } |
127 surface_id_to_resource_child_id_[surface->surface_id()] = child_id; | 127 surface_id_to_resource_child_id_[surface->surface_id()] = child_id; |
128 return child_id; | 128 return child_id; |
129 } else { | 129 } else { |
130 return it->second; | 130 return it->second; |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 static ResourceProvider::ResourceId ResourceRemapHelper( | 134 static ResourceId ResourceRemapHelper( |
135 const ResourceProvider::ResourceIdMap& child_to_parent_map, | 135 const ResourceProvider::ResourceIdMap& child_to_parent_map, |
136 ResourceProvider::ResourceId id) { | 136 ResourceId id) { |
137 ResourceProvider::ResourceIdMap::const_iterator it = | 137 ResourceProvider::ResourceIdMap::const_iterator it = |
138 child_to_parent_map.find(id); | 138 child_to_parent_map.find(id); |
139 DCHECK(it != child_to_parent_map.end()); | 139 DCHECK(it != child_to_parent_map.end()); |
140 | 140 |
141 DCHECK_EQ(it->first, id); | 141 DCHECK_EQ(it->first, id); |
142 ResourceProvider::ResourceId remapped_id = it->second; | 142 ResourceId remapped_id = it->second; |
143 return remapped_id; | 143 return remapped_id; |
144 } | 144 } |
145 | 145 |
146 static ResourceProvider::ResourceId ValidateResourceHelper( | 146 static ResourceId ValidateResourceHelper( |
147 bool* invalid_frame, | 147 bool* invalid_frame, |
148 const ResourceProvider::ResourceIdMap& child_to_parent_map, | 148 const ResourceProvider::ResourceIdMap& child_to_parent_map, |
149 ResourceProvider::ResourceIdSet* resources_in_frame, | 149 ResourceProvider::ResourceIdSet* resources_in_frame, |
150 ResourceProvider::ResourceId id) { | 150 ResourceId id) { |
151 ResourceProvider::ResourceIdMap::const_iterator it = | 151 ResourceProvider::ResourceIdMap::const_iterator it = |
152 child_to_parent_map.find(id); | 152 child_to_parent_map.find(id); |
153 if (it == child_to_parent_map.end()) { | 153 if (it == child_to_parent_map.end()) { |
154 *invalid_frame = true; | 154 *invalid_frame = true; |
155 return id; | 155 return id; |
156 } | 156 } |
157 resources_in_frame->insert(id); | 157 resources_in_frame->insert(id); |
158 return id; | 158 return id; |
159 } | 159 } |
160 | 160 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 | 552 |
553 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { | 553 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { |
554 auto it = previous_contained_surfaces_.find(surface_id); | 554 auto it = previous_contained_surfaces_.find(surface_id); |
555 if (it == previous_contained_surfaces_.end()) | 555 if (it == previous_contained_surfaces_.end()) |
556 return; | 556 return; |
557 // Set the last drawn index as 0 to ensure full damage next time it's drawn. | 557 // Set the last drawn index as 0 to ensure full damage next time it's drawn. |
558 it->second = 0; | 558 it->second = 0; |
559 } | 559 } |
560 | 560 |
561 } // namespace cc | 561 } // namespace cc |
OLD | NEW |