diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 06:51:56 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 06:51:56 +0000 |
commit | 8b09c34460ec0f1a41fc9f01049ac52d6ecea660 (patch) | |
tree | d93adba84e5a33b6b2aa0c66eebb569f74eb5e6f /cc/test/fake_picture_pile_impl.cc | |
parent | 25eaf9b34c24d45b5c6f4bdb1c98ae20ae539d1f (diff) | |
download | chromium_src-8b09c34460ec0f1a41fc9f01049ac52d6ecea660.zip chromium_src-8b09c34460ec0f1a41fc9f01049ac52d6ecea660.tar.gz chromium_src-8b09c34460ec0f1a41fc9f01049ac52d6ecea660.tar.bz2 |
Revert of cc: Replace recorded region with direct map lookup (https://codereview.chromium.org/196343005/)
Reason for revert:
Probably broke telemetry's testMeasurementSmoke (which only runs on the cq and not the main waterfall for some reason): http://crbug.com/350697
Original issue's description:
> cc: Replace recorded region with direct map lookup
>
> If the viewport is extremely large, then keeping track of the recorded
> region in PicturePile with an actual Region becomes extremely slow due
> to a large number of rects being inserted into it.
>
> The recorded region behaves as a cache to the picture map; it's a
> simpler way to know the state of all of the recordings contained within.
>
> In practice, the recorded region is only used for two things: a "should
> this pile bother to create tilings" optimization and a "can a tile be
> rastered in this content rect" check aka CanRaster.
>
> The optimization for "should create tilings" is replaced by a
> has_any_recordings_ boolean, which could have a false positive in theory
> (resizing to a smaller but non-empty size), but which shouldn't happen
> in practice. Even if it did, this would only be a performance penalty
> for creating no-op tilings that can't create tiles (due to CanRaster).
>
> The CanRaster check is replaced by a viewport hint, as most tiles that
> the tiling creates will be inside of the very large expanded viewport
> during recording, turning an expensive Region.Contains check to a
> Rect.Contains one. In the edge cases where tiles are being created
> outside of that expanded viewport, it will check the picture map
> directly. This should only happen when the user has scrolled thousands
> of pixels without a commit.
>
> BUG=b/13302269
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=256953
TBR=danakj@chromium.org,vmpstr@chromium.org,enne@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=b/13302269
Review URL: https://codereview.chromium.org/196023015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257051 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/fake_picture_pile_impl.cc')
-rw-r--r-- | cc/test/fake_picture_pile_impl.cc | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/cc/test/fake_picture_pile_impl.cc b/cc/test/fake_picture_pile_impl.cc index 4bcf4b0..bb60034 100644 --- a/cc/test/fake_picture_pile_impl.cc +++ b/cc/test/fake_picture_pile_impl.cc @@ -23,12 +23,11 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile( pile->tiling().SetTotalSize(layer_bounds); pile->tiling().SetMaxTextureSize(tile_size); pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); - pile->recorded_viewport_ = gfx::Rect(layer_bounds); - pile->has_any_recordings_ = true; for (int x = 0; x < pile->tiling().num_tiles_x(); ++x) { for (int y = 0; y < pile->tiling().num_tiles_y(); ++y) pile->AddRecordingAt(x, y); } + pile->UpdateRecordedRegion(); return pile; } @@ -39,37 +38,29 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile( pile->tiling().SetTotalSize(layer_bounds); pile->tiling().SetMaxTextureSize(tile_size); pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); - pile->recorded_viewport_ = gfx::Rect(); - pile->has_any_recordings_ = false; + pile->UpdateRecordedRegion(); return pile; } scoped_refptr<FakePicturePileImpl> -FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( +FakePicturePileImpl::CreatePileWithRecordedRegion( const gfx::Size& tile_size, - const gfx::Size& layer_bounds) { + const gfx::Size& layer_bounds, + const Region& recorded_region) { scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); pile->tiling().SetTotalSize(layer_bounds); pile->tiling().SetMaxTextureSize(tile_size); pile->SetTileGridSize(ImplSidePaintingSettings().default_tile_size); - // This simulates a false positive for this flag. - pile->recorded_viewport_ = gfx::Rect(); - pile->has_any_recordings_ = true; + pile->SetRecordedRegionForTesting(recorded_region); return pile; } -scoped_refptr<FakePicturePileImpl> -FakePicturePileImpl::CreateInfiniteFilledPile() { +scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreatePile() { scoped_refptr<FakePicturePileImpl> pile(new FakePicturePileImpl()); gfx::Size size(std::numeric_limits<int>::max(), std::numeric_limits<int>::max()); pile->Resize(size); - pile->tiling().SetTotalSize(size); - pile->tiling().SetMaxTextureSize(size); - pile->SetTileGridSize(size); - pile->recorded_viewport_ = gfx::Rect(size); - pile->has_any_recordings_ = true; - pile->AddRecordingAt(0, 0); + pile->recorded_region_ = Region(gfx::Rect(size)); return pile; } @@ -89,7 +80,7 @@ void FakePicturePileImpl::AddRecordingAt(int x, int y) { picture_map_[std::pair<int, int>(x, y)].SetPicture(picture); EXPECT_TRUE(HasRecordingAt(x, y)); - has_any_recordings_ = true; + UpdateRecordedRegion(); } void FakePicturePileImpl::RemoveRecordingAt(int x, int y) { @@ -102,6 +93,8 @@ void FakePicturePileImpl::RemoveRecordingAt(int x, int y) { return; picture_map_.erase(std::pair<int, int>(x, y)); EXPECT_FALSE(HasRecordingAt(x, y)); + + UpdateRecordedRegion(); } void FakePicturePileImpl::RerecordPile() { |