Chromium Code Reviews| 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 // Resizing to 0 breaks stlport hash_set. | |
|
danakj
2015/04/28 17:25:46
TODO here pls
| |
| 174 size_t reserve_size = | |
| 175 std::max(static_cast<size_t>(1), frame_data->resource_list.size()); | |
| 176 #if defined(COMPILER_MSVC) | |
| 177 referenced_resources.reserve(reserve_size); | |
| 178 #elif defined(COMPILER_GCC) | |
| 179 // Pre-standard hash-tables only implement resize, which behaves similarly | |
| 180 // to reserve for these keys. TODO: Fix when C++11 is supported everywhere. | |
|
danakj
2015/04/28 17:25:46
TODO needs a name and I think should start the lin
| |
| 181 referenced_resources.resize(reserve_size); | |
| 182 #endif | |
| 173 | 183 |
| 174 bool invalid_frame = false; | 184 bool invalid_frame = false; |
| 175 DrawQuad::ResourceIteratorCallback remap = | 185 DrawQuad::ResourceIteratorCallback remap = |
| 176 base::Bind(&ValidateResourceHelper, &invalid_frame, | 186 base::Bind(&ValidateResourceHelper, &invalid_frame, |
| 177 base::ConstRef(provider_->GetChildToParentMap(child_id)), | 187 base::ConstRef(provider_->GetChildToParentMap(child_id)), |
| 178 &referenced_resources); | 188 &referenced_resources); |
| 179 for (const auto& render_pass : frame_data->render_pass_list) { | 189 for (const auto& render_pass : frame_data->render_pass_list) { |
| 180 for (const auto& quad : render_pass->quad_list) | 190 for (const auto& quad : render_pass->quad_list) |
| 181 quad->IterateResources(remap); | 191 quad->IterateResources(remap); |
| 182 } | 192 } |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 | 553 |
| 544 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { | 554 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { |
| 545 auto it = previous_contained_surfaces_.find(surface_id); | 555 auto it = previous_contained_surfaces_.find(surface_id); |
| 546 if (it == previous_contained_surfaces_.end()) | 556 if (it == previous_contained_surfaces_.end()) |
| 547 return; | 557 return; |
| 548 // Set the last drawn index as 0 to ensure full damage next time it's drawn. | 558 // Set the last drawn index as 0 to ensure full damage next time it's drawn. |
| 549 it->second = 0; | 559 it->second = 0; |
| 550 } | 560 } |
| 551 | 561 |
| 552 } // namespace cc | 562 } // namespace cc |
| OLD | NEW |