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

Unified Diff: ui/compositor/layer_animator.h

Issue 10869066: Attempt 2 at Fixes crash introduced @ 153047 (you can hit crash by maximizing a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: The fix Created 8 years, 4 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
Index: ui/compositor/layer_animator.h
diff --git a/ui/compositor/layer_animator.h b/ui/compositor/layer_animator.h
index 65ec27a4a2ef7006df068ec48d125539ccf87287..c8b47ffc85599421986680f4969ec68dd8d7736f 100644
--- a/ui/compositor/layer_animator.h
+++ b/ui/compositor/layer_animator.h
@@ -179,6 +179,12 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
private:
friend class ScopedLayerAnimationSettings;
+ // Used by FinishAnimation() to indicate if this has been destroyed.
+ enum DestroyedType {
+ DESTROYED,
+ NOT_DESTROYED,
+ };
+
// We need to keep track of the start time of every running animation.
struct RunningAnimation {
RunningAnimation(LayerAnimationSequence* sequence,
@@ -208,7 +214,8 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
LayerAnimationSequence* sequence) WARN_UNUSED_RESULT;
// Progresses to the end of the sequence before removing it.
- void FinishAnimation(LayerAnimationSequence* sequence);
+ DestroyedType FinishAnimation(
+ LayerAnimationSequence* sequence) WARN_UNUSED_RESULT;
// Finishes any running animation with zero duration.
void FinishAnyAnimationWithZeroDuration();
@@ -306,6 +313,10 @@ class COMPOSITOR_EXPORT LayerAnimator : public AnimationContainerElement {
// aborted.
ObserverList<LayerAnimationObserver> observers_;
+ // Set to true in the destructor (if non-NULL). Used to detect deletion while
+ // calling out.
+ bool* destroyed_;
+
DISALLOW_COPY_AND_ASSIGN(LayerAnimator);
};

Powered by Google App Engine
This is Rietveld 408576698