| 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 int child_id = 0; | 610 int child_id = 0; |
| 611 // TODO(jbauman): hack for unit tests that don't set up rp | 611 // TODO(jbauman): hack for unit tests that don't set up rp |
| 612 if (provider_) { | 612 if (provider_) { |
| 613 child_id = ChildIdForSurface(surface); | 613 child_id = ChildIdForSurface(surface); |
| 614 if (surface->factory()) | 614 if (surface->factory()) |
| 615 surface->factory()->RefResources(frame.resource_list); | 615 surface->factory()->RefResources(frame.resource_list); |
| 616 provider_->ReceiveFromChild(child_id, frame.resource_list); | 616 provider_->ReceiveFromChild(child_id, frame.resource_list); |
| 617 } | 617 } |
| 618 CHECK(debug_weak_this.get()); | 618 CHECK(debug_weak_this.get()); |
| 619 | 619 |
| 620 ResourceIdSet referenced_resources; | 620 std::vector<ResourceId> referenced_resources; |
| 621 size_t reserve_size = frame.resource_list.size(); | 621 size_t reserve_size = frame.resource_list.size(); |
| 622 referenced_resources.reserve(reserve_size); | 622 referenced_resources.reserve(reserve_size); |
| 623 | 623 |
| 624 bool invalid_frame = false; | 624 bool invalid_frame = false; |
| 625 ResourceProvider::ResourceIdMap empty_map; | 625 ResourceProvider::ResourceIdMap empty_map; |
| 626 const ResourceProvider::ResourceIdMap& child_to_parent_map = | 626 const ResourceProvider::ResourceIdMap& child_to_parent_map = |
| 627 provider_ ? provider_->GetChildToParentMap(child_id) : empty_map; | 627 provider_ ? provider_->GetChildToParentMap(child_id) : empty_map; |
| 628 | 628 |
| 629 CHECK(debug_weak_this.get()); | 629 CHECK(debug_weak_this.get()); |
| 630 if (!frame.render_pass_list.empty()) { | 630 if (!frame.render_pass_list.empty()) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 RemapPassId(render_pass_quad->render_pass_id, surface_id)); | 694 RemapPassId(render_pass_quad->render_pass_id, surface_id)); |
| 695 } | 695 } |
| 696 | 696 |
| 697 if (!provider_) | 697 if (!provider_) |
| 698 continue; | 698 continue; |
| 699 for (ResourceId resource_id : quad->resources) { | 699 for (ResourceId resource_id : quad->resources) { |
| 700 if (!child_to_parent_map.count(resource_id)) { | 700 if (!child_to_parent_map.count(resource_id)) { |
| 701 invalid_frame = true; | 701 invalid_frame = true; |
| 702 break; | 702 break; |
| 703 } | 703 } |
| 704 referenced_resources.insert(resource_id); | 704 referenced_resources.push_back(resource_id); |
| 705 } | 705 } |
| 706 } | 706 } |
| 707 } | 707 } |
| 708 | 708 |
| 709 if (invalid_frame) | 709 if (invalid_frame) |
| 710 return gfx::Rect(); | 710 return gfx::Rect(); |
| 711 CHECK(debug_weak_this.get()); | 711 CHECK(debug_weak_this.get()); |
| 712 valid_surfaces_.insert(surface->surface_id()); | 712 valid_surfaces_.insert(surface->surface_id()); |
| 713 | 713 |
| 714 ResourceIdSet resource_set(std::move(referenced_resources), |
| 715 base::KEEP_FIRST_OF_DUPES); |
| 714 if (provider_) | 716 if (provider_) |
| 715 provider_->DeclareUsedResourcesFromChild(child_id, referenced_resources); | 717 provider_->DeclareUsedResourcesFromChild(child_id, resource_set); |
| 716 CHECK(debug_weak_this.get()); | 718 CHECK(debug_weak_this.get()); |
| 717 | 719 |
| 718 gfx::Rect damage_rect; | 720 gfx::Rect damage_rect; |
| 719 gfx::Rect full_damage; | 721 gfx::Rect full_damage; |
| 720 if (!frame.render_pass_list.empty()) { | 722 if (!frame.render_pass_list.empty()) { |
| 721 RenderPass* last_pass = frame.render_pass_list.back().get(); | 723 RenderPass* last_pass = frame.render_pass_list.back().get(); |
| 722 full_damage = last_pass->output_rect; | 724 full_damage = last_pass->output_rect; |
| 723 damage_rect = | 725 damage_rect = |
| 724 DamageRectForSurface(surface, *last_pass, last_pass->output_rect); | 726 DamageRectForSurface(surface, *last_pass, last_pass->output_rect); |
| 725 } | 727 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 } | 931 } |
| 930 | 932 |
| 931 void SurfaceAggregator::SetOutputColorSpace( | 933 void SurfaceAggregator::SetOutputColorSpace( |
| 932 const gfx::ColorSpace& blending_color_space, | 934 const gfx::ColorSpace& blending_color_space, |
| 933 const gfx::ColorSpace& output_color_space) { | 935 const gfx::ColorSpace& output_color_space) { |
| 934 blending_color_space_ = blending_color_space; | 936 blending_color_space_ = blending_color_space; |
| 935 output_color_space_ = output_color_space; | 937 output_color_space_ = output_color_space; |
| 936 } | 938 } |
| 937 | 939 |
| 938 } // namespace cc | 940 } // namespace cc |
| OLD | NEW |