Bug 1366989 - Part 1: Expose a unique ID for each Animation instance. r?smaug
Currently the animation inspector re-generates the entire animation timeline
whenever an animation is added, changed, etc. In order to do a more minimal
update we would like to identify existing animations by assigning them a unique
ID. We cannot, however, simply use the Javascript object identity of the
Animation object since the Animations are serialized and sent from the DevTools
server to client.
This patch introduces a chrome-only property that provides a unique ID for each
Animation object. This ID is based on the Animation's address in memory which
alleviates the need to store a separate ID member on the Animation object.
MozReview-Commit-ID: AcZ49GBq6h4
--- a/dom/animation/Animation.cpp
+++ b/dom/animation/Animation.cpp
@@ -1515,16 +1515,22 @@ Animation::DispatchPlaybackEvent(const n
bool
Animation::IsRunningOnCompositor() const
{
return mEffect &&
mEffect->AsKeyframeEffect() &&
mEffect->AsKeyframeEffect()->IsRunningOnCompositor();
}
+uint64_t
+Animation::InternalUniqueId() const
+{
+ return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(this));
+}
+
template
void
Animation::ComposeStyle<RefPtr<AnimValuesStyleRule>&>(
RefPtr<AnimValuesStyleRule>& aAnimationRule,
const nsCSSPropertyIDSet& aPropertiesToSkip);
template
void
--- a/dom/animation/Animation.h
+++ b/dom/animation/Animation.h
@@ -113,16 +113,17 @@ public:
virtual Promise* GetReady(ErrorResult& aRv);
virtual Promise* GetFinished(ErrorResult& aRv);
void Cancel();
virtual void Finish(ErrorResult& aRv);
virtual void Play(ErrorResult& aRv, LimitBehavior aLimitBehavior);
virtual void Pause(ErrorResult& aRv);
virtual void Reverse(ErrorResult& aRv);
bool IsRunningOnCompositor() const;
+ uint64_t InternalUniqueId() const;
IMPL_EVENT_HANDLER(finish);
IMPL_EVENT_HANDLER(cancel);
// Wrapper functions for Animation DOM methods when called
// from script.
//
// We often use the same methods internally and from script but when called
// from script we (or one of our subclasses) perform extra steps such as
--- a/dom/webidl/Animation.webidl
+++ b/dom/webidl/Animation.webidl
@@ -44,9 +44,10 @@ interface Animation : EventTarget {
void pause ();
[Throws]
void reverse ();
};
// Non-standard extensions
partial interface Animation {
[ChromeOnly] readonly attribute boolean isRunningOnCompositor;
+ [ChromeOnly] readonly attribute unsigned long long internalUniqueId;
};