summaryrefslogtreecommitdiffstats
path: root/ui/compositor/layer_animation_sequence.h
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-30 00:35:41 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-30 00:35:41 +0000
commita48f30dae3eb9b572e3db2d11b5591053988b68f (patch)
tree15c03015d0bdb29c587d86baa8bd96a9cdea132d /ui/compositor/layer_animation_sequence.h
parentf731b9460b41625dca0baa3ececaf5caa3adb364 (diff)
downloadchromium_src-a48f30dae3eb9b572e3db2d11b5591053988b68f.zip
chromium_src-a48f30dae3eb9b572e3db2d11b5591053988b68f.tar.gz
chromium_src-a48f30dae3eb9b572e3db2d11b5591053988b68f.tar.bz2
The layer animator should hang onto weak, rather than raw, pointers to running animations.
To ensure that these pointers don't go stale, internally, the layer animator will use weak pointers and check that the instances they point to are still live before using them. A consequence of this change is that the animator methods have to be prepared for NULL sequences (RunningAnimation::sequence() can now return NULL if the sequence is dead). BUG= Review URL: https://chromiumcodereview.appspot.com/11300018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164799 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/compositor/layer_animation_sequence.h')
-rw-r--r--ui/compositor/layer_animation_sequence.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui/compositor/layer_animation_sequence.h b/ui/compositor/layer_animation_sequence.h
index abd3694..b05db20 100644
--- a/ui/compositor/layer_animation_sequence.h
+++ b/ui/compositor/layer_animation_sequence.h
@@ -9,6 +9,7 @@
#include "base/gtest_prod_util.h"
#include "base/memory/linked_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/time.h"
#include "ui/compositor/compositor_export.h"
@@ -27,7 +28,13 @@ class LayerAnimationObserver;
//
// TODO(vollick) Create a 'blended' sequence for transitioning between
// sequences.
-class COMPOSITOR_EXPORT LayerAnimationSequence {
+// TODO(vollick) Eventually, the LayerAnimator will switch to a model where new
+// work is scheduled rather than calling methods directly. This should make it
+// impossible for temporary pointers to running animations to go stale. When
+// this happens, there will be no need for LayerAnimationSequences to support
+// weak pointers.
+class COMPOSITOR_EXPORT LayerAnimationSequence
+ : public base::SupportsWeakPtr<LayerAnimationSequence> {
public:
LayerAnimationSequence();
// Takes ownership of the given element and adds it to the sequence.