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

Unified Diff: cc/tiles/picture_layer_tiling.cc

Issue 1133243010: cc: Optimize the tile map key hash for 4-byte size_t. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tiles/picture_layer_tiling.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/picture_layer_tiling.cc
diff --git a/cc/tiles/picture_layer_tiling.cc b/cc/tiles/picture_layer_tiling.cc
index 8eb75305c2c74f940716b9c56b01359b41a0f7a5..8db23522e6bfe11783d8dabc98dad573cbca83ca 100644
--- a/cc/tiles/picture_layer_tiling.cc
+++ b/cc/tiles/picture_layer_tiling.cc
@@ -121,13 +121,13 @@ void PictureLayerTiling::CreateMissingTilesInLiveTilesRect() {
for (TilingData::Iterator iter(&tiling_data_, live_tiles_rect_,
include_borders);
iter; ++iter) {
- TileMapKey key = iter.index();
+ TileMapKey key(iter.index());
TileMap::iterator find = tiles_.find(key);
if (find != tiles_.end())
continue;
- if (ShouldCreateTileAt(key.first, key.second))
- CreateTile(key.first, key.second);
+ if (ShouldCreateTileAt(key.index_x, key.index_y))
+ CreateTile(key.index_x, key.index_y);
}
VerifyLiveTilesRect(false);
}
@@ -286,13 +286,13 @@ void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_invalidation,
iter; ++iter) {
if (RemoveTileAt(iter.index_x(), iter.index_y())) {
if (recreate_tiles)
- new_tile_keys.push_back(iter.index());
+ new_tile_keys.push_back(TileMapKey(iter.index()));
}
}
}
for (const auto& key : new_tile_keys)
- CreateTile(key.first, key.second);
+ CreateTile(key.index_x, key.index_y);
}
bool PictureLayerTiling::ShouldCreateTileAt(int i, int j) const {
@@ -658,8 +658,8 @@ void PictureLayerTiling::SetLiveTilesRect(
live_tiles_rect_);
iter; ++iter) {
TileMapKey key(iter.index());
- if (ShouldCreateTileAt(key.first, key.second))
- CreateTile(key.first, key.second);
+ if (ShouldCreateTileAt(key.index_x, key.index_y))
+ CreateTile(key.index_x, key.index_y);
}
live_tiles_rect_ = new_live_tiles_rect;
@@ -671,19 +671,19 @@ void PictureLayerTiling::VerifyLiveTilesRect(bool is_on_recycle_tree) const {
for (auto it = tiles_.begin(); it != tiles_.end(); ++it) {
if (!it->second)
continue;
- DCHECK(it->first.first < tiling_data_.num_tiles_x())
- << this << " " << it->first.first << "," << it->first.second
- << " num_tiles_x " << tiling_data_.num_tiles_x() << " live_tiles_rect "
+ TileMapKey key = it->first;
+ DCHECK(key.index_x < tiling_data_.num_tiles_x())
+ << this << " " << key.index_x << "," << key.index_y << " num_tiles_x "
+ << tiling_data_.num_tiles_x() << " live_tiles_rect "
<< live_tiles_rect_.ToString();
- DCHECK(it->first.second < tiling_data_.num_tiles_y())
- << this << " " << it->first.first << "," << it->first.second
- << " num_tiles_y " << tiling_data_.num_tiles_y() << " live_tiles_rect "
+ DCHECK(key.index_y < tiling_data_.num_tiles_y())
+ << this << " " << key.index_x << "," << key.index_y << " num_tiles_y "
+ << tiling_data_.num_tiles_y() << " live_tiles_rect "
<< live_tiles_rect_.ToString();
- DCHECK(tiling_data_.TileBounds(it->first.first, it->first.second)
+ DCHECK(tiling_data_.TileBounds(key.index_x, key.index_y)
.Intersects(live_tiles_rect_))
- << this << " " << it->first.first << "," << it->first.second
- << " tile bounds "
- << tiling_data_.TileBounds(it->first.first, it->first.second).ToString()
+ << this << " " << key.index_x << "," << key.index_y << " tile bounds "
+ << tiling_data_.TileBounds(key.index_x, key.index_y).ToString()
<< " live_tiles_rect " << live_tiles_rect_.ToString();
}
#endif
« no previous file with comments | « cc/tiles/picture_layer_tiling.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698