diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-08 21:31:22 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-08 21:31:22 +0000 |
commit | 49304bde71a1acd64cb21cfde6314abb9c1710e1 (patch) | |
tree | 48add9e688cea95faee62d524227c950da1e0fb4 /cc/layers/tiled_layer.cc | |
parent | b7c0fb6db7ae85f1c9ce1190edf5176b2eaa371b (diff) | |
download | chromium_src-49304bde71a1acd64cb21cfde6314abb9c1710e1.zip chromium_src-49304bde71a1acd64cb21cfde6314abb9c1710e1.tar.gz chromium_src-49304bde71a1acd64cb21cfde6314abb9c1710e1.tar.bz2 |
cc: Make Layer::Update return a bool
As part of an optimization to prevent needless commits, add a return
value from Update to say whether or not any resources were updated as a
part of the call. Other layer property updates (bounds changes, etc)
that happen during Update are covered through the normal SetNeedsCommit
mechanism.
This will allow a future patch to make
SetNeedsDisplay/SetScrollOffsetFromImplThread only cause an update but
not necessarily cause a commit.
R=danakj@chromium.org
BUG=256381
Review URL: https://chromiumcodereview.appspot.com/18454003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210424 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/tiled_layer.cc')
-rw-r--r-- | cc/layers/tiled_layer.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc index 4ed9dee..8a7e661 100644 --- a/cc/layers/tiled_layer.cc +++ b/cc/layers/tiled_layer.cc @@ -323,7 +323,6 @@ bool TiledLayer::UpdateTiles(int left, ResourceUpdateQueue* queue, const OcclusionTracker* occlusion, bool* did_paint) { - *did_paint = false; CreateUpdaterIfNeeded(); bool ignore_occlusions = !occlusion; @@ -723,7 +722,7 @@ void TiledLayer::UpdateScrollPrediction() { previous_visible_rect_ = visible_content_rect(); } -void TiledLayer::Update(ResourceUpdateQueue* queue, +bool TiledLayer::Update(ResourceUpdateQueue* queue, const OcclusionTracker* occlusion) { DCHECK(!skips_draw_ && !failed_update_); // Did ResetUpdateState get skipped? { @@ -735,7 +734,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue, } if (tiler_->has_empty_bounds() || !DrawsContent()) - return; + return false; bool did_paint = false; @@ -751,14 +750,14 @@ void TiledLayer::Update(ResourceUpdateQueue* queue, &bottom); UpdateTiles(left, top, right, bottom, queue, NULL, &did_paint); if (did_paint) - return; + return did_paint; // This was an attempt to paint the entire layer so if we fail it's okay, // just fallback on painting visible etc. below. failed_update_ = false; } if (predicted_visible_rect_.IsEmpty()) - return; + return did_paint; // Visible painting. First occlude visible tiles and paint the non-occluded // tiles. @@ -771,18 +770,18 @@ void TiledLayer::Update(ResourceUpdateQueue* queue, if (skips_draw_) tiler_->reset(); if (skips_draw_ || did_paint) - return; + return true; // If we have already painting everything visible. Do some pre-painting while // idle. gfx::Rect idle_paint_content_rect = IdlePaintRect(); if (idle_paint_content_rect.IsEmpty()) - return; + return did_paint; // Prepaint anything that was occluded but inside the layer's visible region. if (!UpdateTiles(left, top, right, bottom, queue, NULL, &did_paint) || did_paint) - return; + return did_paint; int prepaint_left, prepaint_top, prepaint_right, prepaint_bottom; tiler_->ContentRectToTileIndices(idle_paint_content_rect, @@ -812,7 +811,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue, if (!UpdateTiles( left, bottom, right, bottom, queue, NULL, &did_paint) || did_paint) - return; + return did_paint; } } if (deltas[i].y() < 0) { @@ -821,7 +820,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue, if (!UpdateTiles( left, top, right, top, queue, NULL, &did_paint) || did_paint) - return; + return did_paint; } } if (deltas[i].x() < 0) { @@ -830,7 +829,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue, if (!UpdateTiles( left, top, left, bottom, queue, NULL, &did_paint) || did_paint) - return; + return did_paint; } } if (deltas[i].x() > 0) { @@ -839,10 +838,11 @@ void TiledLayer::Update(ResourceUpdateQueue* queue, if (!UpdateTiles( right, top, right, bottom, queue, NULL, &did_paint) || did_paint) - return; + return did_paint; } } } + return did_paint; } bool TiledLayer::NeedsIdlePaint() { |