From 0dc47d774c6a2f4dd9d5c357c15cc67291f9ebfb Mon Sep 17 00:00:00 2001 From: jdduke Date: Fri, 2 Jan 2015 18:06:46 -0800 Subject: [PATCH] Revert of cc: Remove tile and scale specific code from raster source (patchset #4 id:60001 of https://codereview.chromium.org/811953005/) Reason for revert: Broke the build due to collision with crrev.com/820743002. Probably just needs a rebase and constructor tweak, reverting for now to be safe. Original issue's description: > cc: Remove tile and scale specific code from raster source > > Fix a TODO I added a while back. Instead of calling SetMinContentsScale > and SetTileGridSize directly, pass these as parameters to constructor of the > PicturePile. > > Committed: https://crrev.com/6d1f2981f3204852a9189d0b6e7ad0b18659d68d > Cr-Commit-Position: refs/heads/master@{#309867} TBR=vmpstr@chromium.org,hendrikw@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/832963002 Cr-Commit-Position: refs/heads/master@{#309868} --- cc/layers/picture_layer.cc | 7 ++++--- cc/resources/display_list_recording_source.cc | 7 +++++++ cc/resources/display_list_recording_source.h | 2 ++ cc/resources/picture_pile.cc | 9 ++++----- cc/resources/picture_pile.h | 8 +++----- cc/resources/picture_pile_unittest.cc | 7 ++----- cc/resources/recording_source.h | 4 ++++ cc/test/fake_picture_pile.h | 4 +--- cc/test/fake_picture_pile_impl.cc | 19 ++++++++----------- cc/trees/layer_tree_host_unittest.cc | 6 ++---- 10 files changed, 37 insertions(+), 36 deletions(-) diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index a55318eda6f2..98e8dcb8e1ca 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -85,11 +85,12 @@ void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { if (host->settings().use_display_lists) { recording_source_.reset(new DisplayListRecordingSource); } else { - recording_source_.reset( - new PicturePile(host->settings().minimum_contents_scale, - host->settings().default_tile_grid_size)); + recording_source_.reset(new PicturePile); } } + recording_source_->SetMinContentsScale( + host->settings().minimum_contents_scale); + recording_source_->SetTileGridSize(host->settings().default_tile_grid_size); recording_source_->SetSlowdownRasterScaleFactor( host->debug_state().slow_down_raster_scale_factor); } diff --git a/cc/resources/display_list_recording_source.cc b/cc/resources/display_list_recording_source.cc index fa9b1a25f113..ab4c64692cf4 100644 --- a/cc/resources/display_list_recording_source.cc +++ b/cc/resources/display_list_recording_source.cc @@ -104,6 +104,13 @@ void DisplayListRecordingSource::SetEmptyBounds() { Clear(); } +void DisplayListRecordingSource::SetMinContentsScale(float min_contents_scale) { +} + +void DisplayListRecordingSource::SetTileGridSize( + const gfx::Size& tile_grid_size) { +} + void DisplayListRecordingSource::SetSlowdownRasterScaleFactor(int factor) { slow_down_raster_scale_factor_for_debug_ = factor; } diff --git a/cc/resources/display_list_recording_source.h b/cc/resources/display_list_recording_source.h index 43414019a5ea..6bc82082fd9a 100644 --- a/cc/resources/display_list_recording_source.h +++ b/cc/resources/display_list_recording_source.h @@ -29,8 +29,10 @@ class CC_EXPORT DisplayListRecordingSource : public RecordingSource { scoped_refptr CreateRasterSource() const override; gfx::Size GetSize() const final; void SetEmptyBounds() override; + void SetMinContentsScale(float min_contents_scale) override; void SetSlowdownRasterScaleFactor(int factor) override; bool IsSuitableForGpuRasterization() const override; + void SetTileGridSize(const gfx::Size& tile_grid_size) override; void SetUnsuitableForGpuRasterizationForTesting() override; SkTileGridFactory::TileGridInfo GetTileGridInfoForTesting() const override; diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc index 1642e35bc710..31bc2d350b61 100644 --- a/cc/resources/picture_pile.cc +++ b/cc/resources/picture_pile.cc @@ -157,8 +157,7 @@ void ClusterTiles(const std::vector& invalid_tiles, namespace cc { -PicturePile::PicturePile(float min_contents_scale, - const gfx::Size& tile_grid_size) +PicturePile::PicturePile() : min_contents_scale_(0), slow_down_raster_scale_factor_for_debug_(0), can_use_lcd_text_(true), @@ -168,9 +167,9 @@ PicturePile::PicturePile(float min_contents_scale, pixel_record_distance_(kPixelDistanceToRecord), is_suitable_for_gpu_rasterization_(true) { tiling_.SetMaxTextureSize(gfx::Size(kBasePictureSize, kBasePictureSize)); - - SetMinContentsScale(min_contents_scale); - SetTileGridSize(tile_grid_size); + tile_grid_info_.fTileInterval.setEmpty(); + tile_grid_info_.fMargin.setEmpty(); + tile_grid_info_.fOffset.setZero(); } PicturePile::~PicturePile() { diff --git a/cc/resources/picture_pile.h b/cc/resources/picture_pile.h index 08862659dcc4..fd1c4540dc2a 100644 --- a/cc/resources/picture_pile.h +++ b/cc/resources/picture_pile.h @@ -16,11 +16,10 @@ namespace cc { class PicturePileImpl; -class LayerTreeSettings; class CC_EXPORT PicturePile : public RecordingSource { public: - PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size); + PicturePile(); ~PicturePile() override; // RecordingSource overrides. @@ -35,8 +34,10 @@ class CC_EXPORT PicturePile : public RecordingSource { scoped_refptr CreateRasterSource() const override; gfx::Size GetSize() const final; void SetEmptyBounds() override; + void SetMinContentsScale(float min_contents_scale) override; void SetSlowdownRasterScaleFactor(int factor) override; bool IsSuitableForGpuRasterization() const override; + void SetTileGridSize(const gfx::Size& tile_grid_size) override; void SetUnsuitableForGpuRasterizationForTesting() override; SkTileGridFactory::TileGridInfo GetTileGridInfoForTesting() const override; @@ -78,9 +79,6 @@ class CC_EXPORT PicturePile : public RecordingSource { void Clear(); - void SetMinContentsScale(float min_contents_scale); - void SetTileGridSize(const gfx::Size& tile_grid_size); - gfx::Rect PaddedRect(const PictureMapKey& key) const; gfx::Rect PadRect(const gfx::Rect& rect) const; diff --git a/cc/resources/picture_pile_unittest.cc b/cc/resources/picture_pile_unittest.cc index d8d3e8f0f95d..98ce3b18a07f 100644 --- a/cc/resources/picture_pile_unittest.cc +++ b/cc/resources/picture_pile_unittest.cc @@ -17,10 +17,7 @@ namespace { class PicturePileTestBase { public: - PicturePileTestBase() - : min_scale_(0.125), - pile_(min_scale_, gfx::Size(1000, 1000)), - frame_number_(0) {} + PicturePileTestBase() : min_scale_(0.125), frame_number_(0) {} void InitializeData() { pile_.SetTileGridSize(gfx::Size(1000, 1000)); @@ -55,9 +52,9 @@ class PicturePileTestBase { return result; } - float min_scale_; FakeContentLayerClient client_; FakePicturePile pile_; + float min_scale_; int frame_number_; }; diff --git a/cc/resources/recording_source.h b/cc/resources/recording_source.h index 728e9b625565..173e1a0b039e 100644 --- a/cc/resources/recording_source.h +++ b/cc/resources/recording_source.h @@ -38,9 +38,13 @@ class CC_EXPORT RecordingSource { virtual gfx::Size GetSize() const = 0; virtual void SetEmptyBounds() = 0; + virtual void SetMinContentsScale(float min_contents_scale) = 0; virtual void SetSlowdownRasterScaleFactor(int factor) = 0; virtual bool IsSuitableForGpuRasterization() const = 0; + // TODO(hendrikw): This is an implementation detail, remove it when possible. + virtual void SetTileGridSize(const gfx::Size& tile_grid_size) = 0; + // TODO(hendrikw): Figure out how to remove this. virtual void SetUnsuitableForGpuRasterizationForTesting() = 0; virtual SkTileGridFactory::TileGridInfo GetTileGridInfoForTesting() const = 0; diff --git a/cc/test/fake_picture_pile.h b/cc/test/fake_picture_pile.h index 55b4c360111f..4a7b65b86b34 100644 --- a/cc/test/fake_picture_pile.h +++ b/cc/test/fake_picture_pile.h @@ -19,9 +19,7 @@ class FakePicturePile : public PicturePile { using PictureMapKey = PicturePile::PictureMapKey; using PictureMap = PicturePile::PictureMap; - FakePicturePile(float min_contents_scale, const gfx::Size& tile_grid_size) - : PicturePile(min_contents_scale, tile_grid_size), - playback_allowed_event_(nullptr) {} + FakePicturePile() : playback_allowed_event_(nullptr) {} ~FakePicturePile() override {} // PicturePile overrides. diff --git a/cc/test/fake_picture_pile_impl.cc b/cc/test/fake_picture_pile_impl.cc index 8303a1147bf6..8b6cb8d5e1fa 100644 --- a/cc/test/fake_picture_pile_impl.cc +++ b/cc/test/fake_picture_pile_impl.cc @@ -32,11 +32,10 @@ FakePicturePileImpl::~FakePicturePileImpl() {} scoped_refptr FakePicturePileImpl::CreateFilledPile( const gfx::Size& tile_size, const gfx::Size& layer_bounds) { - FakePicturePile pile(ImplSidePaintingSettings().minimum_contents_scale, - ImplSidePaintingSettings().default_tile_grid_size); - pile.tiling().SetBorderTexels(0); + FakePicturePile pile; pile.tiling().SetTilingSize(layer_bounds); pile.tiling().SetMaxTextureSize(tile_size); + pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size); pile.SetRecordedViewport(gfx::Rect(layer_bounds)); pile.SetHasAnyRecordings(true); @@ -52,11 +51,10 @@ scoped_refptr FakePicturePileImpl::CreateFilledPile( scoped_refptr FakePicturePileImpl::CreateEmptyPile( const gfx::Size& tile_size, const gfx::Size& layer_bounds) { - FakePicturePile pile(ImplSidePaintingSettings().minimum_contents_scale, - ImplSidePaintingSettings().default_tile_grid_size); - pile.tiling().SetBorderTexels(0); + FakePicturePile pile; pile.tiling().SetTilingSize(layer_bounds); pile.tiling().SetMaxTextureSize(tile_size); + pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size); pile.SetRecordedViewport(gfx::Rect()); pile.SetHasAnyRecordings(false); return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr)); @@ -66,11 +64,10 @@ scoped_refptr FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( const gfx::Size& tile_size, const gfx::Size& layer_bounds) { - FakePicturePile pile(ImplSidePaintingSettings().minimum_contents_scale, - ImplSidePaintingSettings().default_tile_grid_size); - pile.tiling().SetBorderTexels(0); + FakePicturePile pile; pile.tiling().SetTilingSize(layer_bounds); pile.tiling().SetMaxTextureSize(tile_size); + pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size); // This simulates a false positive for this flag. pile.SetRecordedViewport(gfx::Rect()); pile.SetHasAnyRecordings(true); @@ -79,12 +76,12 @@ FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings( scoped_refptr FakePicturePileImpl::CreateInfiniteFilledPile() { + FakePicturePile pile; gfx::Size size(std::numeric_limits::max(), std::numeric_limits::max()); - FakePicturePile pile(ImplSidePaintingSettings().minimum_contents_scale, size); - pile.tiling().SetBorderTexels(0); pile.tiling().SetTilingSize(size); pile.tiling().SetMaxTextureSize(size); + pile.SetTileGridSize(size); pile.SetRecordedViewport(gfx::Rect(size)); pile.SetHasAnyRecordings(true); diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 7d028867524d..50ace9b7d78c 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -5573,8 +5573,7 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { pinch->SetIsContainerForFixedPositionLayers(true); root->AddChild(pinch); - scoped_ptr pile( - new FakePicturePile(0.0625f, gfx::Size(100, 100))); + scoped_ptr pile(new FakePicturePile); pile->SetPlaybackAllowedEvent(&playback_allowed_event_); scoped_refptr layer = FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); @@ -5828,8 +5827,7 @@ class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles pinch->SetIsContainerForFixedPositionLayers(true); root->AddChild(pinch); - scoped_ptr pile( - new FakePicturePile(0.0625f, gfx::Size(100, 100))); + scoped_ptr pile(new FakePicturePile); pile->SetPlaybackAllowedEvent(&playback_allowed_event_); scoped_refptr layer = FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); -- 2.11.4.GIT