diff options
author | wangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-21 07:10:33 +0000 |
---|---|---|
committer | wangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-21 07:10:33 +0000 |
commit | 347426c83040d950691d64613a16fade37d3d24c (patch) | |
tree | 447dcc4487424e0386502f998405e53966891d06 /cc | |
parent | 045f667d4647e9f74f45e68fc80c17b19ffca7f4 (diff) | |
download | chromium_src-347426c83040d950691d64613a16fade37d3d24c.zip chromium_src-347426c83040d950691d64613a16fade37d3d24c.tar.gz chromium_src-347426c83040d950691d64613a16fade37d3d24c.tar.bz2 |
Check if priority actually changed in Tile::SetPriority()
To prevent unnecessary TileManager::WillModifyTilePriority() calls which
blocks ActivatePendingTree(), commits and the whole event queue.
BUG=181708
Review URL: https://chromiumcodereview.appspot.com/12912008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189543 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/resources/tile.cc | 3 | ||||
-rw-r--r-- | cc/resources/tile_priority.h | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/cc/resources/tile.cc b/cc/resources/tile.cc index 48f3ae7..f29baf6 100644 --- a/cc/resources/tile.cc +++ b/cc/resources/tile.cc @@ -46,6 +46,9 @@ scoped_ptr<base::Value> Tile::AsValue() const { } void Tile::SetPriority(WhichTree tree, const TilePriority& priority) { + if (priority_[tree] == priority) + return; + tile_manager_->WillModifyTilePriority(this, tree, priority); priority_[tree] = priority; } diff --git a/cc/resources/tile_priority.h b/cc/resources/tile_priority.h index c998624..a9558ef 100644 --- a/cc/resources/tile_priority.h +++ b/cc/resources/tile_priority.h @@ -122,6 +122,20 @@ struct CC_EXPORT TilePriority { float time_delta, const gfx::RectF& target_bounds); + bool operator ==(const TilePriority& other) const { + if (is_live != other.is_live) return false; + if (!is_live) return true; // All non-live priorities are the same. + return resolution == other.resolution && + time_to_visible_in_seconds == other.time_to_visible_in_seconds && + distance_to_visible_in_pixels == other.distance_to_visible_in_pixels; + // No need to compare current_screen_quad which is for debug only and + // never changes by itself. + } + + bool operator !=(const TilePriority& other) const { + return !(*this == other); + } + // If a tile is not live, then all other fields are invalid. bool is_live; TileResolution resolution; |