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

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

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 10 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/resources/tile_manager_perftest.cc ('k') | cc/resources/tile_priority.h » ('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/resources/eviction_tile_priority_queue.h" 5 #include "cc/resources/eviction_tile_priority_queue.h"
6 #include "cc/resources/raster_tile_priority_queue.h" 6 #include "cc/resources/raster_tile_priority_queue.h"
7 #include "cc/resources/tile.h" 7 #include "cc/resources/tile.h"
8 #include "cc/resources/tile_priority.h" 8 #include "cc/resources/tile_priority.h"
9 #include "cc/resources/tiling_set_raster_queue_all.h" 9 #include "cc/resources/tiling_set_raster_queue_all.h"
10 #include "cc/test/begin_frame_args_test.h" 10 #include "cc/test/begin_frame_args_test.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 pending_layer->SetHasRenderSurface(true); 120 pending_layer->SetHasRenderSurface(true);
121 } 121 }
122 // The bounds() just mirror the pile size. 122 // The bounds() just mirror the pile size.
123 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); 123 pending_layer->SetBounds(pending_layer->raster_source()->GetSize());
124 pending_tree->SetRootLayer(pending_layer.Pass()); 124 pending_tree->SetRootLayer(pending_layer.Pass());
125 125
126 pending_layer_ = static_cast<FakePictureLayerImpl*>( 126 pending_layer_ = static_cast<FakePictureLayerImpl*>(
127 host_impl_.pending_tree()->LayerById(id_)); 127 host_impl_.pending_tree()->LayerById(id_));
128 128
129 // Add tilings/tiles for the layer. 129 // Add tilings/tiles for the layer.
130 host_impl_.pending_tree()->UpdateDrawProperties(); 130 bool update_lcd_text = false;
131 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
131 } 132 }
132 133
133 TileManager* tile_manager() { return host_impl_.tile_manager(); } 134 TileManager* tile_manager() { return host_impl_.tile_manager(); }
134 135
135 protected: 136 protected:
136 GlobalStateThatImpactsTilePriority global_state_; 137 GlobalStateThatImpactsTilePriority global_state_;
137 138
138 TestSharedBitmapManager shared_bitmap_manager_; 139 TestSharedBitmapManager shared_bitmap_manager_;
139 TileMemoryLimitPolicy memory_limit_policy_; 140 TileMemoryLimitPolicy memory_limit_policy_;
140 int max_tiles_; 141 int max_tiles_;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 id_ + 1, pending_pile); 535 id_ + 1, pending_pile);
535 FakePictureLayerImpl* pending_child_raw = pending_child.get(); 536 FakePictureLayerImpl* pending_child_raw = pending_child.get();
536 pending_child_raw->SetDrawsContent(true); 537 pending_child_raw->SetDrawsContent(true);
537 pending_layer_->AddChild(pending_child.Pass()); 538 pending_layer_->AddChild(pending_child.Pass());
538 539
539 // Set a small viewport, so we have soon and eventually tiles. 540 // Set a small viewport, so we have soon and eventually tiles.
540 host_impl_.SetViewportSize(gfx::Size(200, 200)); 541 host_impl_.SetViewportSize(gfx::Size(200, 200));
541 time_ticks += base::TimeDelta::FromMilliseconds(1); 542 time_ticks += base::TimeDelta::FromMilliseconds(1);
542 host_impl_.SetCurrentBeginFrameArgs( 543 host_impl_.SetCurrentBeginFrameArgs(
543 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 544 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
544 host_impl_.pending_tree()->UpdateDrawProperties(); 545 bool update_lcd_text = false;
546 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
545 547
546 host_impl_.SetRequiresHighResToDraw(); 548 host_impl_.SetRequiresHighResToDraw();
547 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( 549 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue(
548 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); 550 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL));
549 EXPECT_FALSE(queue->IsEmpty()); 551 EXPECT_FALSE(queue->IsEmpty());
550 552
551 // Get all the tiles that are NOW or SOON and make sure they are ready to 553 // Get all the tiles that are NOW or SOON and make sure they are ready to
552 // draw. 554 // draw.
553 std::vector<Tile*> all_tiles; 555 std::vector<Tile*> all_tiles;
554 while (!queue->IsEmpty()) { 556 while (!queue->IsEmpty()) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 pending_pile); 766 pending_pile);
765 pending_layer_->AddChild(pending_child.Pass()); 767 pending_layer_->AddChild(pending_child.Pass());
766 768
767 FakePictureLayerImpl* pending_child_layer = 769 FakePictureLayerImpl* pending_child_layer =
768 static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]); 770 static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]);
769 pending_child_layer->SetDrawsContent(true); 771 pending_child_layer->SetDrawsContent(true);
770 772
771 time_ticks += base::TimeDelta::FromMilliseconds(1); 773 time_ticks += base::TimeDelta::FromMilliseconds(1);
772 host_impl_.SetCurrentBeginFrameArgs( 774 host_impl_.SetCurrentBeginFrameArgs(
773 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 775 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
774 host_impl_.pending_tree()->UpdateDrawProperties(); 776 bool update_lcd_text = false;
777 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
775 778
776 ActivateTree(); 779 ActivateTree();
777 SetupPendingTree(pending_pile); 780 SetupPendingTree(pending_pile);
778 781
779 FakePictureLayerImpl* active_child_layer = 782 FakePictureLayerImpl* active_child_layer =
780 static_cast<FakePictureLayerImpl*>(active_layer_->children()[0]); 783 static_cast<FakePictureLayerImpl*>(active_layer_->children()[0]);
781 784
782 std::set<Tile*> all_tiles; 785 std::set<Tile*> all_tiles;
783 size_t tile_count = 0; 786 size_t tile_count = 0;
784 scoped_ptr<RasterTilePriorityQueue> raster_queue(host_impl_.BuildRasterQueue( 787 scoped_ptr<RasterTilePriorityQueue> raster_queue(host_impl_.BuildRasterQueue(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 FakePictureLayerImpl* pending_child_layer = pending_child.get(); 905 FakePictureLayerImpl* pending_child_layer = pending_child.get();
903 pending_layer_->AddChild(pending_child.Pass()); 906 pending_layer_->AddChild(pending_child.Pass());
904 907
905 // Create a fully transparent child layer so that its tile priorities are not 908 // Create a fully transparent child layer so that its tile priorities are not
906 // considered to be valid. 909 // considered to be valid.
907 pending_child_layer->SetDrawsContent(true); 910 pending_child_layer->SetDrawsContent(true);
908 911
909 time_ticks += base::TimeDelta::FromMilliseconds(1); 912 time_ticks += base::TimeDelta::FromMilliseconds(1);
910 host_impl_.SetCurrentBeginFrameArgs( 913 host_impl_.SetCurrentBeginFrameArgs(
911 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 914 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
912 host_impl_.pending_tree()->UpdateDrawProperties(); 915 bool update_lcd_text = false;
916 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
913 917
914 pending_child_layer->SetOpacity(0.0); 918 pending_child_layer->SetOpacity(0.0);
915 919
916 time_ticks += base::TimeDelta::FromMilliseconds(1); 920 time_ticks += base::TimeDelta::FromMilliseconds(1);
917 host_impl_.SetCurrentBeginFrameArgs( 921 host_impl_.SetCurrentBeginFrameArgs(
918 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 922 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
919 host_impl_.pending_tree()->UpdateDrawProperties(); 923 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
920 924
921 // Renew all of the tile priorities. 925 // Renew all of the tile priorities.
922 gfx::Rect viewport(layer_bounds); 926 gfx::Rect viewport(layer_bounds);
923 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, 927 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
924 Occlusion()); 928 Occlusion());
925 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, 929 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
926 Occlusion()); 930 Occlusion());
927 pending_child_layer->HighResTiling()->ComputeTilePriorityRects( 931 pending_child_layer->HighResTiling()->ComputeTilePriorityRects(
928 viewport, 1.0f, 1.0, Occlusion()); 932 viewport, 1.0f, 1.0, Occlusion());
929 pending_child_layer->LowResTiling()->ComputeTilePriorityRects( 933 pending_child_layer->LowResTiling()->ComputeTilePriorityRects(
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 EXPECT_GT(eventually_bin_order_correct_count, 1272 EXPECT_GT(eventually_bin_order_correct_count,
1269 eventually_bin_order_incorrect_count); 1273 eventually_bin_order_incorrect_count);
1270 1274
1271 EXPECT_TRUE(have_tiles[TilePriority::NOW]); 1275 EXPECT_TRUE(have_tiles[TilePriority::NOW]);
1272 EXPECT_TRUE(have_tiles[TilePriority::SOON]); 1276 EXPECT_TRUE(have_tiles[TilePriority::SOON]);
1273 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); 1277 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]);
1274 } 1278 }
1275 1279
1276 } // namespace 1280 } // namespace
1277 } // namespace cc 1281 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager_perftest.cc ('k') | cc/resources/tile_priority.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698