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

Side by Side Diff: cc/tiles/tile_manager_unittest.cc

Issue 2032303004: cc : Add layer_list to LayerTreeImpl and build it for tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/tiles/tile_manager_perftest.cc ('k') | cc/trees/layer_tree_host_common_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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 host_impl()->pending_tree(), layer_id() + 1, pending_raster_source); 564 host_impl()->pending_tree(), layer_id() + 1, pending_raster_source);
565 FakePictureLayerImpl* pending_child_raw = pending_child.get(); 565 FakePictureLayerImpl* pending_child_raw = pending_child.get();
566 pending_child_raw->SetDrawsContent(true); 566 pending_child_raw->SetDrawsContent(true);
567 pending_layer()->AddChild(std::move(pending_child)); 567 pending_layer()->AddChild(std::move(pending_child));
568 568
569 // Set a small viewport, so we have soon and eventually tiles. 569 // Set a small viewport, so we have soon and eventually tiles.
570 host_impl()->SetViewportSize(gfx::Size(200, 200)); 570 host_impl()->SetViewportSize(gfx::Size(200, 200));
571 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 571 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
572 bool update_lcd_text = false; 572 bool update_lcd_text = false;
573 host_impl()->pending_tree()->property_trees()->needs_rebuild = true; 573 host_impl()->pending_tree()->property_trees()->needs_rebuild = true;
574 host_impl()->pending_tree()->BuildPropertyTreesForTesting(); 574 host_impl()->pending_tree()->BuildLayerListAndPropertyTreesForTesting();
575 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); 575 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text);
576 576
577 host_impl()->SetRequiresHighResToDraw(); 577 host_impl()->SetRequiresHighResToDraw();
578 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( 578 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue(
579 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); 579 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL));
580 EXPECT_FALSE(queue->IsEmpty()); 580 EXPECT_FALSE(queue->IsEmpty());
581 581
582 // Get all the tiles that are NOW or SOON and make sure they are ready to 582 // Get all the tiles that are NOW or SOON and make sure they are ready to
583 // draw. 583 // draw.
584 std::vector<Tile*> all_tiles; 584 std::vector<Tile*> all_tiles;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 2, pending_raster_source); 786 2, pending_raster_source);
787 pending_layer()->AddChild(std::move(pending_child)); 787 pending_layer()->AddChild(std::move(pending_child));
788 788
789 FakePictureLayerImpl* pending_child_layer = 789 FakePictureLayerImpl* pending_child_layer =
790 static_cast<FakePictureLayerImpl*>(pending_layer()->children()[0]); 790 static_cast<FakePictureLayerImpl*>(pending_layer()->children()[0]);
791 pending_child_layer->SetDrawsContent(true); 791 pending_child_layer->SetDrawsContent(true);
792 792
793 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 793 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
794 bool update_lcd_text = false; 794 bool update_lcd_text = false;
795 host_impl()->pending_tree()->property_trees()->needs_rebuild = true; 795 host_impl()->pending_tree()->property_trees()->needs_rebuild = true;
796 host_impl()->pending_tree()->BuildPropertyTreesForTesting(); 796 host_impl()->pending_tree()->BuildLayerListAndPropertyTreesForTesting();
797 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); 797 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text);
798 798
799 ActivateTree(); 799 ActivateTree();
800 SetupPendingTree(pending_raster_source); 800 SetupPendingTree(pending_raster_source);
801 801
802 FakePictureLayerImpl* active_child_layer = 802 FakePictureLayerImpl* active_child_layer =
803 static_cast<FakePictureLayerImpl*>(active_layer()->children()[0]); 803 static_cast<FakePictureLayerImpl*>(active_layer()->children()[0]);
804 804
805 std::set<Tile*> all_tiles; 805 std::set<Tile*> all_tiles;
806 size_t tile_count = 0; 806 size_t tile_count = 0;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 pending_layer()->AddChild(std::move(pending_child)); 901 pending_layer()->AddChild(std::move(pending_child));
902 902
903 // Create a fully transparent child layer so that its tile priorities are not 903 // Create a fully transparent child layer so that its tile priorities are not
904 // considered to be valid. 904 // considered to be valid.
905 pending_child_layer->SetDrawsContent(true); 905 pending_child_layer->SetDrawsContent(true);
906 pending_child_layer->test_properties()->force_render_surface = true; 906 pending_child_layer->test_properties()->force_render_surface = true;
907 907
908 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 908 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
909 bool update_lcd_text = false; 909 bool update_lcd_text = false;
910 host_impl()->pending_tree()->property_trees()->needs_rebuild = true; 910 host_impl()->pending_tree()->property_trees()->needs_rebuild = true;
911 host_impl()->pending_tree()->BuildPropertyTreesForTesting(); 911 host_impl()->pending_tree()->BuildLayerListAndPropertyTreesForTesting();
912 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); 912 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text);
913 913
914 pending_child_layer->OnOpacityAnimated(0.0); 914 pending_child_layer->OnOpacityAnimated(0.0);
915 915
916 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); 916 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
917 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); 917 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text);
918 918
919 // Renew all of the tile priorities. 919 // Renew all of the tile priorities.
920 gfx::Rect viewport(layer_bounds); 920 gfx::Rect viewport(layer_bounds);
921 pending_layer()->picture_layer_tiling_set()->UpdateTilePriorities( 921 pending_layer()->picture_layer_tiling_set()->UpdateTilePriorities(
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId, 1752 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId,
1753 pending_raster_source); 1753 pending_raster_source);
1754 pending_layer->SetDrawsContent(true); 1754 pending_layer->SetDrawsContent(true);
1755 pending_layer->SetHasRenderSurface(true); 1755 pending_layer->SetHasRenderSurface(true);
1756 1756
1757 // The bounds() just mirror the raster source size. 1757 // The bounds() just mirror the raster source size.
1758 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); 1758 pending_layer->SetBounds(pending_layer->raster_source()->GetSize());
1759 pending_tree->SetRootLayer(std::move(pending_layer)); 1759 pending_tree->SetRootLayer(std::move(pending_layer));
1760 1760
1761 // Add tilings/tiles for the layer. 1761 // Add tilings/tiles for the layer.
1762 host_impl()->pending_tree()->BuildPropertyTreesForTesting(); 1762 host_impl()->pending_tree()->BuildLayerListAndPropertyTreesForTesting();
1763 host_impl()->pending_tree()->UpdateDrawProperties( 1763 host_impl()->pending_tree()->UpdateDrawProperties(
1764 false /* update_lcd_text */); 1764 false /* update_lcd_text */);
1765 1765
1766 // Build the raster queue and invalidate the top tile. 1766 // Build the raster queue and invalidate the top tile.
1767 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( 1767 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue(
1768 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); 1768 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL));
1769 EXPECT_FALSE(queue->IsEmpty()); 1769 EXPECT_FALSE(queue->IsEmpty());
1770 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId); 1770 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId);
1771 1771
1772 // PrepareTiles to schedule tasks. Due to the FakeTileTaskManagerImpl, 1772 // PrepareTiles to schedule tasks. Due to the FakeTileTaskManagerImpl,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId, 1849 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId,
1850 pending_raster_source); 1850 pending_raster_source);
1851 pending_layer->SetDrawsContent(true); 1851 pending_layer->SetDrawsContent(true);
1852 pending_layer->SetHasRenderSurface(true); 1852 pending_layer->SetHasRenderSurface(true);
1853 1853
1854 // The bounds() just mirror the raster source size. 1854 // The bounds() just mirror the raster source size.
1855 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); 1855 pending_layer->SetBounds(pending_layer->raster_source()->GetSize());
1856 pending_tree->SetRootLayer(std::move(pending_layer)); 1856 pending_tree->SetRootLayer(std::move(pending_layer));
1857 1857
1858 // Add tilings/tiles for the layer. 1858 // Add tilings/tiles for the layer.
1859 host_impl->pending_tree()->BuildPropertyTreesForTesting(); 1859 host_impl->pending_tree()->BuildLayerListAndPropertyTreesForTesting();
1860 host_impl->pending_tree()->UpdateDrawProperties(false /* update_lcd_text */); 1860 host_impl->pending_tree()->UpdateDrawProperties(false /* update_lcd_text */);
1861 1861
1862 // Build the raster queue and invalidate the top tile. 1862 // Build the raster queue and invalidate the top tile.
1863 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl->BuildRasterQueue( 1863 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl->BuildRasterQueue(
1864 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); 1864 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL));
1865 EXPECT_FALSE(queue->IsEmpty()); 1865 EXPECT_FALSE(queue->IsEmpty());
1866 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId); 1866 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId);
1867 1867
1868 // PrepareTiles to schedule tasks. Due to the 1868 // PrepareTiles to schedule tasks. Due to the
1869 // VerifyPreviousContentRasterBufferProvider, these tasks will verified and 1869 // VerifyPreviousContentRasterBufferProvider, these tasks will verified and
(...skipping 12 matching lines...) Expand all
1882 } 1882 }
1883 1883
1884 // Ensures that the tile manager does not attempt to reuse tiles when partial 1884 // Ensures that the tile manager does not attempt to reuse tiles when partial
1885 // raster is disabled. 1885 // raster is disabled.
1886 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { 1886 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) {
1887 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); 1887 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */);
1888 } 1888 }
1889 1889
1890 } // namespace 1890 } // namespace
1891 } // namespace cc 1891 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager_perftest.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698