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

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

Issue 1801853002: Transfer LayerImpl ownership to LayerTreeImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more asan. Created 4 years, 9 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_impl.cc ('k') | cc/layers/layer_list_iterator.cc » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/animation/mutable_properties.h" 7 #include "cc/animation/mutable_properties.h"
8 #include "cc/layers/painted_scrollbar_layer_impl.h" 8 #include "cc/layers/painted_scrollbar_layer_impl.h"
9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
10 #include "cc/output/filter_operation.h" 10 #include "cc/output/filter_operation.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 scoped_ptr<LayerImpl> clip_parent = 146 scoped_ptr<LayerImpl> clip_parent =
147 LayerImpl::Create(host_impl.active_tree(), 5); 147 LayerImpl::Create(host_impl.active_tree(), 5);
148 LayerImpl* clip_child = LayerImpl::Create(host_impl.active_tree(), 6).get(); 148 LayerImpl* clip_child = LayerImpl::Create(host_impl.active_tree(), 6).get();
149 std::set<LayerImpl*>* clip_children = new std::set<LayerImpl*>(); 149 std::set<LayerImpl*>* clip_children = new std::set<LayerImpl*>();
150 clip_children->insert(clip_child); 150 clip_children->insert(clip_child);
151 clip_children->insert(root); 151 clip_children->insert(root);
152 root->layer_tree_impl()->ResetAllChangeTracking( 152 root->layer_tree_impl()->ResetAllChangeTracking(
153 PropertyTrees::ResetFlags::ALL_TREES); 153 PropertyTrees::ResetFlags::ALL_TREES);
154 154
155 root->AddChild(LayerImpl::Create(host_impl.active_tree(), 7)); 155 root->AddChild(LayerImpl::Create(host_impl.active_tree(), 7));
156 LayerImpl* child = root->children()[0].get(); 156 LayerImpl* child = root->children()[0];
157 child->AddChild(LayerImpl::Create(host_impl.active_tree(), 8)); 157 child->AddChild(LayerImpl::Create(host_impl.active_tree(), 8));
158 LayerImpl* grand_child = child->children()[0].get(); 158 LayerImpl* grand_child = child->children()[0];
159 root->SetScrollClipLayer(root_clip->id()); 159 root->SetScrollClipLayer(root_clip->id());
160 host_impl.active_tree()->BuildPropertyTreesForTesting(); 160 host_impl.active_tree()->BuildPropertyTreesForTesting();
161 161
162 // Adding children is an internal operation and should not mark layers as 162 // Adding children is an internal operation and should not mark layers as
163 // changed. 163 // changed.
164 EXPECT_FALSE(root->LayerPropertyChanged()); 164 EXPECT_FALSE(root->LayerPropertyChanged());
165 EXPECT_FALSE(child->LayerPropertyChanged()); 165 EXPECT_FALSE(child->LayerPropertyChanged());
166 EXPECT_FALSE(grand_child->LayerPropertyChanged()); 166 EXPECT_FALSE(grand_child->LayerPropertyChanged());
167 167
168 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f); 168 gfx::PointF arbitrary_point_f = gfx::PointF(0.125f, 0.25f);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 // Set the max scroll offset by noting that the root layer has bounds (1,1), 509 // Set the max scroll offset by noting that the root layer has bounds (1,1),
510 // thus whatever bounds are set for the layer will be the max scroll 510 // thus whatever bounds are set for the layer will be the max scroll
511 // offset plus 1 in each direction. 511 // offset plus 1 in each direction.
512 host_impl_.active_tree()->root_layer()->SetBounds(gfx::Size(1, 1)); 512 host_impl_.active_tree()->root_layer()->SetBounds(gfx::Size(1, 1));
513 gfx::Vector2d max_scroll_offset(51, 81); 513 gfx::Vector2d max_scroll_offset(51, 81);
514 layer()->SetBounds(gfx::Size(max_scroll_offset.x(), max_scroll_offset.y())); 514 layer()->SetBounds(gfx::Size(max_scroll_offset.x(), max_scroll_offset.y()));
515 host_impl_.active_tree()->BuildPropertyTreesForTesting(); 515 host_impl_.active_tree()->BuildPropertyTreesForTesting();
516 } 516 }
517 517
518 LayerImpl* layer() { 518 LayerImpl* layer() {
519 return host_impl_.active_tree()->root_layer()->children()[0].get(); 519 return host_impl_.active_tree()->root_layer()->children()[0];
520 } 520 }
521 521
522 ScrollTree* scroll_tree(LayerImpl* layer_impl) { 522 ScrollTree* scroll_tree(LayerImpl* layer_impl) {
523 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree; 523 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree;
524 } 524 }
525 525
526 LayerTreeHostImpl& host_impl() { return host_impl_; } 526 LayerTreeHostImpl& host_impl() { return host_impl_; }
527 527
528 LayerTreeImpl* tree() { return host_impl_.active_tree(); } 528 LayerTreeImpl* tree() { return host_impl_.active_tree(); }
529 529
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 666
667 pending_layer->PushPropertiesTo(layer()); 667 pending_layer->PushPropertiesTo(layer());
668 668
669 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); 669 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset());
670 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), 670 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(),
671 pending_layer->CurrentScrollOffset()); 671 pending_layer->CurrentScrollOffset());
672 } 672 }
673 673
674 } // namespace 674 } // namespace
675 } // namespace cc 675 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_list_iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698