summaryrefslogtreecommitdiffstats
path: root/cc/resources
diff options
context:
space:
mode:
authorvmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 02:01:26 +0000
committervmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 02:01:26 +0000
commite5a0ee816ed068d41f9188d0eb2b1590064e2ef8 (patch)
tree278cfa77281fe77bca08417c2079cd1b78306246 /cc/resources
parent257a1d1b1f9c069dd67ecd337967ca24df733ad5 (diff)
downloadchromium_src-e5a0ee816ed068d41f9188d0eb2b1590064e2ef8.zip
chromium_src-e5a0ee816ed068d41f9188d0eb2b1590064e2ef8.tar.gz
chromium_src-e5a0ee816ed068d41f9188d0eb2b1590064e2ef8.tar.bz2
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
Diffstat (limited to 'cc/resources')
-rw-r--r--cc/resources/tile_manager.h4
-rw-r--r--cc/resources/tile_manager_unittest.cc20
2 files changed, 12 insertions, 12 deletions
diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h
index c1534f4..f48fef6 100644
--- a/cc/resources/tile_manager.h
+++ b/cc/resources/tile_manager.h
@@ -103,6 +103,8 @@ class CC_EXPORT TileManager : public RasterizerClient,
std::vector<PairedPictureLayerIterator*> iterator_heap_;
TreePriority tree_priority_;
RasterOrderComparator comparator_;
+
+ DISALLOW_COPY_AND_ASSIGN(RasterTileIterator);
};
struct CC_EXPORT EvictionTileIterator {
@@ -147,6 +149,8 @@ class CC_EXPORT TileManager : public RasterizerClient,
std::vector<PairedPictureLayerIterator*> iterator_heap_;
TreePriority tree_priority_;
EvictionOrderComparator comparator_;
+
+ DISALLOW_COPY_AND_ASSIGN(EvictionTileIterator);
};
static scoped_ptr<TileManager> Create(
diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc
index e45272e..d3f14ae 100644
--- a/cc/resources/tile_manager_unittest.cc
+++ b/cc/resources/tile_manager_unittest.cc
@@ -829,13 +829,13 @@ TEST_F(TileManagerTileIteratorTest, RasterTileIterator) {
TileManager::RasterTileIterator it(tile_manager,
SAME_PRIORITY_FOR_BOTH_TREES);
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) {
- ++tile_count;
EXPECT_TRUE(*it);
all_tiles.insert(*it);
+ ++tile_count;
}
EXPECT_EQ(tile_count, all_tiles.size());
@@ -993,9 +993,9 @@ TEST_F(TileManagerTileIteratorTest, EvictionTileIterator) {
tile_manager->GetPairedPictureLayers(&paired_layers);
EXPECT_EQ(1u, paired_layers.size());
- TileManager::EvictionTileIterator it(tile_manager,
- SAME_PRIORITY_FOR_BOTH_TREES);
- EXPECT_FALSE(it);
+ TileManager::EvictionTileIterator empty_it(tile_manager,
+ SAME_PRIORITY_FOR_BOTH_TREES);
+ EXPECT_FALSE(empty_it);
std::set<Tile*> all_tiles;
size_t tile_count = 0;
@@ -1014,16 +1014,12 @@ TEST_F(TileManagerTileIteratorTest, EvictionTileIterator) {
tile_manager->InitializeTilesWithResourcesForTesting(
std::vector<Tile*>(all_tiles.begin(), all_tiles.end()));
- it = TileManager::EvictionTileIterator(tile_manager,
- SAME_PRIORITY_FOR_BOTH_TREES);
+ TileManager::EvictionTileIterator it(tile_manager, SMOOTHNESS_TAKES_PRIORITY);
EXPECT_TRUE(it);
// Sanity check, all tiles should be visible.
std::set<Tile*> smoothness_tiles;
- for (TileManager::EvictionTileIterator it(tile_manager,
- SMOOTHNESS_TAKES_PRIORITY);
- it;
- ++it) {
+ for (; it; ++it) {
Tile* tile = *it;
EXPECT_TRUE(tile);
EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin);