Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: content/browser/web_contents/aura/overscroll_navigation_overlay.cc

Issue 185793005: Replacing raw pointer to LayerAnimator with scoped_refptr in ScopedLayerAnimationSettings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a unit test. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/compositor/layer_animator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/aura/overscroll_navigation_overlay.cc
diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
index dc7f3f651c6f04bef3b541021cf5a94bced180c8..78e3b97f2b2aa7adf7b02568bf03cb9541de48de 100644
--- a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
+++ b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc
@@ -77,17 +77,12 @@ class OverlayDismissAnimator
// the object deletes itself along with the layer.
void Animate() {
DCHECK(layer_.get());
- // Hold on to LayerAnimator to ensure it is not deleted before animation
- // settings. Without this LayerAnimator would be deleted from SetOpacity if
- // the animation duration is 0.
- scoped_refptr<ui::LayerAnimator> animator(layer_->GetAnimator());
- {
- // This makes SetOpacity() animate with default duration (which could be
- // zero, e.g. when running tests).
- ui::ScopedLayerAnimationSettings settings(animator);
- animator->AddObserver(this);
- layer_->SetOpacity(0);
- }
+ ui::LayerAnimator* animator = layer_->GetAnimator();
+ // This makes SetOpacity() animate with default duration (which could be
+ // zero, e.g. when running tests).
+ ui::ScopedLayerAnimationSettings settings(animator);
+ animator->AddObserver(this);
+ layer_->SetOpacity(0);
}
// Overridden from ui::LayerAnimationObserver
« no previous file with comments | « no previous file | ui/compositor/layer_animator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698