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

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

Issue 1139673008: cc: Make IsReadyToDraw/NeedsRaster usage consistent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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.cc ('k') | cc/resources/tiling_set_eviction_queue.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 "base/thread_task_runner_handle.h" 5 #include "base/thread_task_runner_handle.h"
6 #include "cc/resources/eviction_tile_priority_queue.h" 6 #include "cc/resources/eviction_tile_priority_queue.h"
7 #include "cc/resources/raster_tile_priority_queue.h" 7 #include "cc/resources/raster_tile_priority_queue.h"
8 #include "cc/resources/resource_pool.h" 8 #include "cc/resources/resource_pool.h"
9 #include "cc/resources/tile.h" 9 #include "cc/resources/tile.h"
10 #include "cc/resources/tile_priority.h" 10 #include "cc/resources/tile_priority.h"
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 scoped_ptr<EvictionTilePriorityQueue> queue( 678 scoped_ptr<EvictionTilePriorityQueue> queue(
679 host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY)); 679 host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY));
680 EXPECT_FALSE(queue->IsEmpty()); 680 EXPECT_FALSE(queue->IsEmpty());
681 681
682 // Sanity check, all tiles should be visible. 682 // Sanity check, all tiles should be visible.
683 std::set<Tile*> smoothness_tiles; 683 std::set<Tile*> smoothness_tiles;
684 while (!queue->IsEmpty()) { 684 while (!queue->IsEmpty()) {
685 PrioritizedTile prioritized_tile = queue->Top(); 685 PrioritizedTile prioritized_tile = queue->Top();
686 EXPECT_TRUE(prioritized_tile.tile()); 686 EXPECT_TRUE(prioritized_tile.tile());
687 EXPECT_EQ(TilePriority::NOW, prioritized_tile.priority().priority_bin); 687 EXPECT_EQ(TilePriority::NOW, prioritized_tile.priority().priority_bin);
688 EXPECT_TRUE(prioritized_tile.tile()->HasResource()); 688 EXPECT_TRUE(prioritized_tile.tile()->draw_info().has_resource());
689 smoothness_tiles.insert(prioritized_tile.tile()); 689 smoothness_tiles.insert(prioritized_tile.tile());
690 queue->Pop(); 690 queue->Pop();
691 } 691 }
692 EXPECT_EQ(all_tiles, smoothness_tiles); 692 EXPECT_EQ(all_tiles, smoothness_tiles);
693 693
694 tile_manager()->ReleaseTileResourcesForTesting( 694 tile_manager()->ReleaseTileResourcesForTesting(
695 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); 695 std::vector<Tile*>(all_tiles.begin(), all_tiles.end()));
696 696
697 Region invalidation(gfx::Rect(0, 0, 500, 500)); 697 Region invalidation(gfx::Rect(0, 0, 500, 500));
698 698
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 smoothness_tiles.clear(); 743 smoothness_tiles.clear();
744 tile_count = 0; 744 tile_count = 0;
745 // Here we expect to get increasing combined priority_bin. 745 // Here we expect to get increasing combined priority_bin.
746 queue = host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY); 746 queue = host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY);
747 int distance_increasing = 0; 747 int distance_increasing = 0;
748 int distance_decreasing = 0; 748 int distance_decreasing = 0;
749 while (!queue->IsEmpty()) { 749 while (!queue->IsEmpty()) {
750 PrioritizedTile prioritized_tile = queue->Top(); 750 PrioritizedTile prioritized_tile = queue->Top();
751 Tile* tile = prioritized_tile.tile(); 751 Tile* tile = prioritized_tile.tile();
752 EXPECT_TRUE(tile); 752 EXPECT_TRUE(tile);
753 EXPECT_TRUE(tile->HasResource()); 753 EXPECT_TRUE(tile->draw_info().has_resource());
754 754
755 if (!last_tile.tile()) 755 if (!last_tile.tile())
756 last_tile = prioritized_tile; 756 last_tile = prioritized_tile;
757 757
758 const TilePriority& last_priority = last_tile.priority(); 758 const TilePriority& last_priority = last_tile.priority();
759 const TilePriority& priority = prioritized_tile.priority(); 759 const TilePriority& priority = prioritized_tile.priority();
760 760
761 EXPECT_GE(last_priority.priority_bin, priority.priority_bin); 761 EXPECT_GE(last_priority.priority_bin, priority.priority_bin);
762 if (last_priority.priority_bin == priority.priority_bin) { 762 if (last_priority.priority_bin == priority.priority_bin) {
763 EXPECT_LE(last_tile.tile()->required_for_activation(), 763 EXPECT_LE(last_tile.tile()->required_for_activation(),
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 RGBA_8888); 1419 RGBA_8888);
1420 1420
1421 host_impl_.tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting(); 1421 host_impl_.tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting();
1422 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); 1422 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw());
1423 1423
1424 host_impl_.resource_pool()->ReleaseResource(resource.Pass()); 1424 host_impl_.resource_pool()->ReleaseResource(resource.Pass());
1425 } 1425 }
1426 1426
1427 } // namespace 1427 } // namespace
1428 } // namespace cc 1428 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager.cc ('k') | cc/resources/tiling_set_eviction_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698