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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 bool update_lcd_text = false; 130 host_impl_.pending_tree()->UpdateDrawProperties();
131 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
132 } 131 }
133 132
134 TileManager* tile_manager() { return host_impl_.tile_manager(); } 133 TileManager* tile_manager() { return host_impl_.tile_manager(); }
135 134
136 protected: 135 protected:
137 GlobalStateThatImpactsTilePriority global_state_; 136 GlobalStateThatImpactsTilePriority global_state_;
138 137
139 TestSharedBitmapManager shared_bitmap_manager_; 138 TestSharedBitmapManager shared_bitmap_manager_;
140 TileMemoryLimitPolicy memory_limit_policy_; 139 TileMemoryLimitPolicy memory_limit_policy_;
141 int max_tiles_; 140 int max_tiles_;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 id_ + 1, pending_pile); 534 id_ + 1, pending_pile);
536 FakePictureLayerImpl* pending_child_raw = pending_child.get(); 535 FakePictureLayerImpl* pending_child_raw = pending_child.get();
537 pending_child_raw->SetDrawsContent(true); 536 pending_child_raw->SetDrawsContent(true);
538 pending_layer_->AddChild(pending_child.Pass()); 537 pending_layer_->AddChild(pending_child.Pass());
539 538
540 // Set a small viewport, so we have soon and eventually tiles. 539 // Set a small viewport, so we have soon and eventually tiles.
541 host_impl_.SetViewportSize(gfx::Size(200, 200)); 540 host_impl_.SetViewportSize(gfx::Size(200, 200));
542 time_ticks += base::TimeDelta::FromMilliseconds(1); 541 time_ticks += base::TimeDelta::FromMilliseconds(1);
543 host_impl_.SetCurrentBeginFrameArgs( 542 host_impl_.SetCurrentBeginFrameArgs(
544 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 543 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
545 bool update_lcd_text = false; 544 host_impl_.pending_tree()->UpdateDrawProperties();
546 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
547 545
548 host_impl_.SetRequiresHighResToDraw(); 546 host_impl_.SetRequiresHighResToDraw();
549 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( 547 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue(
550 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); 548 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL));
551 EXPECT_FALSE(queue->IsEmpty()); 549 EXPECT_FALSE(queue->IsEmpty());
552 550
553 // Get all the tiles that are NOW or SOON and make sure they are ready to 551 // Get all the tiles that are NOW or SOON and make sure they are ready to
554 // draw. 552 // draw.
555 std::vector<Tile*> all_tiles; 553 std::vector<Tile*> all_tiles;
556 while (!queue->IsEmpty()) { 554 while (!queue->IsEmpty()) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 pending_pile); 764 pending_pile);
767 pending_layer_->AddChild(pending_child.Pass()); 765 pending_layer_->AddChild(pending_child.Pass());
768 766
769 FakePictureLayerImpl* pending_child_layer = 767 FakePictureLayerImpl* pending_child_layer =
770 static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]); 768 static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]);
771 pending_child_layer->SetDrawsContent(true); 769 pending_child_layer->SetDrawsContent(true);
772 770
773 time_ticks += base::TimeDelta::FromMilliseconds(1); 771 time_ticks += base::TimeDelta::FromMilliseconds(1);
774 host_impl_.SetCurrentBeginFrameArgs( 772 host_impl_.SetCurrentBeginFrameArgs(
775 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 773 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
776 bool update_lcd_text = false; 774 host_impl_.pending_tree()->UpdateDrawProperties();
777 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
778 775
779 ActivateTree(); 776 ActivateTree();
780 SetupPendingTree(pending_pile); 777 SetupPendingTree(pending_pile);
781 778
782 FakePictureLayerImpl* active_child_layer = 779 FakePictureLayerImpl* active_child_layer =
783 static_cast<FakePictureLayerImpl*>(active_layer_->children()[0]); 780 static_cast<FakePictureLayerImpl*>(active_layer_->children()[0]);
784 781
785 std::set<Tile*> all_tiles; 782 std::set<Tile*> all_tiles;
786 size_t tile_count = 0; 783 size_t tile_count = 0;
787 scoped_ptr<RasterTilePriorityQueue> raster_queue(host_impl_.BuildRasterQueue( 784 scoped_ptr<RasterTilePriorityQueue> raster_queue(host_impl_.BuildRasterQueue(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 FakePictureLayerImpl* pending_child_layer = pending_child.get(); 902 FakePictureLayerImpl* pending_child_layer = pending_child.get();
906 pending_layer_->AddChild(pending_child.Pass()); 903 pending_layer_->AddChild(pending_child.Pass());
907 904
908 // Create a fully transparent child layer so that its tile priorities are not 905 // Create a fully transparent child layer so that its tile priorities are not
909 // considered to be valid. 906 // considered to be valid.
910 pending_child_layer->SetDrawsContent(true); 907 pending_child_layer->SetDrawsContent(true);
911 908
912 time_ticks += base::TimeDelta::FromMilliseconds(1); 909 time_ticks += base::TimeDelta::FromMilliseconds(1);
913 host_impl_.SetCurrentBeginFrameArgs( 910 host_impl_.SetCurrentBeginFrameArgs(
914 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 911 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
915 bool update_lcd_text = false; 912 host_impl_.pending_tree()->UpdateDrawProperties();
916 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
917 913
918 pending_child_layer->SetOpacity(0.0); 914 pending_child_layer->SetOpacity(0.0);
919 915
920 time_ticks += base::TimeDelta::FromMilliseconds(1); 916 time_ticks += base::TimeDelta::FromMilliseconds(1);
921 host_impl_.SetCurrentBeginFrameArgs( 917 host_impl_.SetCurrentBeginFrameArgs(
922 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 918 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
923 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); 919 host_impl_.pending_tree()->UpdateDrawProperties();
924 920
925 // Renew all of the tile priorities. 921 // Renew all of the tile priorities.
926 gfx::Rect viewport(layer_bounds); 922 gfx::Rect viewport(layer_bounds);
927 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, 923 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
928 Occlusion()); 924 Occlusion());
929 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0, 925 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
930 Occlusion()); 926 Occlusion());
931 pending_child_layer->HighResTiling()->ComputeTilePriorityRects( 927 pending_child_layer->HighResTiling()->ComputeTilePriorityRects(
932 viewport, 1.0f, 1.0, Occlusion()); 928 viewport, 1.0f, 1.0, Occlusion());
933 pending_child_layer->LowResTiling()->ComputeTilePriorityRects( 929 pending_child_layer->LowResTiling()->ComputeTilePriorityRects(
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 EXPECT_GT(eventually_bin_order_correct_count, 1268 EXPECT_GT(eventually_bin_order_correct_count,
1273 eventually_bin_order_incorrect_count); 1269 eventually_bin_order_incorrect_count);
1274 1270
1275 EXPECT_TRUE(have_tiles[TilePriority::NOW]); 1271 EXPECT_TRUE(have_tiles[TilePriority::NOW]);
1276 EXPECT_TRUE(have_tiles[TilePriority::SOON]); 1272 EXPECT_TRUE(have_tiles[TilePriority::SOON]);
1277 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); 1273 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]);
1278 } 1274 }
1279 1275
1280 } // namespace 1276 } // namespace
1281 } // namespace cc 1277 } // 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