| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 // TODO(jbauman): hack for unit tests that don't set up rp | 519 // TODO(jbauman): hack for unit tests that don't set up rp |
| 520 if (provider_) { | 520 if (provider_) { |
| 521 child_id = ChildIdForSurface(surface); | 521 child_id = ChildIdForSurface(surface); |
| 522 if (surface->factory()) | 522 if (surface->factory()) |
| 523 surface->factory()->RefResources(frame_data->resource_list); | 523 surface->factory()->RefResources(frame_data->resource_list); |
| 524 provider_->ReceiveFromChild(child_id, frame_data->resource_list); | 524 provider_->ReceiveFromChild(child_id, frame_data->resource_list); |
| 525 } | 525 } |
| 526 | 526 |
| 527 ResourceProvider::ResourceIdSet referenced_resources; | 527 ResourceProvider::ResourceIdSet referenced_resources; |
| 528 size_t reserve_size = frame_data->resource_list.size(); | 528 size_t reserve_size = frame_data->resource_list.size(); |
| 529 #if defined(COMPILER_MSVC) |
| 529 referenced_resources.reserve(reserve_size); | 530 referenced_resources.reserve(reserve_size); |
| 531 #elif defined(COMPILER_GCC) |
| 532 // Pre-standard hash-tables only implement resize, which behaves similarly |
| 533 // to reserve for these keys. Resizing to 0 may also be broken (particularly |
| 534 // on stlport). |
| 535 // TODO(jbauman): Replace with reserve when C++11 is supported everywhere. |
| 536 if (reserve_size) |
| 537 referenced_resources.resize(reserve_size); |
| 538 #endif |
| 530 | 539 |
| 531 bool invalid_frame = false; | 540 bool invalid_frame = false; |
| 532 ResourceProvider::ResourceIdMap empty_map; | 541 ResourceProvider::ResourceIdMap empty_map; |
| 533 const ResourceProvider::ResourceIdMap& child_to_parent_map = | 542 const ResourceProvider::ResourceIdMap& child_to_parent_map = |
| 534 provider_ ? provider_->GetChildToParentMap(child_id) : empty_map; | 543 provider_ ? provider_->GetChildToParentMap(child_id) : empty_map; |
| 535 | 544 |
| 536 // Each pair in the vector is a child surface and the transform from its | 545 // Each pair in the vector is a child surface and the transform from its |
| 537 // target to the root target of this surface. | 546 // target to the root target of this surface. |
| 538 std::vector<std::pair<SurfaceId, gfx::Transform>> child_surfaces; | 547 std::vector<std::pair<SurfaceId, gfx::Transform>> child_surfaces; |
| 539 for (const auto& render_pass : frame_data->render_pass_list) { | 548 for (const auto& render_pass : frame_data->render_pass_list) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 716 |
| 708 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { | 717 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { |
| 709 auto it = previous_contained_surfaces_.find(surface_id); | 718 auto it = previous_contained_surfaces_.find(surface_id); |
| 710 if (it == previous_contained_surfaces_.end()) | 719 if (it == previous_contained_surfaces_.end()) |
| 711 return; | 720 return; |
| 712 // Set the last drawn index as 0 to ensure full damage next time it's drawn. | 721 // Set the last drawn index as 0 to ensure full damage next time it's drawn. |
| 713 it->second = 0; | 722 it->second = 0; |
| 714 } | 723 } |
| 715 | 724 |
| 716 } // namespace cc | 725 } // namespace cc |
| OLD | NEW |