Skip to content

Commit

Permalink
Revert of cc: Indicate that we've updated a tiling if we invalidated …
Browse files Browse the repository at this point in the history
…it. (patchset #1 id:1 of https://codereview.chromium.org/1861933002/ )

Reason for revert:
Unittest doesn't compile on the branch. Need to reland without the test.

Original issue's description:
> cc: Indicate that we've updated a tiling if we invalidated it.
>
> This patch ensures that we inform the caller that the tiling was updated
> if it was invalidated since the last call to ComputeTilePriorityRects.
>
> This ensures that we don't bypass TileManager::PrepareTiles call.
>
> R=danakj, enne
> BUG=593449
> CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
>
> Review URL: https://codereview.chromium.org/1841083004
>
> Cr-Commit-Position: refs/heads/master@{#385020}
> (cherry picked from commit 6ee1182)
>
> Committed: https://chromium.googlesource.com/chromium/src/+/36f9bcfa8392c4ceab6da93507af27b1b01fedd8

[email protected],[email protected]
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=593449

Review URL: https://codereview.chromium.org/1864973006

Cr-Commit-Position: refs/branch-heads/2661@{#501}
Cr-Branched-From: ef6f6ae-refs/heads/master@{#378081}
  • Loading branch information
vmpstr authored and Commit bot committed Apr 6, 2016
1 parent 81c6d06 commit 87621f8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 39 deletions.
8 changes: 2 additions & 6 deletions cc/tiles/picture_layer_tiling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ PictureLayerTiling::PictureLayerTiling(
has_skewport_rect_tiles_(false),
has_soon_border_rect_tiles_(false),
has_eventually_rect_tiles_(false),
all_tiles_done_(true),
invalidated_since_last_compute_priority_rects_(false) {
all_tiles_done_(true) {
DCHECK(!raster_source->IsSolidColor());
gfx::Size content_bounds =
gfx::ScaleToCeiledSize(raster_source_->GetSize(), contents_scale);
Expand Down Expand Up @@ -288,7 +287,6 @@ void PictureLayerTiling::SetRasterSourceAndResize(

void PictureLayerTiling::Invalidate(const Region& layer_invalidation) {
DCHECK(tree_ != ACTIVE_TREE || !client_->GetPendingOrActiveTwinTiling(this));
invalidated_since_last_compute_priority_rects_ = true;
RemoveTilesInRegion(layer_invalidation, true /* recreate tiles */);
}

Expand Down Expand Up @@ -640,13 +638,11 @@ bool PictureLayerTiling::ComputeTilePriorityRects(
set_all_tiles_done(false);
}

bool invalidated = invalidated_since_last_compute_priority_rects_;
invalidated_since_last_compute_priority_rects_ = false;
if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds,
viewport_in_layer_space)) {
// This should never be zero for the purposes of has_ever_been_updated().
DCHECK_NE(current_frame_time_in_seconds, 0.0);
return invalidated;
return false;
}

const float content_to_screen_scale = ideal_contents_scale / contents_scale_;
Expand Down
1 change: 0 additions & 1 deletion cc/tiles/picture_layer_tiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ class CC_EXPORT PictureLayerTiling {
bool has_soon_border_rect_tiles_;
bool has_eventually_rect_tiles_;
bool all_tiles_done_;
bool invalidated_since_last_compute_priority_rects_;

private:
DISALLOW_COPY_AND_ASSIGN(PictureLayerTiling);
Expand Down
32 changes: 0 additions & 32 deletions cc/tiles/picture_layer_tiling_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1790,38 +1790,6 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) {
EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
}

TEST(PictureLayerTilingTest, InvalidateAfterComputeTilePriorityRects) {
FakePictureLayerTilingClient pending_client;
pending_client.SetTileSize(gfx::Size(100, 100));

scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(gfx::Size(100, 100));
scoped_ptr<TestablePictureLayerTiling> pending_tiling =
TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source,
&pending_client, LayerTreeSettings());
pending_tiling->set_resolution(HIGH_RESOLUTION);

// Ensure that we can compute tile priority rects, invalidate, and compute the
// rects again. It is important that the second compute tile priority rects
// return true, indicating that things have changed (since invalidation has
// changed things). This causes PrepareTiles to be properly scheduled. If the
// second ComputeTilePriorityRects returns false, then we assume that
// PrepareTiles isn't needed and we signal that we're ready to draw
// immediately, which can cause visual glitches.
//
// This can happen we if we process an impl frame deadline before processing a
// commit. That is, when we draw we ComputeTilePriorityRects. If we process
// the commit afterwards, it would use the same timestamp and sometimes would
// use the same viewport to compute tile priority rects again.
double time = 1.;
gfx::Rect viewport(0, 0, 100, 100);
EXPECT_TRUE(pending_tiling->ComputeTilePriorityRects(viewport, 1.0f, time,
Occlusion()));
pending_tiling->Invalidate(viewport);
EXPECT_TRUE(pending_tiling->ComputeTilePriorityRects(viewport, 1.0f, time,
Occlusion()));
}

TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) {
// The tiling has four rows and three columns.
Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150));
Expand Down

0 comments on commit 87621f8

Please sign in to comment.