diff options
author | vmpstr <vmpstr@chromium.org> | 2015-05-20 12:51:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-20 19:51:33 +0000 |
commit | b38ea4aec6a0c9cc8460b8420b292e5cc479a8a1 (patch) | |
tree | 1221650898230e6965fd57d331ea319929ac380e | |
parent | 74efa3390f03912d5e734550d50601e096b9480e (diff) | |
download | chromium_src-b38ea4aec6a0c9cc8460b8420b292e5cc479a8a1.zip chromium_src-b38ea4aec6a0c9cc8460b8420b292e5cc479a8a1.tar.gz chromium_src-b38ea4aec6a0c9cc8460b8420b292e5cc479a8a1.tar.bz2 |
cc: TilingSetRasterQueue clean-ups and optimizations.
This patch removes some redundant code (fixing a bunch of TODOs). Also
ensures that we only call pending_visible_rect once per iterator (since
the function involves a virtual call).
R=enne
BUG=488636
Review URL: https://codereview.chromium.org/1144973005
Cr-Commit-Position: refs/heads/master@{#330787}
-rw-r--r-- | cc/tiles/tiling_set_raster_queue_all.cc | 52 | ||||
-rw-r--r-- | cc/tiles/tiling_set_raster_queue_all.h | 4 |
2 files changed, 9 insertions, 47 deletions
diff --git a/cc/tiles/tiling_set_raster_queue_all.cc b/cc/tiles/tiling_set_raster_queue_all.cc index 54e2562..a2f4922 100644 --- a/cc/tiles/tiling_set_raster_queue_all.cc +++ b/cc/tiles/tiling_set_raster_queue_all.cc @@ -152,7 +152,8 @@ TilingSetRasterQueueAll::OnePriorityRectIterator::OnePriorityRectIterator( PictureLayerTiling::PriorityRectType priority_rect_type) : tiling_(tiling), tiling_data_(tiling_data), - priority_rect_type_(priority_rect_type) { + priority_rect_type_(priority_rect_type), + pending_visible_rect_(tiling->pending_visible_rect()) { } template <typename TilingIteratorType> @@ -194,7 +195,7 @@ bool TilingSetRasterQueueAll::OnePriorityRectIterator::IsTileValid( // for pending visible rect tiles as tiling iterators do not ignore those // tiles. if (priority_rect_type_ > PictureLayerTiling::PENDING_VISIBLE_RECT && - tiling_->pending_visible_rect().Intersects(tile->content_rect())) { + pending_visible_rect_.Intersects(tile->content_rect())) { return false; } return true; @@ -232,9 +233,8 @@ TilingSetRasterQueueAll::PendingVisibleTilingIterator:: : OnePriorityRectIterator(tiling, tiling_data, PictureLayerTiling::PENDING_VISIBLE_RECT) { - iterator_ = TilingData::DifferenceIterator(tiling_data_, - tiling_->pending_visible_rect(), - tiling_->current_visible_rect()); + iterator_ = TilingData::DifferenceIterator( + tiling_data_, pending_visible_rect_, tiling_->current_visible_rect()); if (!iterator_) return; if (!GetFirstTileAndCheckIfValid(&iterator_)) @@ -254,8 +254,7 @@ TilingSetRasterQueueAll::SkewportTilingIterator::SkewportTilingIterator( TilingData* tiling_data) : OnePriorityRectIterator(tiling, tiling_data, - PictureLayerTiling::SKEWPORT_RECT), - pending_visible_rect_(tiling->pending_visible_rect()) { + PictureLayerTiling::SKEWPORT_RECT) { if (!tiling_->has_skewport_rect_tiles()) return; iterator_ = TilingData::SpiralDifferenceIterator( @@ -267,23 +266,12 @@ TilingSetRasterQueueAll::SkewportTilingIterator::SkewportTilingIterator( ++(*this); return; } - // TODO(e_hakkinen): This is not needed as GetFirstTileAndCheckIfValid - // does the same checking. - if (current_tile_.tile()->content_rect().Intersects(pending_visible_rect_)) - ++(*this); } TilingSetRasterQueueAll::SkewportTilingIterator& TilingSetRasterQueueAll::SkewportTilingIterator:: operator++() { AdvanceToNextTile(&iterator_); - // TODO(e_hakkinen): This is not needed as GetFirstTileAndCheckIfValid called - // by AdvanceToNextTile does the same checking. - while (!done()) { - if (!current_tile_.tile()->content_rect().Intersects(pending_visible_rect_)) - break; - AdvanceToNextTile(&iterator_); - } return *this; } @@ -293,8 +281,7 @@ TilingSetRasterQueueAll::SoonBorderTilingIterator::SoonBorderTilingIterator( TilingData* tiling_data) : OnePriorityRectIterator(tiling, tiling_data, - PictureLayerTiling::SOON_BORDER_RECT), - pending_visible_rect_(tiling->pending_visible_rect()) { + PictureLayerTiling::SOON_BORDER_RECT) { if (!tiling_->has_soon_border_rect_tiles()) return; iterator_ = TilingData::SpiralDifferenceIterator( @@ -306,23 +293,12 @@ TilingSetRasterQueueAll::SoonBorderTilingIterator::SoonBorderTilingIterator( ++(*this); return; } - // TODO(e_hakkinen): This is not needed as GetFirstTileAndCheckIfValid - // does the same checking. - if (current_tile_.tile()->content_rect().Intersects(pending_visible_rect_)) - ++(*this); } TilingSetRasterQueueAll::SoonBorderTilingIterator& TilingSetRasterQueueAll::SoonBorderTilingIterator:: operator++() { AdvanceToNextTile(&iterator_); - // TODO(e_hakkinen): This is not needed as GetFirstTileAndCheckIfValid called - // by AdvanceToNextTile does the same checking. - while (!done()) { - if (!current_tile_.tile()->content_rect().Intersects(pending_visible_rect_)) - break; - AdvanceToNextTile(&iterator_); - } return *this; } @@ -332,8 +308,7 @@ TilingSetRasterQueueAll::EventuallyTilingIterator::EventuallyTilingIterator( TilingData* tiling_data) : OnePriorityRectIterator(tiling, tiling_data, - PictureLayerTiling::EVENTUALLY_RECT), - pending_visible_rect_(tiling->pending_visible_rect()) { + PictureLayerTiling::EVENTUALLY_RECT) { if (!tiling_->has_eventually_rect_tiles()) return; iterator_ = TilingData::SpiralDifferenceIterator( @@ -345,23 +320,12 @@ TilingSetRasterQueueAll::EventuallyTilingIterator::EventuallyTilingIterator( ++(*this); return; } - // TODO(e_hakkinen): This is not needed as GetFirstTileAndCheckIfValid - // does the same checking. - if (current_tile_.tile()->content_rect().Intersects(pending_visible_rect_)) - ++(*this); } TilingSetRasterQueueAll::EventuallyTilingIterator& TilingSetRasterQueueAll::EventuallyTilingIterator:: operator++() { AdvanceToNextTile(&iterator_); - // TODO(e_hakkinen): This is not needed as GetFirstTileAndCheckIfValid called - // by AdvanceToNextTile does the same checking. - while (!done()) { - if (!current_tile_.tile()->content_rect().Intersects(pending_visible_rect_)) - break; - AdvanceToNextTile(&iterator_); - } return *this; } diff --git a/cc/tiles/tiling_set_raster_queue_all.h b/cc/tiles/tiling_set_raster_queue_all.h index 951f939..874b9bd 100644 --- a/cc/tiles/tiling_set_raster_queue_all.h +++ b/cc/tiles/tiling_set_raster_queue_all.h @@ -55,6 +55,7 @@ class CC_EXPORT TilingSetRasterQueueAll { PictureLayerTiling* tiling_; TilingData* tiling_data_; PictureLayerTiling::PriorityRectType priority_rect_type_; + gfx::Rect pending_visible_rect_; }; // Iterates over visible rect only, left to right top to bottom order. @@ -91,7 +92,6 @@ class CC_EXPORT TilingSetRasterQueueAll { private: TilingData::SpiralDifferenceIterator iterator_; - gfx::Rect pending_visible_rect_; }; // Iterates over soon border only, spiral around the visible rect. @@ -105,7 +105,6 @@ class CC_EXPORT TilingSetRasterQueueAll { private: TilingData::SpiralDifferenceIterator iterator_; - gfx::Rect pending_visible_rect_; }; // Iterates over eventually rect only, spiral around the soon rect. @@ -119,7 +118,6 @@ class CC_EXPORT TilingSetRasterQueueAll { private: TilingData::SpiralDifferenceIterator iterator_; - gfx::Rect pending_visible_rect_; }; // Iterates over all of the above phases in the following order: visible, |