summaryrefslogtreecommitdiffstats
path: root/ui/compositor
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-24 22:09:35 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-24 22:09:35 +0000
commitaec12f8270d113642523a8f38a994eb38f06d709 (patch)
treeefe8998e4d9d7ff736c27889c83fb45574741ae3 /ui/compositor
parent8d1b9468adf90a429a3b262a6b1847a26d428032 (diff)
downloadchromium_src-aec12f8270d113642523a8f38a994eb38f06d709.zip
chromium_src-aec12f8270d113642523a8f38a994eb38f06d709.tar.gz
chromium_src-aec12f8270d113642523a8f38a994eb38f06d709.tar.bz2
Revert 153291 - Fixes crash introduced @ 153047 (you can hit crash by maximizing a
window). The cross fade code deletes the layer when the animation finishes. The newly added code was accessing members after the animation finished and the animator was deleted, resulting in the crash. Since I'm sure this will come up more in the future I've restructured the code to allow for deletion when calling out like this. The cross fade test exercises this code path now, but I'll see about a more focused tests shortly. BUG=129033 TEST=covered by tests. R=vollick@chromium.org Review URL: https://chromiumcodereview.appspot.com/10874064 TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/10882043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153312 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/compositor')
-rw-r--r--ui/compositor/layer_animation_observer.cc13
-rw-r--r--ui/compositor/layer_animation_observer.h4
-rw-r--r--ui/compositor/layer_animator.cc13
-rw-r--r--ui/compositor/layer_animator.h4
4 files changed, 4 insertions, 30 deletions
diff --git a/ui/compositor/layer_animation_observer.cc b/ui/compositor/layer_animation_observer.cc
index a4bd5b4..b41676a 100644
--- a/ui/compositor/layer_animation_observer.cc
+++ b/ui/compositor/layer_animation_observer.cc
@@ -56,14 +56,10 @@ void LayerAnimationObserver::DetachedFromSequence(
// ImplicitAnimationObserver
ImplicitAnimationObserver::ImplicitAnimationObserver()
- : active_(false),
- destroyed_(NULL) {
+ : active_(false) {
}
-ImplicitAnimationObserver::~ImplicitAnimationObserver() {
- if (destroyed_)
- *destroyed_ = true;
-}
+ImplicitAnimationObserver::~ImplicitAnimationObserver() {}
void ImplicitAnimationObserver::SetActive(bool active) {
active_ = active;
@@ -77,12 +73,7 @@ void ImplicitAnimationObserver::StopObservingImplicitAnimations() {
void ImplicitAnimationObserver::OnLayerAnimationEnded(
LayerAnimationSequence* sequence) {
- bool destroyed = false;
- destroyed_ = &destroyed;
sequence->RemoveObserver(this);
- if (destroyed)
- return;
- destroyed_ = NULL;
DCHECK(attached_sequences().find(sequence) == attached_sequences().end());
CheckCompleted();
}
diff --git a/ui/compositor/layer_animation_observer.h b/ui/compositor/layer_animation_observer.h
index 3484a2c..8810090 100644
--- a/ui/compositor/layer_animation_observer.h
+++ b/ui/compositor/layer_animation_observer.h
@@ -113,10 +113,6 @@ class COMPOSITOR_EXPORT ImplicitAnimationObserver
void CheckCompleted();
bool active_;
-
- // Set to true in the destructor (if non-NULL). Used to detect deletion while
- // calling out.
- bool* destroyed_;
};
} // namespace ui
diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
index 1921474..5fc289b 100644
--- a/ui/compositor/layer_animator.cc
+++ b/ui/compositor/layer_animator.cc
@@ -43,16 +43,13 @@ LayerAnimator::LayerAnimator(base::TimeDelta transition_duration)
transition_duration_(transition_duration),
tween_type_(Tween::LINEAR),
is_started_(false),
- disable_timer_for_test_(false),
- destroyed_(NULL) {
+ disable_timer_for_test_(false) {
}
LayerAnimator::~LayerAnimator() {
for (size_t i = 0; i < running_animations_.size(); ++i)
running_animations_[i].sequence->OnAnimatorDestroyed();
ClearAnimations();
- if (destroyed_)
- *destroyed_ = true;
}
// static
@@ -283,8 +280,6 @@ bool LayerAnimator::HasAnimation(LayerAnimationSequence* sequence) const {
void LayerAnimator::Step(base::TimeTicks now) {
TRACE_EVENT0("ui", "LayerAnimator::Step");
- bool destroyed = false;
- destroyed_ = &destroyed;
last_step_time_ = now;
// We need to make a copy of the running animations because progressing them
// and finishing them may indirectly affect the collection of running
@@ -299,15 +294,11 @@ void LayerAnimator::Step(base::TimeTicks now) {
if (delta >= running_animations_copy[i].sequence->duration() &&
!running_animations_copy[i].sequence->is_cyclic()) {
FinishAnimation(running_animations_copy[i].sequence);
- if (destroyed)
- return;
needs_redraw = true;
- } else if (ProgressAnimation(running_animations_copy[i].sequence, delta)) {
+ } else if (ProgressAnimation(running_animations_copy[i].sequence, delta))
needs_redraw = true;
- }
}
- destroyed_ = NULL;
if (needs_redraw && delegate())
delegate()->ScheduleDrawForAnimation();
}
diff --git a/ui/compositor/layer_animator.h b/ui/compositor/layer_animator.h
index ba15f25..65ec27a 100644
--- a/ui/compositor/layer_animator.h
+++ b/ui/compositor/layer_animator.h
@@ -306,10 +306,6 @@ 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);
};