Bug 1435022 - Minor cleanup on the Destroy function. r?sotaro draft
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 01 Feb 2018 16:28:53 -0500
changeset 750297 c4942304ce803e68c86a532fa6624980627f3c3c
parent 750296 48257aca0ac608ee39bbddbc9759eadcae91bf8a
child 750298 1f4e754143ecfd714ec5c424a860faaf4b0cd136
push id97612
push userkgupta@mozilla.com
push dateThu, 01 Feb 2018 21:30:35 +0000
reviewerssotaro
bugs1435022
milestone60.0a1
Bug 1435022 - Minor cleanup on the Destroy function. r?sotaro MozReview-Commit-ID: EnE6JKKmhgy
gfx/layers/ipc/CompositorVsyncScheduler.cpp
gfx/layers/ipc/CompositorVsyncScheduler.h
--- a/gfx/layers/ipc/CompositorVsyncScheduler.cpp
+++ b/gfx/layers/ipc/CompositorVsyncScheduler.cpp
@@ -101,21 +101,22 @@ CompositorVsyncScheduler::~CompositorVsy
   MOZ_ASSERT(!mVsyncObserver);
   // The CompositorVsyncDispatcher is cleaned up before this in the nsBaseWidget, which stops vsync listeners
   mVsyncSchedulerOwner = nullptr;
 }
 
 void
 CompositorVsyncScheduler::Destroy()
 {
+  MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
+
   if (!mVsyncObserver) {
     // Destroy was already called on this object.
     return;
   }
-  MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
   UnobserveVsync();
   mVsyncObserver->Destroy();
   mVsyncObserver = nullptr;
 
   CancelCurrentSetNeedsCompositeTask();
   CancelCurrentCompositeTask();
 }
 
--- a/gfx/layers/ipc/CompositorVsyncScheduler.h
+++ b/gfx/layers/ipc/CompositorVsyncScheduler.h
@@ -46,17 +46,21 @@ class CompositorVsyncScheduler
 
 public:
   explicit CompositorVsyncScheduler(CompositorVsyncSchedulerOwner* aVsyncSchedulerOwner,
                                     widget::CompositorWidget* aWidget);
 
   bool NotifyVsync(TimeStamp aVsyncTimestamp);
   void SetNeedsComposite();
 
+  /**
+   * Do cleanup. This must be called on the compositor thread.
+   */
   void Destroy();
+
   void ScheduleComposition();
   void CancelCurrentCompositeTask();
   bool NeedsComposite();
   void Composite(TimeStamp aVsyncTimestamp);
   void ForceComposeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect);
 
   const TimeStamp& GetLastComposeTime()
   {