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

Unified Diff: cc/tiles/tile_manager_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tiles/tile_manager_perftest.cc ('k') | cc/trees/damage_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/tile_manager_unittest.cc
diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc
index f1659a0f6bc355fdf5998c9c0d258248be7da3ef..531708102abe2bd66617015fd8fb4a1daddef95a 100644
--- a/cc/tiles/tile_manager_unittest.cc
+++ b/cc/tiles/tile_manager_unittest.cc
@@ -126,23 +126,24 @@ class TileManagerTilePriorityQueueTest : public testing::Test {
LayerTreeImpl* pending_tree = host_impl_.pending_tree();
// Steal from the recycled tree.
- scoped_ptr<LayerImpl> old_pending_root = pending_tree->DetachLayerTree();
+ LayerImpl* old_pending_root = pending_tree->root_layer();
DCHECK(!old_pending_root || old_pending_root->id() == id_);
- scoped_ptr<FakePictureLayerImpl> pending_layer;
+ FakePictureLayerImpl* pending_layer = nullptr;
if (old_pending_root) {
- pending_layer.reset(
- static_cast<FakePictureLayerImpl*>(old_pending_root.release()));
+ pending_layer = static_cast<FakePictureLayerImpl*>(old_pending_root);
pending_layer->SetRasterSourceOnPending(raster_source, Region());
} else {
- pending_layer = FakePictureLayerImpl::CreateWithRasterSource(
- pending_tree, id_, raster_source);
+ scoped_ptr<FakePictureLayerImpl> new_root =
+ FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_,
+ raster_source);
+ pending_layer = new_root.get();
+ pending_tree->SetRootLayer(std::move(new_root));
pending_layer->SetDrawsContent(true);
pending_layer->SetHasRenderSurface(true);
}
// The bounds() just mirror the raster source size.
pending_layer->SetBounds(pending_layer->raster_source()->GetSize());
- pending_tree->SetRootLayer(std::move(pending_layer));
pending_layer_ = static_cast<FakePictureLayerImpl*>(
host_impl_.pending_tree()->LayerById(id_));
@@ -907,7 +908,7 @@ TEST_F(TileManagerTilePriorityQueueTest,
pending_layer_->AddChild(std::move(pending_child));
FakePictureLayerImpl* pending_child_layer =
- static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0].get());
+ static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]);
pending_child_layer->SetDrawsContent(true);
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
@@ -920,7 +921,7 @@ TEST_F(TileManagerTilePriorityQueueTest,
SetupPendingTree(pending_raster_source);
FakePictureLayerImpl* active_child_layer =
- static_cast<FakePictureLayerImpl*>(active_layer_->children()[0].get());
+ static_cast<FakePictureLayerImpl*>(active_layer_->children()[0]);
std::set<Tile*> all_tiles;
size_t tile_count = 0;
@@ -1622,22 +1623,24 @@ class TileManagerTest : public testing::Test {
LayerTreeImpl* pending_tree = host_impl_->pending_tree();
// Steal from the recycled tree.
- scoped_ptr<LayerImpl> old_pending_root = pending_tree->DetachLayerTree();
- scoped_ptr<FakePictureLayerImpl> pending_layer;
+ LayerImpl* old_pending_root = pending_tree->root_layer();
+ FakePictureLayerImpl* pending_layer = nullptr;
if (old_pending_root) {
- pending_layer.reset(
- static_cast<FakePictureLayerImpl*>(old_pending_root.release()));
+ pending_layer = static_cast<FakePictureLayerImpl*>(old_pending_root);
pending_layer->SetRasterSourceOnPending(raster_source, Region());
} else {
int id = 7;
- pending_layer = FakePictureLayerImpl::CreateWithRasterSource(
- pending_tree, id, raster_source);
+ scoped_ptr<FakePictureLayerImpl> new_root =
+ FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id,
+ raster_source);
+ pending_layer = new_root.get();
pending_layer->SetDrawsContent(true);
pending_layer->SetHasRenderSurface(true);
+ pending_tree->SetRootLayer(std::move(new_root));
}
+
// The bounds() just mirror the raster source size.
pending_layer->SetBounds(pending_layer->raster_source()->GetSize());
- pending_tree->SetRootLayer(std::move(pending_layer));
// Add tilings/tiles for the layer.
bool update_lcd_text = false;
« no previous file with comments | « cc/tiles/tile_manager_perftest.cc ('k') | cc/trees/damage_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698