Bug 1435022 - Minor cleanup on the Destroy function. r?sotaro
MozReview-Commit-ID: EnE6JKKmhgy
--- 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()
{