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

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

Issue 1946403003: Add fixed raster scale use counter histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+fix Created 4 years, 7 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
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 hide_layer_and_subtree_(false), 72 hide_layer_and_subtree_(false),
73 masks_to_bounds_(false), 73 masks_to_bounds_(false),
74 contents_opaque_(false), 74 contents_opaque_(false),
75 double_sided_(true), 75 double_sided_(true),
76 should_flatten_transform_(true), 76 should_flatten_transform_(true),
77 use_parent_backface_visibility_(false), 77 use_parent_backface_visibility_(false),
78 use_local_transform_for_backface_visibility_(false), 78 use_local_transform_for_backface_visibility_(false),
79 should_check_backface_visibility_(false), 79 should_check_backface_visibility_(false),
80 force_render_surface_for_testing_(false), 80 force_render_surface_for_testing_(false),
81 subtree_property_changed_(false), 81 subtree_property_changed_(false),
82 has_will_change_transform_hint_(false),
82 background_color_(0), 83 background_color_(0),
83 safe_opaque_background_color_(0), 84 safe_opaque_background_color_(0),
84 opacity_(1.f), 85 opacity_(1.f),
85 blend_mode_(SkXfermode::kSrcOver_Mode), 86 blend_mode_(SkXfermode::kSrcOver_Mode),
86 draw_blend_mode_(SkXfermode::kSrcOver_Mode), 87 draw_blend_mode_(SkXfermode::kSrcOver_Mode),
87 scroll_parent_(nullptr), 88 scroll_parent_(nullptr),
88 clip_parent_(nullptr), 89 clip_parent_(nullptr),
89 replica_layer_(nullptr), 90 replica_layer_(nullptr),
90 client_(nullptr), 91 client_(nullptr),
91 num_unclipped_descendants_(0) {} 92 num_unclipped_descendants_(0) {}
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 layer->PassCopyRequests(&main_thread_copy_requests); 1215 layer->PassCopyRequests(&main_thread_copy_requests);
1215 } 1216 }
1216 1217
1217 // If the main thread commits multiple times before the impl thread actually 1218 // If the main thread commits multiple times before the impl thread actually
1218 // draws, then damage tracking will become incorrect if we simply clobber the 1219 // draws, then damage tracking will become incorrect if we simply clobber the
1219 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. 1220 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
1220 // union) any update changes that have occurred on the main thread. 1221 // union) any update changes that have occurred on the main thread.
1221 update_rect_.Union(layer->update_rect()); 1222 update_rect_.Union(layer->update_rect());
1222 layer->SetUpdateRect(update_rect_); 1223 layer->SetUpdateRect(update_rect_);
1223 1224
1225 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint());
1226
1224 // Reset any state that should be cleared for the next update. 1227 // Reset any state that should be cleared for the next update.
1225 subtree_property_changed_ = false; 1228 subtree_property_changed_ = false;
1226 update_rect_ = gfx::Rect(); 1229 update_rect_ = gfx::Rect();
1227 1230
1228 layer_tree_host()->RemoveLayerShouldPushProperties(this); 1231 layer_tree_host()->RemoveLayerShouldPushProperties(this);
1229 } 1232 }
1230 1233
1231 void Layer::SetTypeForProtoSerialization(proto::LayerNode* proto) const { 1234 void Layer::SetTypeForProtoSerialization(proto::LayerNode* proto) const {
1232 proto->set_type(proto::LayerNode::LAYER); 1235 proto->set_type(proto::LayerNode::LAYER);
1233 } 1236 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 1418
1416 // TODO(nyquist): Figure out what to do with CopyRequests. 1419 // TODO(nyquist): Figure out what to do with CopyRequests.
1417 // See crbug.com/570374. 1420 // See crbug.com/570374.
1418 1421
1419 RectToProto(update_rect_, base->mutable_update_rect()); 1422 RectToProto(update_rect_, base->mutable_update_rect());
1420 1423
1421 // TODO(nyquist): Figure out what to do with ElementAnimations. 1424 // TODO(nyquist): Figure out what to do with ElementAnimations.
1422 // See crbug.com/570376. 1425 // See crbug.com/570376.
1423 1426
1424 update_rect_ = gfx::Rect(); 1427 update_rect_ = gfx::Rect();
1428
1429 base->set_has_will_change_transform_hint(has_will_change_transform_hint_);
1425 } 1430 }
1426 1431
1427 void Layer::FromLayerSpecificPropertiesProto( 1432 void Layer::FromLayerSpecificPropertiesProto(
1428 const proto::LayerProperties& proto) { 1433 const proto::LayerProperties& proto) {
1429 DCHECK(proto.has_base()); 1434 DCHECK(proto.has_base());
1430 DCHECK(layer_tree_host_); 1435 DCHECK(layer_tree_host_);
1431 const proto::BaseLayerProperties& base = proto.base(); 1436 const proto::BaseLayerProperties& base = proto.base();
1432 1437
1433 transform_origin_ = ProtoToPoint3F(base.transform_origin()); 1438 transform_origin_ = ProtoToPoint3F(base.transform_origin());
1434 background_color_ = base.background_color(); 1439 background_color_ = base.background_color();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 clip_children_.reset(new std::set<Layer*>); 1511 clip_children_.reset(new std::set<Layer*>);
1507 for (int i = 0; i < base.clip_children_ids_size(); ++i) { 1512 for (int i = 0; i < base.clip_children_ids_size(); ++i) {
1508 int child_id = base.clip_children_ids(i); 1513 int child_id = base.clip_children_ids(i);
1509 scoped_refptr<Layer> child = layer_tree_host_->LayerById(child_id); 1514 scoped_refptr<Layer> child = layer_tree_host_->LayerById(child_id);
1510 clip_children_->insert(child.get()); 1515 clip_children_->insert(child.get());
1511 } 1516 }
1512 1517
1513 scroll_offset_ = ProtoToScrollOffset(base.scroll_offset()); 1518 scroll_offset_ = ProtoToScrollOffset(base.scroll_offset());
1514 1519
1515 update_rect_.Union(ProtoToRect(base.update_rect())); 1520 update_rect_.Union(ProtoToRect(base.update_rect()));
1521
1522 has_will_change_transform_hint_ = base.has_will_change_transform_hint();
1516 } 1523 }
1517 1524
1518 std::unique_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 1525 std::unique_ptr<LayerImpl> Layer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
1519 return LayerImpl::Create(tree_impl, layer_id_); 1526 return LayerImpl::Create(tree_impl, layer_id_);
1520 } 1527 }
1521 1528
1522 bool Layer::DrawsContent() const { 1529 bool Layer::DrawsContent() const {
1523 return draws_content_; 1530 return draws_content_;
1524 } 1531 }
1525 1532
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 has_potential_animation || OpacityCanAnimateOnImplThread(); 1703 has_potential_animation || OpacityCanAnimateOnImplThread();
1697 effect_tree.set_needs_update(true); 1704 effect_tree.set_needs_update(true);
1698 } 1705 }
1699 } 1706 }
1700 1707
1701 bool Layer::HasActiveAnimationForTesting() const { 1708 bool Layer::HasActiveAnimationForTesting() const {
1702 return layer_tree_host_ ? layer_tree_host_->HasActiveAnimationForTesting(this) 1709 return layer_tree_host_ ? layer_tree_host_->HasActiveAnimationForTesting(this)
1703 : false; 1710 : false;
1704 } 1711 }
1705 1712
1713 void Layer::SetHasWillChangeTransformHint(bool has_will_change) {
1714 if (has_will_change_transform_hint_ == has_will_change)
1715 return;
1716 has_will_change_transform_hint_ = has_will_change;
1717 SetNeedsCommit();
1718 }
1719
1706 ScrollbarLayerInterface* Layer::ToScrollbarLayer() { 1720 ScrollbarLayerInterface* Layer::ToScrollbarLayer() {
1707 return nullptr; 1721 return nullptr;
1708 } 1722 }
1709 1723
1710 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { 1724 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const {
1711 return layer_tree_host_->rendering_stats_instrumentation(); 1725 return layer_tree_host_->rendering_stats_instrumentation();
1712 } 1726 }
1713 1727
1714 void Layer::RemoveFromScrollTree() { 1728 void Layer::RemoveFromScrollTree() {
1715 if (scroll_children_.get()) { 1729 if (scroll_children_.get()) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 ->data.num_copy_requests_in_subtree; 1797 ->data.num_copy_requests_in_subtree;
1784 } 1798 }
1785 1799
1786 gfx::Transform Layer::screen_space_transform() const { 1800 gfx::Transform Layer::screen_space_transform() const {
1787 DCHECK_NE(transform_tree_index_, -1); 1801 DCHECK_NE(transform_tree_index_, -1);
1788 return draw_property_utils::ScreenSpaceTransform( 1802 return draw_property_utils::ScreenSpaceTransform(
1789 this, layer_tree_host_->property_trees()->transform_tree); 1803 this, layer_tree_host_->property_trees()->transform_tree);
1790 } 1804 }
1791 1805
1792 } // namespace cc 1806 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698