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

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

Issue 732423002: Update from chromium https://crrev.com/304586 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 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/resources/tile_manager_perftest.cc ('k') | cc/scheduler/begin_frame_source_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/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/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 state.tree_priority = tree_priority; 48 state.tree_priority = tree_priority;
49 49
50 global_state_ = state; 50 global_state_ = state;
51 host_impl_.resource_pool()->SetResourceUsageLimits( 51 host_impl_.resource_pool()->SetResourceUsageLimits(
52 state.soft_memory_limit_in_bytes, 52 state.soft_memory_limit_in_bytes,
53 state.soft_memory_limit_in_bytes, 53 state.soft_memory_limit_in_bytes,
54 state.num_resources_limit); 54 state.num_resources_limit);
55 host_impl_.tile_manager()->SetGlobalStateForTesting(state); 55 host_impl_.tile_manager()->SetGlobalStateForTesting(state);
56 } 56 }
57 57
58 virtual void SetUp() override { 58 void SetUp() override {
59 InitializeRenderer(); 59 InitializeRenderer();
60 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); 60 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES);
61 } 61 }
62 62
63 virtual void InitializeRenderer() { 63 virtual void InitializeRenderer() {
64 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); 64 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d());
65 } 65 }
66 66
67 void SetupDefaultTrees(const gfx::Size& layer_bounds) { 67 void SetupDefaultTrees(const gfx::Size& layer_bounds) {
68 gfx::Size tile_size(100, 100); 68 gfx::Size tile_size(100, 100);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 queue.Pop(); 187 queue.Pop();
188 } 188 }
189 EXPECT_EQ(all_tiles, smoothness_tiles); 189 EXPECT_EQ(all_tiles, smoothness_tiles);
190 EXPECT_TRUE(had_low_res); 190 EXPECT_TRUE(had_low_res);
191 191
192 Region invalidation(gfx::Rect(0, 0, 500, 500)); 192 Region invalidation(gfx::Rect(0, 0, 500, 500));
193 193
194 // Invalidate the pending tree. 194 // Invalidate the pending tree.
195 pending_layer_->set_invalidation(invalidation); 195 pending_layer_->set_invalidation(invalidation);
196 pending_layer_->HighResTiling()->UpdateTilesToCurrentRasterSource( 196 pending_layer_->HighResTiling()->UpdateTilesToCurrentRasterSource(
197 invalidation, gfx::Size(1000, 1000)); 197 pending_layer_->raster_source(), invalidation, gfx::Size(1000, 1000));
198 pending_layer_->LowResTiling()->UpdateTilesToCurrentRasterSource( 198 pending_layer_->LowResTiling()->UpdateTilesToCurrentRasterSource(
199 invalidation, gfx::Size(1000, 1000)); 199 pending_layer_->raster_source(), invalidation, gfx::Size(1000, 1000));
200 200
201 active_layer_->ResetAllTilesPriorities(); 201 active_layer_->ResetAllTilesPriorities();
202 pending_layer_->ResetAllTilesPriorities(); 202 pending_layer_->ResetAllTilesPriorities();
203 203
204 // Renew all of the tile priorities. 204 // Renew all of the tile priorities.
205 gfx::Rect viewport(50, 50, 100, 100); 205 gfx::Rect viewport(50, 50, 100, 100);
206 pending_layer_->HighResTiling()->ComputeTilePriorityRects( 206 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
207 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 207 Occlusion());
208 pending_layer_->LowResTiling()->ComputeTilePriorityRects( 208 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
209 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 209 Occlusion());
210 active_layer_->HighResTiling()->ComputeTilePriorityRects( 210 active_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
211 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); 211 Occlusion());
212 active_layer_->LowResTiling()->ComputeTilePriorityRects( 212 active_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
213 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); 213 Occlusion());
214 214
215 // Populate all tiles directly from the tilings. 215 // Populate all tiles directly from the tilings.
216 all_tiles.clear(); 216 all_tiles.clear();
217 std::set<Tile*> high_res_tiles; 217 std::set<Tile*> high_res_tiles;
218 std::vector<Tile*> pending_high_res_tiles = 218 std::vector<Tile*> pending_high_res_tiles =
219 pending_layer_->HighResTiling()->AllTilesForTesting(); 219 pending_layer_->HighResTiling()->AllTilesForTesting();
220 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) { 220 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) {
221 all_tiles.insert(pending_high_res_tiles[i]); 221 all_tiles.insert(pending_high_res_tiles[i]);
222 high_res_tiles.insert(pending_high_res_tiles[i]); 222 high_res_tiles.insert(pending_high_res_tiles[i]);
223 } 223 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 EXPECT_EQ(all_tiles, smoothness_tiles); 435 EXPECT_EQ(all_tiles, smoothness_tiles);
436 436
437 tile_manager()->ReleaseTileResourcesForTesting( 437 tile_manager()->ReleaseTileResourcesForTesting(
438 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); 438 std::vector<Tile*>(all_tiles.begin(), all_tiles.end()));
439 439
440 Region invalidation(gfx::Rect(0, 0, 500, 500)); 440 Region invalidation(gfx::Rect(0, 0, 500, 500));
441 441
442 // Invalidate the pending tree. 442 // Invalidate the pending tree.
443 pending_layer_->set_invalidation(invalidation); 443 pending_layer_->set_invalidation(invalidation);
444 pending_layer_->HighResTiling()->UpdateTilesToCurrentRasterSource( 444 pending_layer_->HighResTiling()->UpdateTilesToCurrentRasterSource(
445 invalidation, gfx::Size(1000, 1000)); 445 pending_layer_->raster_source(), invalidation, gfx::Size(1000, 1000));
446 pending_layer_->LowResTiling()->UpdateTilesToCurrentRasterSource( 446 pending_layer_->LowResTiling()->UpdateTilesToCurrentRasterSource(
447 invalidation, gfx::Size(1000, 1000)); 447 pending_layer_->raster_source(), invalidation, gfx::Size(1000, 1000));
448 448
449 active_layer_->ResetAllTilesPriorities(); 449 active_layer_->ResetAllTilesPriorities();
450 pending_layer_->ResetAllTilesPriorities(); 450 pending_layer_->ResetAllTilesPriorities();
451 451
452 // Renew all of the tile priorities. 452 // Renew all of the tile priorities.
453 gfx::Rect viewport(50, 50, 100, 100); 453 gfx::Rect viewport(50, 50, 100, 100);
454 pending_layer_->HighResTiling()->ComputeTilePriorityRects( 454 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
455 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 455 Occlusion());
456 pending_layer_->LowResTiling()->ComputeTilePriorityRects( 456 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
457 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 457 Occlusion());
458 active_layer_->HighResTiling()->ComputeTilePriorityRects( 458 active_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
459 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); 459 Occlusion());
460 active_layer_->LowResTiling()->ComputeTilePriorityRects( 460 active_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
461 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); 461 Occlusion());
462 462
463 // Populate all tiles directly from the tilings. 463 // Populate all tiles directly from the tilings.
464 all_tiles.clear(); 464 all_tiles.clear();
465 std::vector<Tile*> pending_high_res_tiles = 465 std::vector<Tile*> pending_high_res_tiles =
466 pending_layer_->HighResTiling()->AllTilesForTesting(); 466 pending_layer_->HighResTiling()->AllTilesForTesting();
467 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) 467 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i)
468 all_tiles.insert(pending_high_res_tiles[i]); 468 all_tiles.insert(pending_high_res_tiles[i]);
469 469
470 std::vector<Tile*> pending_low_res_tiles = 470 std::vector<Tile*> pending_low_res_tiles =
471 pending_layer_->LowResTiling()->AllTilesForTesting(); 471 pending_layer_->LowResTiling()->AllTilesForTesting();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 all_tiles.insert(raster_queue.Top()); 586 all_tiles.insert(raster_queue.Top());
587 raster_queue.Pop(); 587 raster_queue.Pop();
588 } 588 }
589 EXPECT_EQ(tile_count, all_tiles.size()); 589 EXPECT_EQ(tile_count, all_tiles.size());
590 EXPECT_EQ(32u, tile_count); 590 EXPECT_EQ(32u, tile_count);
591 591
592 pending_layer_->ResetAllTilesPriorities(); 592 pending_layer_->ResetAllTilesPriorities();
593 593
594 // Renew all of the tile priorities. 594 // Renew all of the tile priorities.
595 gfx::Rect viewport(layer_bounds); 595 gfx::Rect viewport(layer_bounds);
596 pending_layer_->HighResTiling()->ComputeTilePriorityRects( 596 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
597 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 597 Occlusion());
598 pending_layer_->LowResTiling()->ComputeTilePriorityRects( 598 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
599 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 599 Occlusion());
600 pending_child_layer->HighResTiling()->ComputeTilePriorityRects( 600 pending_child_layer->HighResTiling()->ComputeTilePriorityRects(
601 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 601 viewport, 1.0f, 1.0, Occlusion());
602 pending_child_layer->LowResTiling()->ComputeTilePriorityRects( 602 pending_child_layer->LowResTiling()->ComputeTilePriorityRects(
603 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 603 viewport, 1.0f, 1.0, Occlusion());
604 604
605 // Populate all tiles directly from the tilings. 605 // Populate all tiles directly from the tilings.
606 all_tiles.clear(); 606 all_tiles.clear();
607 std::vector<Tile*> pending_high_res_tiles = 607 std::vector<Tile*> pending_high_res_tiles =
608 pending_layer_->HighResTiling()->AllTilesForTesting(); 608 pending_layer_->HighResTiling()->AllTilesForTesting();
609 all_tiles.insert(pending_high_res_tiles.begin(), 609 all_tiles.insert(pending_high_res_tiles.begin(),
610 pending_high_res_tiles.end()); 610 pending_high_res_tiles.end());
611 611
612 std::vector<Tile*> pending_low_res_tiles = 612 std::vector<Tile*> pending_low_res_tiles =
613 pending_layer_->LowResTiling()->AllTilesForTesting(); 613 pending_layer_->LowResTiling()->AllTilesForTesting();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 FakePictureLayerImpl* pending_child_layer = 689 FakePictureLayerImpl* pending_child_layer =
690 static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]); 690 static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]);
691 pending_child_layer->SetDrawsContent(true); 691 pending_child_layer->SetDrawsContent(true);
692 pending_child_layer->CreateDefaultTilingsAndTiles(); 692 pending_child_layer->CreateDefaultTilingsAndTiles();
693 pending_child_layer->SetOpacity(0.0); 693 pending_child_layer->SetOpacity(0.0);
694 pending_child_layer->layer_tree_impl()->UpdateDrawProperties(); 694 pending_child_layer->layer_tree_impl()->UpdateDrawProperties();
695 pending_child_layer->DoPostCommitInitializationIfNeeded(); 695 pending_child_layer->DoPostCommitInitializationIfNeeded();
696 696
697 // Renew all of the tile priorities. 697 // Renew all of the tile priorities.
698 gfx::Rect viewport(layer_bounds); 698 gfx::Rect viewport(layer_bounds);
699 pending_layer_->HighResTiling()->ComputeTilePriorityRects( 699 pending_layer_->HighResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
700 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 700 Occlusion());
701 pending_layer_->LowResTiling()->ComputeTilePriorityRects( 701 pending_layer_->LowResTiling()->ComputeTilePriorityRects(viewport, 1.0f, 1.0,
702 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 702 Occlusion());
703 pending_child_layer->HighResTiling()->ComputeTilePriorityRects( 703 pending_child_layer->HighResTiling()->ComputeTilePriorityRects(
704 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 704 viewport, 1.0f, 1.0, Occlusion());
705 pending_child_layer->LowResTiling()->ComputeTilePriorityRects( 705 pending_child_layer->LowResTiling()->ComputeTilePriorityRects(
706 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); 706 viewport, 1.0f, 1.0, Occlusion());
707 707
708 // Populate all tiles directly from the tilings. 708 // Populate all tiles directly from the tilings.
709 std::set<Tile*> all_pending_tiles; 709 std::set<Tile*> all_pending_tiles;
710 std::vector<Tile*> pending_high_res_tiles = 710 std::vector<Tile*> pending_high_res_tiles =
711 pending_layer_->HighResTiling()->AllTilesForTesting(); 711 pending_layer_->HighResTiling()->AllTilesForTesting();
712 all_pending_tiles.insert(pending_high_res_tiles.begin(), 712 all_pending_tiles.insert(pending_high_res_tiles.begin(),
713 pending_high_res_tiles.end()); 713 pending_high_res_tiles.end());
714 EXPECT_EQ(16u, pending_high_res_tiles.size()); 714 EXPECT_EQ(16u, pending_high_res_tiles.size());
715 715
716 std::vector<Tile*> pending_low_res_tiles = 716 std::vector<Tile*> pending_low_res_tiles =
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 all_tiles.insert(queue.Top()); 858 all_tiles.insert(queue.Top());
859 ++tile_count; 859 ++tile_count;
860 queue.Pop(); 860 queue.Pop();
861 } 861 }
862 EXPECT_EQ(tile_count, all_tiles.size()); 862 EXPECT_EQ(tile_count, all_tiles.size());
863 EXPECT_EQ(16u, tile_count); 863 EXPECT_EQ(16u, tile_count);
864 } 864 }
865 865
866 } // namespace 866 } // namespace
867 } // namespace cc 867 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager_perftest.cc ('k') | cc/scheduler/begin_frame_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698