Bug 1415762 - Cancel VRListener task when CompositorVsyncScheduler is going to destroy; r=dvander

MozReview-Commit-ID: CB5JrDGZTu1

--HG--
extra : rebase_source : 4a6f65f4aaf2c11f2dad1a471f0cb219470f1dbe
This commit is contained in:
Daosheng Mu 2017-11-13 11:33:33 +08:00
Родитель 3d64658419
Коммит 204ca9c9df
3 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -117,6 +117,7 @@ CompositorVsyncScheduler::Destroy()
CancelCurrentSetNeedsCompositeTask();
CancelCurrentCompositeTask();
CancelCurrentVRTask();
}
void
@ -133,6 +134,7 @@ CompositorVsyncScheduler::PostCompositeTask(TimeStamp aCompositeTimestamp)
mCurrentCompositeTask = task;
ScheduleTask(task.forget(), 0);
}
MonitorAutoLock lockVR(mCurrentVRListenerTaskMonitor);
if (mCurrentVRListenerTask == nullptr && VRListenerThreadHolder::Loop()) {
RefPtr<CancelableRunnable> task = NewCancelableRunnableMethod<TimeStamp>(
"layers::CompositorVsyncScheduler::DispatchVREvents",
@ -242,6 +244,18 @@ CompositorVsyncScheduler::CancelCurrentCompositeTask()
}
}
void
CompositorVsyncScheduler::CancelCurrentVRTask()
{
// This function is only called by CompositorVsyncScheduler::Destroy().
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
MonitorAutoLock lockVR(mCurrentVRListenerTaskMonitor);
if (mCurrentVRListenerTask) {
mCurrentVRListenerTask->Cancel();
mCurrentVRListenerTask = nullptr;
}
}
void
CompositorVsyncScheduler::Composite(TimeStamp aVsyncTimestamp)
{

Просмотреть файл

@ -83,6 +83,7 @@ private:
void DispatchTouchEvents(TimeStamp aVsyncTimestamp);
void DispatchVREvents(TimeStamp aVsyncTimestamp);
void CancelCurrentSetNeedsCompositeTask();
void CancelCurrentVRTask();
class Observer final : public VsyncObserver
{

Просмотреть файл

@ -27,7 +27,7 @@ public:
static VRListenerThreadHolder* GetSingleton();
static bool IsActive() {
return !!GetSingleton();
return GetSingleton() && Loop();
}
static void Start();