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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 const DelegatedFrameData* frame_data) { | 163 const DelegatedFrameData* frame_data) { |
164 if (!provider_) // TODO(jamesr): hack for unit tests that don't set up rp | 164 if (!provider_) // TODO(jamesr): hack for unit tests that don't set up rp |
165 return false; | 165 return false; |
166 | 166 |
167 int child_id = ChildIdForSurface(surface); | 167 int child_id = ChildIdForSurface(surface); |
168 if (surface->factory()) | 168 if (surface->factory()) |
169 surface->factory()->RefResources(frame_data->resource_list); | 169 surface->factory()->RefResources(frame_data->resource_list); |
170 provider_->ReceiveFromChild(child_id, frame_data->resource_list); | 170 provider_->ReceiveFromChild(child_id, frame_data->resource_list); |
171 | 171 |
172 ResourceProvider::ResourceIdSet referenced_resources; | 172 ResourceProvider::ResourceIdSet referenced_resources; |
173 size_t reserve_size = | |
174 std::max(static_cast<size_t>(1), frame_data->resource_list.size()); | |
danakj
2015/04/25 17:16:44
why the Max 1?
| |
175 #if defined(COMPILER_MSVC) | |
176 referenced_resources.reserve(reserve_size); | |
177 #elif defined(COMPILER_GCC) | |
178 // Pre-standard hash-tables only implement resize, which behaves similarly | |
danakj
2015/04/25 17:16:44
wow really? I'm surprised this is all we have in o
| |
179 // to reserve for these keys. | |
180 referenced_resources.resize(reserve_size); | |
181 #endif | |
173 | 182 |
174 bool invalid_frame = false; | 183 bool invalid_frame = false; |
175 DrawQuad::ResourceIteratorCallback remap = | 184 DrawQuad::ResourceIteratorCallback remap = |
176 base::Bind(&ValidateResourceHelper, &invalid_frame, | 185 base::Bind(&ValidateResourceHelper, &invalid_frame, |
177 base::ConstRef(provider_->GetChildToParentMap(child_id)), | 186 base::ConstRef(provider_->GetChildToParentMap(child_id)), |
178 &referenced_resources); | 187 &referenced_resources); |
179 for (const auto& render_pass : frame_data->render_pass_list) { | 188 for (const auto& render_pass : frame_data->render_pass_list) { |
180 for (const auto& quad : render_pass->quad_list) | 189 for (const auto& quad : render_pass->quad_list) |
181 quad->IterateResources(remap); | 190 quad->IterateResources(remap); |
182 } | 191 } |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
543 | 552 |
544 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { | 553 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { |
545 auto it = previous_contained_surfaces_.find(surface_id); | 554 auto it = previous_contained_surfaces_.find(surface_id); |
546 if (it == previous_contained_surfaces_.end()) | 555 if (it == previous_contained_surfaces_.end()) |
547 return; | 556 return; |
548 // 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. |
549 it->second = 0; | 558 it->second = 0; |
550 } | 559 } |
551 | 560 |
552 } // namespace cc | 561 } // namespace cc |
OLD | NEW |