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) | |
530 referenced_resources.reserve(reserve_size); | 529 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 | |
539 | 530 |
540 bool invalid_frame = false; | 531 bool invalid_frame = false; |
541 ResourceProvider::ResourceIdMap empty_map; | 532 ResourceProvider::ResourceIdMap empty_map; |
542 const ResourceProvider::ResourceIdMap& child_to_parent_map = | 533 const ResourceProvider::ResourceIdMap& child_to_parent_map = |
543 provider_ ? provider_->GetChildToParentMap(child_id) : empty_map; | 534 provider_ ? provider_->GetChildToParentMap(child_id) : empty_map; |
544 | 535 |
545 // Each pair in the vector is a child surface and the transform from its | 536 // Each pair in the vector is a child surface and the transform from its |
546 // target to the root target of this surface. | 537 // target to the root target of this surface. |
547 std::vector<std::pair<SurfaceId, gfx::Transform>> child_surfaces; | 538 std::vector<std::pair<SurfaceId, gfx::Transform>> child_surfaces; |
548 for (const auto& render_pass : frame_data->render_pass_list) { | 539 for (const auto& render_pass : frame_data->render_pass_list) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 | 707 |
717 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { | 708 void SurfaceAggregator::SetFullDamageForSurface(SurfaceId surface_id) { |
718 auto it = previous_contained_surfaces_.find(surface_id); | 709 auto it = previous_contained_surfaces_.find(surface_id); |
719 if (it == previous_contained_surfaces_.end()) | 710 if (it == previous_contained_surfaces_.end()) |
720 return; | 711 return; |
721 // Set the last drawn index as 0 to ensure full damage next time it's drawn. | 712 // Set the last drawn index as 0 to ensure full damage next time it's drawn. |
722 it->second = 0; | 713 it->second = 0; |
723 } | 714 } |
724 | 715 |
725 } // namespace cc | 716 } // namespace cc |
OLD | NEW |