Commit e348f73a authored by Stefan Zager's avatar Stefan Zager Committed by Commit Bot

Clear paint artifacts immediately upon throttling local root frame

Change-Id: I7aa610995e6ee647f2a30ca3df5649d67cd7031a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533328Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826607}
parent 97bce643
...@@ -2577,11 +2577,6 @@ void LocalFrameView::UpdateLifecyclePhasesInternal( ...@@ -2577,11 +2577,6 @@ void LocalFrameView::UpdateLifecyclePhasesInternal(
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
DisallowLayoutInvalidationScope disallow_layout_invalidation(this); DisallowLayoutInvalidationScope disallow_layout_invalidation(this);
#endif #endif
// Now that we have run the lifecycle up to paint, we can reset
// |need_paint_phase_after_throttling_| so that the paint phase will
// properly see us as being throttled (if that was the only reason we remained
// unthrottled), and clear the painted output.
need_paint_phase_after_throttling_ = false;
DCHECK_EQ(target_state, DocumentLifecycle::kPaintClean); DCHECK_EQ(target_state, DocumentLifecycle::kPaintClean);
RunPaintLifecyclePhase(); RunPaintLifecyclePhase();
...@@ -4329,14 +4324,15 @@ void LocalFrameView::RenderThrottlingStatusChanged() { ...@@ -4329,14 +4324,15 @@ void LocalFrameView::RenderThrottlingStatusChanged() {
if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
SetPaintArtifactCompositorNeedsUpdate(); SetPaintArtifactCompositorNeedsUpdate();
if (!CanThrottleRendering()) if (!CanThrottleRendering()) {
InvalidateForThrottlingChange(); InvalidateForThrottlingChange();
} else if (GetFrame().IsLocalRoot()) {
// If we have become unthrottled, this is essentially a no-op since we're // By this point, every frame in the local frame tree has become throttled,
// going to paint anyway. If we have become throttled, then this will force // so painting the tree should just clear the previous painted output.
// one lifecycle update to clear the painted output. DCHECK(!in_lifecycle_update_);
if (GetFrame().IsLocalRoot()) AllowThrottlingScope allow_throtting(*this);
need_paint_phase_after_throttling_ = true; RunPaintLifecyclePhase();
}
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
// Make sure we never have an unthrottled frame inside a throttled one. // Make sure we never have an unthrottled frame inside a throttled one.
...@@ -4438,10 +4434,8 @@ bool LocalFrameView::ShouldThrottleRendering() const { ...@@ -4438,10 +4434,8 @@ bool LocalFrameView::ShouldThrottleRendering() const {
bool throttled_for_global_reasons = LocalFrameTreeAllowsThrottling() && bool throttled_for_global_reasons = LocalFrameTreeAllowsThrottling() &&
CanThrottleRendering() && CanThrottleRendering() &&
frame_->GetDocument(); frame_->GetDocument();
if (!throttled_for_global_reasons || needs_forced_compositing_update_ || if (!throttled_for_global_reasons || needs_forced_compositing_update_)
need_paint_phase_after_throttling_) {
return false; return false;
}
if (intersection_observation_state_ == kRequired) { if (intersection_observation_state_ == kRequired) {
auto* local_frame_root_view = GetFrame().LocalFrameRoot().View(); auto* local_frame_root_view = GetFrame().LocalFrameRoot().View();
......
...@@ -1138,13 +1138,6 @@ class CORE_EXPORT LocalFrameView final ...@@ -1138,13 +1138,6 @@ class CORE_EXPORT LocalFrameView final
HeapHashSet<WeakMember<HTMLVideoElement>> fullscreen_video_elements_; HeapHashSet<WeakMember<HTMLVideoElement>> fullscreen_video_elements_;
// If set, this indicates that the rendering throttling status for the local
// root frame has changed. In this scenario, if we have become unthrottled,
// this is a no-op since we run paint anyway. However, if we have become
// throttled, this will force the lifecycle to reach the paint phase so that
// it can clear the painted output.
bool need_paint_phase_after_throttling_ = false;
std::unique_ptr<OverlayInterstitialAdDetector> std::unique_ptr<OverlayInterstitialAdDetector>
overlay_interstitial_ad_detector_; overlay_interstitial_ad_detector_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment