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

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

Issue 1455023002: cc: Replace Pass() with std::move() in some subdirs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-cc
Patch Set: pass-cc2: . Created 5 years, 1 month 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/picture_layer_impl_perftest.cc ('k') | cc/layers/picture_layer_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 pending_root->RemoveChild(pending_root->children()[0].get()) 251 pending_root->RemoveChild(pending_root->children()[0].get())
252 .release())); 252 .release()));
253 if (!tile_size.IsEmpty()) 253 if (!tile_size.IsEmpty())
254 pending_layer->set_fixed_tile_size(tile_size); 254 pending_layer->set_fixed_tile_size(tile_size);
255 } 255 }
256 pending_root->SetHasRenderSurface(true); 256 pending_root->SetHasRenderSurface(true);
257 // The bounds() just mirror the raster source size. 257 // The bounds() just mirror the raster source size.
258 pending_layer->SetBounds(raster_source->GetSize()); 258 pending_layer->SetBounds(raster_source->GetSize());
259 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); 259 pending_layer->SetRasterSourceOnPending(raster_source, invalidation);
260 260
261 pending_root->AddChild(pending_layer.Pass()); 261 pending_root->AddChild(std::move(pending_layer));
262 pending_tree->SetRootLayer(pending_root.Pass()); 262 pending_tree->SetRootLayer(std::move(pending_root));
263 263
264 pending_layer_ = static_cast<FakePictureLayerImpl*>( 264 pending_layer_ = static_cast<FakePictureLayerImpl*>(
265 host_impl_.pending_tree()->LayerById(id_)); 265 host_impl_.pending_tree()->LayerById(id_));
266 266
267 // Add tilings/tiles for the layer. 267 // Add tilings/tiles for the layer.
268 bool update_lcd_text = false; 268 bool update_lcd_text = false;
269 RebuildPropertyTreesOnPendingTree(); 269 RebuildPropertyTreesOnPendingTree();
270 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 270 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
271 } 271 }
272 272
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 1356
1357 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source = 1357 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
1358 FakeDisplayListRasterSource::CreateFilled(layer_bounds); 1358 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1359 SetupPendingTree(valid_raster_source); 1359 SetupPendingTree(valid_raster_source);
1360 1360
1361 scoped_ptr<FakePictureLayerImpl> mask_ptr = 1361 scoped_ptr<FakePictureLayerImpl> mask_ptr =
1362 FakePictureLayerImpl::CreateMaskWithRasterSource( 1362 FakePictureLayerImpl::CreateMaskWithRasterSource(
1363 host_impl_.pending_tree(), 3, valid_raster_source); 1363 host_impl_.pending_tree(), 3, valid_raster_source);
1364 mask_ptr->SetBounds(layer_bounds); 1364 mask_ptr->SetBounds(layer_bounds);
1365 mask_ptr->SetDrawsContent(true); 1365 mask_ptr->SetDrawsContent(true);
1366 pending_layer_->SetMaskLayer(mask_ptr.Pass()); 1366 pending_layer_->SetMaskLayer(std::move(mask_ptr));
1367 pending_layer_->SetHasRenderSurface(true); 1367 pending_layer_->SetHasRenderSurface(true);
1368 1368
1369 RebuildPropertyTreesOnPendingTree(); 1369 RebuildPropertyTreesOnPendingTree();
1370 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1370 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1371 bool update_lcd_text = false; 1371 bool update_lcd_text = false;
1372 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 1372 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
1373 1373
1374 FakePictureLayerImpl* pending_mask = 1374 FakePictureLayerImpl* pending_mask =
1375 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); 1375 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer());
1376 1376
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 1485
1486 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source = 1486 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source =
1487 FakeDisplayListRasterSource::CreateFilled(layer_bounds); 1487 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
1488 SetupPendingTree(valid_raster_source); 1488 SetupPendingTree(valid_raster_source);
1489 1489
1490 scoped_ptr<FakePictureLayerImpl> mask_ptr = 1490 scoped_ptr<FakePictureLayerImpl> mask_ptr =
1491 FakePictureLayerImpl::CreateMaskWithRasterSource( 1491 FakePictureLayerImpl::CreateMaskWithRasterSource(
1492 host_impl_.pending_tree(), 3, valid_raster_source); 1492 host_impl_.pending_tree(), 3, valid_raster_source);
1493 mask_ptr->SetBounds(layer_bounds); 1493 mask_ptr->SetBounds(layer_bounds);
1494 mask_ptr->SetDrawsContent(true); 1494 mask_ptr->SetDrawsContent(true);
1495 pending_layer_->SetMaskLayer(mask_ptr.Pass()); 1495 pending_layer_->SetMaskLayer(std::move(mask_ptr));
1496 pending_layer_->SetHasRenderSurface(true); 1496 pending_layer_->SetHasRenderSurface(true);
1497 1497
1498 RebuildPropertyTreesOnPendingTree(); 1498 RebuildPropertyTreesOnPendingTree();
1499 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 1499 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
1500 bool update_lcd_text = false; 1500 bool update_lcd_text = false;
1501 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 1501 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
1502 1502
1503 FakePictureLayerImpl* pending_mask = 1503 FakePictureLayerImpl* pending_mask =
1504 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); 1504 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer());
1505 1505
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 tile->content_rect().size().ToString()); 1573 tile->content_rect().size().ToString());
1574 1574
1575 ResetTilingsAndRasterScales(); 1575 ResetTilingsAndRasterScales();
1576 1576
1577 // Change the max texture size on the output surface context. 1577 // Change the max texture size on the output surface context.
1578 scoped_ptr<TestWebGraphicsContext3D> context = 1578 scoped_ptr<TestWebGraphicsContext3D> context =
1579 TestWebGraphicsContext3D::Create(); 1579 TestWebGraphicsContext3D::Create();
1580 context->set_max_texture_size(140); 1580 context->set_max_texture_size(140);
1581 host_impl_.DidLoseOutputSurface(); 1581 host_impl_.DidLoseOutputSurface();
1582 scoped_ptr<OutputSurface> new_output_surface = 1582 scoped_ptr<OutputSurface> new_output_surface =
1583 FakeOutputSurface::Create3d(context.Pass()); 1583 FakeOutputSurface::Create3d(std::move(context));
1584 host_impl_.SetVisible(true); 1584 host_impl_.SetVisible(true);
1585 host_impl_.InitializeRenderer(new_output_surface.get()); 1585 host_impl_.InitializeRenderer(new_output_surface.get());
1586 output_surface_ = new_output_surface.Pass(); 1586 output_surface_ = std::move(new_output_surface);
1587 1587
1588 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, 1588 SetupDrawPropertiesAndUpdateTiles(pending_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
1589 false); 1589 false);
1590 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1590 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
1591 1591
1592 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1592 pending_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1593 1593
1594 // Verify the tiles are not larger than the context's max texture size. 1594 // Verify the tiles are not larger than the context's max texture size.
1595 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0]; 1595 tile = pending_layer_->tilings()->tiling_at(0)->AllTilesForTesting()[0];
1596 EXPECT_GE(140, tile->content_rect().width()); 1596 EXPECT_GE(140, tile->content_rect().width());
(...skipping 16 matching lines...) Expand all
1613 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size()); 1613 EXPECT_EQ(1u, high_res_tiling->AllTilesForTesting().size());
1614 1614
1615 ResetTilingsAndRasterScales(); 1615 ResetTilingsAndRasterScales();
1616 1616
1617 // Change the max texture size on the output surface context. 1617 // Change the max texture size on the output surface context.
1618 scoped_ptr<TestWebGraphicsContext3D> context = 1618 scoped_ptr<TestWebGraphicsContext3D> context =
1619 TestWebGraphicsContext3D::Create(); 1619 TestWebGraphicsContext3D::Create();
1620 context->set_max_texture_size(140); 1620 context->set_max_texture_size(140);
1621 host_impl_.DidLoseOutputSurface(); 1621 host_impl_.DidLoseOutputSurface();
1622 scoped_ptr<OutputSurface> new_output_surface = 1622 scoped_ptr<OutputSurface> new_output_surface =
1623 FakeOutputSurface::Create3d(context.Pass()); 1623 FakeOutputSurface::Create3d(std::move(context));
1624 host_impl_.SetVisible(true); 1624 host_impl_.SetVisible(true);
1625 host_impl_.InitializeRenderer(new_output_surface.get()); 1625 host_impl_.InitializeRenderer(new_output_surface.get());
1626 output_surface_ = new_output_surface.Pass(); 1626 output_surface_ = std::move(new_output_surface);
1627 1627
1628 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f, 1628 SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, 0.f,
1629 false); 1629 false);
1630 ASSERT_LE(1u, active_layer_->tilings()->num_tilings()); 1630 ASSERT_LE(1u, active_layer_->tilings()->num_tilings());
1631 1631
1632 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 1632 active_layer_->tilings()->tiling_at(0)->CreateAllTilesForTesting();
1633 1633
1634 // There should be more than one tile since the max texture size won't cover 1634 // There should be more than one tile since the max texture size won't cover
1635 // the layer. 1635 // the layer.
1636 high_res_tiling = active_layer_->tilings()->tiling_at(0); 1636 high_res_tiling = active_layer_->tilings()->tiling_at(0);
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source = 2280 scoped_refptr<FakeDisplayListRasterSource> pending_raster_source =
2281 FakeDisplayListRasterSource::CreateFilled(layer_bounds); 2281 FakeDisplayListRasterSource::CreateFilled(layer_bounds);
2282 2282
2283 host_impl_.CreatePendingTree(); 2283 host_impl_.CreatePendingTree();
2284 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); 2284 LayerTreeImpl* pending_tree = host_impl_.pending_tree();
2285 2285
2286 scoped_ptr<FakePictureLayerImpl> pending_layer = 2286 scoped_ptr<FakePictureLayerImpl> pending_layer =
2287 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, 2287 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_,
2288 pending_raster_source); 2288 pending_raster_source);
2289 pending_layer->SetDrawsContent(true); 2289 pending_layer->SetDrawsContent(true);
2290 pending_tree->SetRootLayer(pending_layer.Pass()); 2290 pending_tree->SetRootLayer(std::move(pending_layer));
2291 2291
2292 pending_layer_ = static_cast<FakePictureLayerImpl*>( 2292 pending_layer_ = static_cast<FakePictureLayerImpl*>(
2293 host_impl_.pending_tree()->LayerById(id_)); 2293 host_impl_.pending_tree()->LayerById(id_));
2294 2294
2295 // Set some state on the pending layer, make sure it is not clobbered 2295 // Set some state on the pending layer, make sure it is not clobbered
2296 // by a sync from the active layer. This could happen because if the 2296 // by a sync from the active layer. This could happen because if the
2297 // pending layer has not been post-commit initialized it will attempt 2297 // pending layer has not been post-commit initialized it will attempt
2298 // to sync from the active layer. 2298 // to sync from the active layer.
2299 float raster_page_scale = 10.f * pending_layer_->raster_page_scale(); 2299 float raster_page_scale = 10.f * pending_layer_->raster_page_scale();
2300 pending_layer_->set_raster_page_scale(raster_page_scale); 2300 pending_layer_->set_raster_page_scale(raster_page_scale);
(...skipping 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after
5041 // New low res tiling. 5041 // New low res tiling.
5042 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); 5042 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles());
5043 5043
5044 // This tiling will be high res now, it won't contain low res content since it 5044 // This tiling will be high res now, it won't contain low res content since it
5045 // was all destroyed. 5045 // was all destroyed.
5046 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); 5046 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles());
5047 } 5047 }
5048 5048
5049 } // namespace 5049 } // namespace
5050 } // namespace cc 5050 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_perftest.cc ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698