Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1152473006: cc: Remove DrawQuad::IterateResoruces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iterators! Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 children_[i]->NoteLayerPropertyChangedForDescendantsInternal(); 758 children_[i]->NoteLayerPropertyChangedForDescendantsInternal();
759 } 759 }
760 760
761 void LayerImpl::NoteLayerPropertyChangedForDescendants() { 761 void LayerImpl::NoteLayerPropertyChangedForDescendants() {
762 layer_tree_impl()->set_needs_update_draw_properties(); 762 layer_tree_impl()->set_needs_update_draw_properties();
763 for (size_t i = 0; i < children_.size(); ++i) 763 for (size_t i = 0; i < children_.size(); ++i)
764 children_[i]->NoteLayerPropertyChangedForDescendantsInternal(); 764 children_[i]->NoteLayerPropertyChangedForDescendantsInternal();
765 SetNeedsPushProperties(); 765 SetNeedsPushProperties();
766 } 766 }
767 767
768 #if DCHECK_IS_ON()
769 // Verify that the resource id is valid.
770 static ResourceId ValidateResource(const ResourceProvider* provider,
771 ResourceId id) {
772 provider->ValidateResource(id);
773 return id;
774 }
775 #endif
776
777 void LayerImpl::ValidateQuadResourcesInternal(DrawQuad* quad) const { 768 void LayerImpl::ValidateQuadResourcesInternal(DrawQuad* quad) const {
778 #if DCHECK_IS_ON() 769 #if DCHECK_IS_ON()
779 quad->IterateResources( 770 const ResourceProvider* resource_provider =
780 base::Bind(&ValidateResource, layer_tree_impl_->resource_provider())); 771 layer_tree_impl_->resource_provider();
772 for (const ResourceId& resource_id : quad->resources)
piman 2015/05/28 19:35:46 nit: ResourceId instead of const ResourceId&
vmpstr 2015/05/28 22:36:58 Done.
773 resource_provider->ValidateResource(resource_id);
781 #endif 774 #endif
782 } 775 }
783 776
784 const char* LayerImpl::LayerTypeAsString() const { 777 const char* LayerImpl::LayerTypeAsString() const {
785 return "cc::LayerImpl"; 778 return "cc::LayerImpl";
786 } 779 }
787 780
788 void LayerImpl::ResetAllChangeTrackingForSubtree() { 781 void LayerImpl::ResetAllChangeTrackingForSubtree() {
789 layer_property_changed_ = false; 782 layer_property_changed_ = false;
790 783
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 gfx::Transform scaled_draw_transform = 1696 gfx::Transform scaled_draw_transform =
1704 draw_properties_.target_space_transform; 1697 draw_properties_.target_space_transform;
1705 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); 1698 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale);
1706 gfx::Size scaled_content_bounds = 1699 gfx::Size scaled_content_bounds =
1707 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); 1700 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale));
1708 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, 1701 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform,
1709 gfx::Rect(scaled_content_bounds)); 1702 gfx::Rect(scaled_content_bounds));
1710 } 1703 }
1711 1704
1712 } // namespace cc 1705 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698