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

Side by Side Diff: cc/test/test_layer_tree_host_base.cc

Issue 2080223010: cc: Clean up root_layer code in LTI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase++ Created 4 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
« no previous file with comments | « cc/test/layer_tree_json_parser_unittest.cc ('k') | cc/tiles/tile_manager_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/test/test_layer_tree_host_base.h" 5 #include "cc/test/test_layer_tree_host_base.h"
6 6
7 #include "cc/test/fake_output_surface.h" 7 #include "cc/test/fake_output_surface.h"
8 #include "cc/test/fake_raster_source.h" 8 #include "cc/test/fake_raster_source.h"
9 #include "cc/trees/layer_tree_impl.h" 9 #include "cc/trees/layer_tree_impl.h"
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const gfx::Size& tile_size, 98 const gfx::Size& tile_size,
99 const Region& invalidation) { 99 const Region& invalidation) {
100 host_impl()->CreatePendingTree(); 100 host_impl()->CreatePendingTree();
101 host_impl()->pending_tree()->PushPageScaleFromMainThread(1.f, 0.00001f, 101 host_impl()->pending_tree()->PushPageScaleFromMainThread(1.f, 0.00001f,
102 100000.f); 102 100000.f);
103 LayerTreeImpl* pending_tree = host_impl()->pending_tree(); 103 LayerTreeImpl* pending_tree = host_impl()->pending_tree();
104 pending_tree->SetDeviceScaleFactor( 104 pending_tree->SetDeviceScaleFactor(
105 host_impl()->active_tree()->device_scale_factor()); 105 host_impl()->active_tree()->device_scale_factor());
106 106
107 // Steal from the recycled tree if possible. 107 // Steal from the recycled tree if possible.
108 LayerImpl* pending_root = pending_tree->root_layer(); 108 LayerImpl* pending_root = pending_tree->root_layer_for_testing();
109 std::unique_ptr<FakePictureLayerImpl> pending_layer; 109 std::unique_ptr<FakePictureLayerImpl> pending_layer;
110 DCHECK(!pending_root || pending_root->id() == root_id_); 110 DCHECK(!pending_root || pending_root->id() == root_id_);
111 if (!pending_root) { 111 if (!pending_root) {
112 std::unique_ptr<LayerImpl> new_pending_root = 112 std::unique_ptr<LayerImpl> new_pending_root =
113 LayerImpl::Create(pending_tree, root_id_); 113 LayerImpl::Create(pending_tree, root_id_);
114 pending_layer = FakePictureLayerImpl::Create(pending_tree, id_); 114 pending_layer = FakePictureLayerImpl::Create(pending_tree, id_);
115 if (!tile_size.IsEmpty()) 115 if (!tile_size.IsEmpty())
116 pending_layer->set_fixed_tile_size(tile_size); 116 pending_layer->set_fixed_tile_size(tile_size);
117 pending_layer->SetDrawsContent(true); 117 pending_layer->SetDrawsContent(true);
118 pending_layer->SetScrollClipLayer(new_pending_root->id()); 118 pending_layer->SetScrollClipLayer(new_pending_root->id());
119 pending_root = new_pending_root.get(); 119 pending_root = new_pending_root.get();
120 pending_tree->SetRootLayer(std::move(new_pending_root)); 120 pending_tree->SetRootLayerForTesting(std::move(new_pending_root));
121 } else { 121 } else {
122 pending_layer.reset(static_cast<FakePictureLayerImpl*>( 122 pending_layer.reset(static_cast<FakePictureLayerImpl*>(
123 pending_root->test_properties() 123 pending_root->test_properties()
124 ->RemoveChild(pending_root->test_properties()->children[0]) 124 ->RemoveChild(pending_root->test_properties()->children[0])
125 .release())); 125 .release()));
126 if (!tile_size.IsEmpty()) 126 if (!tile_size.IsEmpty())
127 pending_layer->set_fixed_tile_size(tile_size); 127 pending_layer->set_fixed_tile_size(tile_size);
128 } 128 }
129 pending_root->test_properties()->force_render_surface = true; 129 pending_root->test_properties()->force_render_surface = true;
130 // The bounds() just mirror the raster source size. 130 // The bounds() just mirror the raster source size.
131 pending_layer->SetBounds(raster_source->GetSize()); 131 pending_layer->SetBounds(raster_source->GetSize());
132 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); 132 pending_layer->SetRasterSourceOnPending(raster_source, invalidation);
133 133
134 pending_root->test_properties()->AddChild(std::move(pending_layer)); 134 pending_root->test_properties()->AddChild(std::move(pending_layer));
135 pending_tree->SetViewportLayersFromIds(Layer::INVALID_ID, 135 pending_tree->SetViewportLayersFromIds(
136 pending_tree->root_layer()->id(), 136 Layer::INVALID_ID, pending_tree->root_layer_for_testing()->id(),
137 Layer::INVALID_ID, Layer::INVALID_ID); 137 Layer::INVALID_ID, Layer::INVALID_ID);
138 138
139 pending_layer_ = static_cast<FakePictureLayerImpl*>( 139 pending_layer_ = static_cast<FakePictureLayerImpl*>(
140 host_impl()->pending_tree()->LayerById(id_)); 140 host_impl()->pending_tree()->LayerById(id_));
141 141
142 // Add tilings/tiles for the layer. 142 // Add tilings/tiles for the layer.
143 bool update_lcd_text = false; 143 bool update_lcd_text = false;
144 RebuildPropertyTreesOnPendingTree(); 144 RebuildPropertyTreesOnPendingTree();
145 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); 145 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text);
146 } 146 }
147 147
(...skipping 24 matching lines...) Expand all
172 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; 172 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2;
173 state.memory_limit_policy = ALLOW_ANYTHING; 173 state.memory_limit_policy = ALLOW_ANYTHING;
174 state.tree_priority = SAME_PRIORITY_FOR_BOTH_TREES; 174 state.tree_priority = SAME_PRIORITY_FOR_BOTH_TREES;
175 175
176 host_impl_->resource_pool()->SetResourceUsageLimits( 176 host_impl_->resource_pool()->SetResourceUsageLimits(
177 state.soft_memory_limit_in_bytes, state.num_resources_limit); 177 state.soft_memory_limit_in_bytes, state.num_resources_limit);
178 host_impl_->tile_manager()->SetGlobalStateForTesting(state); 178 host_impl_->tile_manager()->SetGlobalStateForTesting(state);
179 } 179 }
180 180
181 } // namespace cc 181 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_json_parser_unittest.cc ('k') | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698