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

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

Issue 373113003: Keeping track of descendants that draw content instead of recalcualting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "cc/animation/animation_registrar.h" 10 #include "cc/animation/animation_registrar.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 use_parent_backface_visibility_(false), 56 use_parent_backface_visibility_(false),
57 draw_checkerboard_for_missing_tiles_(false), 57 draw_checkerboard_for_missing_tiles_(false),
58 draws_content_(false), 58 draws_content_(false),
59 hide_layer_and_subtree_(false), 59 hide_layer_and_subtree_(false),
60 force_render_surface_(false), 60 force_render_surface_(false),
61 transform_is_invertible_(true), 61 transform_is_invertible_(true),
62 is_container_for_fixed_position_layers_(false), 62 is_container_for_fixed_position_layers_(false),
63 background_color_(0), 63 background_color_(0),
64 opacity_(1.0), 64 opacity_(1.0),
65 blend_mode_(SkXfermode::kSrcOver_Mode), 65 blend_mode_(SkXfermode::kSrcOver_Mode),
66 num_descendants_that_draw_content_(0),
66 draw_depth_(0.f), 67 draw_depth_(0.f),
67 needs_push_properties_(false), 68 needs_push_properties_(false),
68 num_dependents_need_push_properties_(0), 69 num_dependents_need_push_properties_(0),
69 sorting_context_id_(0), 70 sorting_context_id_(0),
70 current_draw_mode_(DRAW_MODE_NONE) { 71 current_draw_mode_(DRAW_MODE_NONE) {
71 DCHECK_GT(layer_id_, 0); 72 DCHECK_GT(layer_id_, 0);
72 DCHECK(layer_tree_impl_); 73 DCHECK(layer_tree_impl_);
73 layer_tree_impl_->RegisterLayer(this); 74 layer_tree_impl_->RegisterLayer(this);
74 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar(); 75 AnimationRegistrar* registrar = layer_tree_impl_->animationRegistrar();
75 layer_animation_controller_ = 76 layer_animation_controller_ =
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 SetNeedsPushProperties(); 169 SetNeedsPushProperties();
169 } 170 }
170 171
171 void LayerImpl::SetScrollChildren(std::set<LayerImpl*>* children) { 172 void LayerImpl::SetScrollChildren(std::set<LayerImpl*>* children) {
172 if (scroll_children_.get() == children) 173 if (scroll_children_.get() == children)
173 return; 174 return;
174 scroll_children_.reset(children); 175 scroll_children_.reset(children);
175 SetNeedsPushProperties(); 176 SetNeedsPushProperties();
176 } 177 }
177 178
179 void LayerImpl::SetNumDescendantsThatDrawContent(int num_descendants) {
180 num_descendants_that_draw_content_ = num_descendants;
danakj 2014/07/14 20:22:02 You need to call SetNeedsPushProperties() to ensur
awoloszyn 2014/07/16 20:44:20 Done.
181 }
182
178 void LayerImpl::SetClipParent(LayerImpl* ancestor) { 183 void LayerImpl::SetClipParent(LayerImpl* ancestor) {
179 if (clip_parent_ == ancestor) 184 if (clip_parent_ == ancestor)
180 return; 185 return;
181 186
182 clip_parent_ = ancestor; 187 clip_parent_ = ancestor;
183 SetNeedsPushProperties(); 188 SetNeedsPushProperties();
184 } 189 }
185 190
186 void LayerImpl::SetClipChildren(std::set<LayerImpl*>* children) { 191 void LayerImpl::SetClipChildren(std::set<LayerImpl*>* children) {
187 if (clip_children_.get() == children) 192 if (clip_children_.get() == children)
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); 529 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
525 530
526 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id() 531 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id()
527 : Layer::INVALID_ID); 532 : Layer::INVALID_ID);
528 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); 533 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
529 layer->set_user_scrollable_vertical(user_scrollable_vertical_); 534 layer->set_user_scrollable_vertical(user_scrollable_vertical_);
530 layer->SetScrollOffsetAndDelta( 535 layer->SetScrollOffsetAndDelta(
531 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta()); 536 scroll_offset_, layer->ScrollDelta() - layer->sent_scroll_delta());
532 layer->SetSentScrollDelta(gfx::Vector2d()); 537 layer->SetSentScrollDelta(gfx::Vector2d());
533 layer->Set3dSortingContextId(sorting_context_id_); 538 layer->Set3dSortingContextId(sorting_context_id_);
539 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
534 540
535 LayerImpl* scroll_parent = NULL; 541 LayerImpl* scroll_parent = NULL;
536 if (scroll_parent_) { 542 if (scroll_parent_) {
537 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); 543 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id());
538 DCHECK(scroll_parent); 544 DCHECK(scroll_parent);
539 } 545 }
540 546
541 layer->SetScrollParent(scroll_parent); 547 layer->SetScrollParent(scroll_parent);
542 if (scroll_children_) { 548 if (scroll_children_) {
543 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; 549 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>;
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 scoped_ptr<base::Value> LayerImpl::AsValue() const { 1494 scoped_ptr<base::Value> LayerImpl::AsValue() const {
1489 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 1495 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1490 AsValueInto(state.get()); 1496 AsValueInto(state.get());
1491 return state.PassAs<base::Value>(); 1497 return state.PassAs<base::Value>();
1492 } 1498 }
1493 1499
1494 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { 1500 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
1495 benchmark->RunOnLayer(this); 1501 benchmark->RunOnLayer(this);
1496 } 1502 }
1497 1503
1504 int LayerImpl::NumDescendantsThatDrawContent() const {
1505 return num_descendants_that_draw_content_;
1506 }
1507
1498 void LayerImpl::NotifyAnimationFinished( 1508 void LayerImpl::NotifyAnimationFinished(
1499 base::TimeTicks monotonic_time, 1509 base::TimeTicks monotonic_time,
1500 Animation::TargetProperty target_property) { 1510 Animation::TargetProperty target_property) {
1501 if (target_property == Animation::ScrollOffset) 1511 if (target_property == Animation::ScrollOffset)
1502 layer_tree_impl_->InputScrollAnimationFinished(); 1512 layer_tree_impl_->InputScrollAnimationFinished();
1503 } 1513 }
1504 1514
1505 } // namespace cc 1515 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698