| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 // TODO(jbauman): hack for unit tests that don't set up rp | 511 // TODO(jbauman): hack for unit tests that don't set up rp |
| 512 if (provider_) { | 512 if (provider_) { |
| 513 child_id = ChildIdForSurface(surface); | 513 child_id = ChildIdForSurface(surface); |
| 514 if (surface->factory()) | 514 if (surface->factory()) |
| 515 surface->factory()->RefResources(frame_data->resource_list); | 515 surface->factory()->RefResources(frame_data->resource_list); |
| 516 provider_->ReceiveFromChild(child_id, frame_data->resource_list); | 516 provider_->ReceiveFromChild(child_id, frame_data->resource_list); |
| 517 } | 517 } |
| 518 | 518 |
| 519 ResourceProvider::ResourceIdSet referenced_resources; | 519 ResourceProvider::ResourceIdSet referenced_resources; |
| 520 size_t reserve_size = frame_data->resource_list.size(); | 520 size_t reserve_size = frame_data->resource_list.size(); |
| 521 #if defined(COMPILER_MSVC) | |
| 522 referenced_resources.reserve(reserve_size); | 521 referenced_resources.reserve(reserve_size); |
| 523 #elif defined(COMPILER_GCC) | |
| 524 // Pre-standard hash-tables only implement resize, which behaves similarly | |
| 525 // to reserve for these keys. Resizing to 0 may also be broken (particularly | |
| 526 // on stlport). | |
| 527 // TODO(jbauman): Replace with reserve when C++11 is supported everywhere. | |
| 528 if (reserve_size) | |
| 529 referenced_resources.resize(reserve_size); | |
| 530 #endif | |
| 531 | 522 |
| 532 bool invalid_frame = false; | 523 bool invalid_frame = false; |
| 533 ResourceProvider::ResourceIdMap empty_map; | 524 ResourceProvider::ResourceIdMap empty_map; |
| 534 const ResourceProvider::ResourceIdMap& child_to_parent_map = | 525 const ResourceProvider::ResourceIdMap& child_to_parent_map = |
| 535 provider_ ? provider_->GetChildToParentMap(child_id) : empty_map; | 526 provider_ ? provider_->GetChildToParentMap(child_id) : empty_map; |
| 536 | 527 |
| 537 // Each pair in the vector is a child surface and the transform from its | 528 // Each pair in the vector is a child surface and the transform from its |
| 538 // target to the root target of this surface. | 529 // target to the root target of this surface. |
| 539 std::vector<std::pair<SurfaceId, gfx::Transform>> child_surfaces; | 530 std::vector<std::pair<SurfaceId, gfx::Transform>> child_surfaces; |
| 540 for (const auto& render_pass : frame_data->render_pass_list) { | 531 for (const auto& render_pass : frame_data->render_pass_list) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 | 643 |
| 653 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { | 644 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { |
| 654 auto it = previous_contained_surfaces_.find(surface_id); | 645 auto it = previous_contained_surfaces_.find(surface_id); |
| 655 if (it == previous_contained_surfaces_.end()) | 646 if (it == previous_contained_surfaces_.end()) |
| 656 return; | 647 return; |
| 657 // Set the last drawn index as 0 to ensure full damage next time it's drawn. | 648 // Set the last drawn index as 0 to ensure full damage next time it's drawn. |
| 658 it->second = 0; | 649 it->second = 0; |
| 659 } | 650 } |
| 660 | 651 |
| 661 } // namespace cc | 652 } // namespace cc |
| OLD | NEW |