Bug 1195180 part 3 - Add flag to record if DocumentTimeline is observing the refresh driver; r=heycam
authorBrian Birtles <birtles@gmail.com>
Mon, 28 Sep 2015 12:38:40 +0900
changeset 264597 9e72573ef43fef77a0d641721b91799876be2fab
parent 264596 33cbe1ef4956c93d6b9658656f0ec65a005b4100
child 264598 6d53140de0b0b839c71f3ed713aff9bb8471d58b
push id65690
push userbbirtles@mozilla.com
push dateMon, 28 Sep 2015 03:38:57 +0000
treeherdermozilla-inbound@005e98e2c5c9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1195180
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1195180 part 3 - Add flag to record if DocumentTimeline is observing the refresh driver; r=heycam
dom/animation/DocumentTimeline.cpp
dom/animation/DocumentTimeline.h
--- a/dom/animation/DocumentTimeline.cpp
+++ b/dom/animation/DocumentTimeline.cpp
@@ -89,16 +89,17 @@ DocumentTimeline::ToTimelineTime(const T
 
   result.SetValue(aTimeStamp - timing->GetNavigationStartTimeStamp());
   return result;
 }
 
 void
 DocumentTimeline::WillRefresh(mozilla::TimeStamp aTime)
 {
+  MOZ_ASSERT(mIsObservingRefreshDriver);
 }
 
 TimeStamp
 DocumentTimeline::ToTimeStamp(const TimeDuration& aTimeDuration) const
 {
   TimeStamp result;
   nsRefPtr<nsDOMNavigationTiming> timing = mDocument->GetNavigationTiming();
   if (MOZ_UNLIKELY(!timing)) {
--- a/dom/animation/DocumentTimeline.h
+++ b/dom/animation/DocumentTimeline.h
@@ -20,21 +20,26 @@ namespace dom {
 class DocumentTimeline final
   : public AnimationTimeline
   , public nsARefreshObserver
 {
 public:
   explicit DocumentTimeline(nsIDocument* aDocument)
     : AnimationTimeline(aDocument->GetParentObject())
     , mDocument(aDocument)
+    , mIsObservingRefreshDriver(false)
   {
   }
 
 protected:
-  virtual ~DocumentTimeline() { }
+  virtual ~DocumentTimeline()
+  {
+    MOZ_ASSERT(!mIsObservingRefreshDriver, "Timeline should have disassociated"
+               " from the refresh driver before being destroyed");
+  }
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(DocumentTimeline,
                                                          AnimationTimeline)
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
@@ -60,14 +65,15 @@ protected:
   nsRefreshDriver* GetRefreshDriver() const;
 
   nsCOMPtr<nsIDocument> mDocument;
 
   // The most recently used refresh driver time. This is used in cases where
   // we don't have a refresh driver (e.g. because we are in a display:none
   // iframe).
   mutable TimeStamp mLastRefreshDriverTime;
+  bool mIsObservingRefreshDriver;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_DocumentTimeline_h