Commit e5a0ee81 authored by vmpstr@chromium.org's avatar vmpstr@chromium.org

cc: prevent TileManager raster/eviction tile iterators copy.

This patch ensures that iterators cannot be copied..
Since we rely on a member heap that points to another member vector,
we can't do a naive copy. Instead we would have to reconstruct the
heap to point to the new members, but it's better to just restrict
copy altogether.

R=enne

Review URL: https://codereview.chromium.org/251003002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267042 0039d316-1c4b-4281-b951-d872f2087c98
parent 257a1d1b
...@@ -103,6 +103,8 @@ class CC_EXPORT TileManager : public RasterizerClient, ...@@ -103,6 +103,8 @@ class CC_EXPORT TileManager : public RasterizerClient,
std::vector<PairedPictureLayerIterator*> iterator_heap_; std::vector<PairedPictureLayerIterator*> iterator_heap_;
TreePriority tree_priority_; TreePriority tree_priority_;
RasterOrderComparator comparator_; RasterOrderComparator comparator_;
DISALLOW_COPY_AND_ASSIGN(RasterTileIterator);
}; };
struct CC_EXPORT EvictionTileIterator { struct CC_EXPORT EvictionTileIterator {
...@@ -147,6 +149,8 @@ class CC_EXPORT TileManager : public RasterizerClient, ...@@ -147,6 +149,8 @@ class CC_EXPORT TileManager : public RasterizerClient,
std::vector<PairedPictureLayerIterator*> iterator_heap_; std::vector<PairedPictureLayerIterator*> iterator_heap_;
TreePriority tree_priority_; TreePriority tree_priority_;
EvictionOrderComparator comparator_; EvictionOrderComparator comparator_;
DISALLOW_COPY_AND_ASSIGN(EvictionTileIterator);
}; };
static scoped_ptr<TileManager> Create( static scoped_ptr<TileManager> Create(
......
...@@ -829,13 +829,13 @@ TEST_F(TileManagerTileIteratorTest, RasterTileIterator) { ...@@ -829,13 +829,13 @@ TEST_F(TileManagerTileIteratorTest, RasterTileIterator) {
TileManager::RasterTileIterator it(tile_manager, TileManager::RasterTileIterator it(tile_manager,
SAME_PRIORITY_FOR_BOTH_TREES); SAME_PRIORITY_FOR_BOTH_TREES);
EXPECT_TRUE(it); EXPECT_TRUE(it);
std::set<Tile*> all_tiles;
size_t tile_count = 0;
size_t tile_count = 0;
std::set<Tile*> all_tiles;
for (; it; ++it) { for (; it; ++it) {
++tile_count;
EXPECT_TRUE(*it); EXPECT_TRUE(*it);
all_tiles.insert(*it); all_tiles.insert(*it);
++tile_count;
} }
EXPECT_EQ(tile_count, all_tiles.size()); EXPECT_EQ(tile_count, all_tiles.size());
...@@ -993,9 +993,9 @@ TEST_F(TileManagerTileIteratorTest, EvictionTileIterator) { ...@@ -993,9 +993,9 @@ TEST_F(TileManagerTileIteratorTest, EvictionTileIterator) {
tile_manager->GetPairedPictureLayers(&paired_layers); tile_manager->GetPairedPictureLayers(&paired_layers);
EXPECT_EQ(1u, paired_layers.size()); EXPECT_EQ(1u, paired_layers.size());
TileManager::EvictionTileIterator it(tile_manager, TileManager::EvictionTileIterator empty_it(tile_manager,
SAME_PRIORITY_FOR_BOTH_TREES); SAME_PRIORITY_FOR_BOTH_TREES);
EXPECT_FALSE(it); EXPECT_FALSE(empty_it);
std::set<Tile*> all_tiles; std::set<Tile*> all_tiles;
size_t tile_count = 0; size_t tile_count = 0;
...@@ -1014,16 +1014,12 @@ TEST_F(TileManagerTileIteratorTest, EvictionTileIterator) { ...@@ -1014,16 +1014,12 @@ TEST_F(TileManagerTileIteratorTest, EvictionTileIterator) {
tile_manager->InitializeTilesWithResourcesForTesting( tile_manager->InitializeTilesWithResourcesForTesting(
std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); std::vector<Tile*>(all_tiles.begin(), all_tiles.end()));
it = TileManager::EvictionTileIterator(tile_manager, TileManager::EvictionTileIterator it(tile_manager, SMOOTHNESS_TAKES_PRIORITY);
SAME_PRIORITY_FOR_BOTH_TREES);
EXPECT_TRUE(it); EXPECT_TRUE(it);
// Sanity check, all tiles should be visible. // Sanity check, all tiles should be visible.
std::set<Tile*> smoothness_tiles; std::set<Tile*> smoothness_tiles;
for (TileManager::EvictionTileIterator it(tile_manager, for (; it; ++it) {
SMOOTHNESS_TAKES_PRIORITY);
it;
++it) {
Tile* tile = *it; Tile* tile = *it;
EXPECT_TRUE(tile); EXPECT_TRUE(tile);
EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment