diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-30 21:23:59 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-30 21:23:59 +0000 |
commit | f02a27ff8e75fd674cb8702b4785eed9cf02586d (patch) | |
tree | 3fafac78ed29eefa34e4e1016b7f1177b0cc5dc5 /cc/resources/picture_layer_tiling_set.cc | |
parent | 204e289678f041bdadd1836f4a3e1dc40cd752c6 (diff) | |
download | chromium_src-f02a27ff8e75fd674cb8702b4785eed9cf02586d.zip chromium_src-f02a27ff8e75fd674cb8702b4785eed9cf02586d.tar.gz chromium_src-f02a27ff8e75fd674cb8702b4785eed9cf02586d.tar.bz2 |
cc: Make tile-creation lazy
This is a reland of https://chromiumcodereview.appspot.com/12865017/ after
rebasing, fixing tests, and fixing the crash in crbug.com/231360.
The TilesExist unit tests needed to check for the Tile* being NULL in
addition to checking if the tile's priority in the active tree being live.
When we create tiles in the live rect, if a tile is outside the recorded
region, it will not be created. So it is not safe to assume that always
all tiles inside the live rect do exist. This was the crash.
The original CL deferred tile creation from cloning time (during commit) to instead be during UpdateTilePriorities. Tiles that were previously marked with is_live=false will now just not be created at all. The fallout of this is that the tiling needs to know about invalidation via the client so that it can sync on a per-tile basis, rather than cloning an entire tiling at a time. Additionally, some cleanup was done to make it so that a tiling has a fixed layer bounds at creation time, since this can only happen during commit.
R=enne
BUG=190816,231360
Review URL: https://chromiumcodereview.appspot.com/14600003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources/picture_layer_tiling_set.cc')
-rw-r--r-- | cc/resources/picture_layer_tiling_set.cc | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/cc/resources/picture_layer_tiling_set.cc b/cc/resources/picture_layer_tiling_set.cc index cc15047..65ab01c 100644 --- a/cc/resources/picture_layer_tiling_set.cc +++ b/cc/resources/picture_layer_tiling_set.cc @@ -21,8 +21,10 @@ class LargestToSmallestScaleFunctor { PictureLayerTilingSet::PictureLayerTilingSet( - PictureLayerTilingClient * client) - : client_(client) { + PictureLayerTilingClient* client, + gfx::Size layer_bounds) + : client_(client), + layer_bounds_(layer_bounds) { } PictureLayerTilingSet::~PictureLayerTilingSet() { @@ -36,61 +38,36 @@ void PictureLayerTilingSet::SetClient(PictureLayerTilingClient* client) { void PictureLayerTilingSet::CloneAll( const PictureLayerTilingSet& other, - const Region& invalidation, float minimum_contents_scale) { tilings_.clear(); tilings_.reserve(other.tilings_.size()); for (size_t i = 0; i < other.tilings_.size(); ++i) { - if (other.tilings_[i]->contents_scale() < minimum_contents_scale) + const PictureLayerTiling* tiling = other.tilings_[i]; + if (tiling->contents_scale() < minimum_contents_scale) continue; - Clone(other.tilings_[i], invalidation); + tilings_.push_back(tiling->Clone(layer_bounds_, client_)); } + tilings_.sort(LargestToSmallestScaleFunctor()); } -void PictureLayerTilingSet::Clone( - const PictureLayerTiling* tiling, - const Region& invalidation) { - +void PictureLayerTilingSet::Clone(const PictureLayerTiling* tiling) { for (size_t i = 0; i < tilings_.size(); ++i) DCHECK_NE(tilings_[i]->contents_scale(), tiling->contents_scale()); - tilings_.push_back(tiling->Clone()); - gfx::Size size = tilings_.back()->layer_bounds(); - tilings_.back()->SetClient(client_); - tilings_.back()->Invalidate(invalidation); - // Intentionally use this set's layer bounds, as it may have changed. - tilings_.back()->SetLayerBounds(layer_bounds_); - + tilings_.push_back(tiling->Clone(layer_bounds_, client_)); tilings_.sort(LargestToSmallestScaleFunctor()); } -void PictureLayerTilingSet::SetLayerBounds(gfx::Size layer_bounds) { - if (layer_bounds_ == layer_bounds) - return; - layer_bounds_ = layer_bounds; - for (size_t i = 0; i < tilings_.size(); ++i) - tilings_[i]->SetLayerBounds(layer_bounds); -} - -gfx::Size PictureLayerTilingSet::LayerBounds() const { - return layer_bounds_; -} - -void PictureLayerTilingSet::Invalidate(const Region& layer_invalidation) { - for (size_t i = 0; i < tilings_.size(); ++i) - tilings_[i]->Invalidate(layer_invalidation); -} - void PictureLayerTilingSet::InvalidateTilesWithText() { for (size_t i = 0; i < tilings_.size(); ++i) tilings_[i]->InvalidateTilesWithText(); } PictureLayerTiling* PictureLayerTilingSet::AddTiling(float contents_scale) { - tilings_.push_back(PictureLayerTiling::Create(contents_scale)); + tilings_.push_back(PictureLayerTiling::Create(contents_scale, + layer_bounds_, + client_)); PictureLayerTiling* appended = tilings_.back(); - appended->SetClient(client_); - appended->SetLayerBounds(layer_bounds_); tilings_.sort(LargestToSmallestScaleFunctor()); return appended; @@ -113,11 +90,6 @@ void PictureLayerTilingSet::RemoveAllTiles() { tilings_[i]->Reset(); } -void PictureLayerTilingSet::CreateTilesFromLayerRect(gfx::Rect layer_rect) { - for (size_t i = 0; i < tilings_.size(); ++i) - tilings_[i]->CreateTilesFromLayerRect(layer_rect); -} - PictureLayerTilingSet::CoverageIterator::CoverageIterator( const PictureLayerTilingSet* set, float contents_scale, |