Bug 1435022 - Make the Composite function private and document/clean it. r=sotaro

MozReview-Commit-ID: 3UQKwwC3Fav

--HG--
extra : rebase_source : 19737ed1c2ab40d7656257adbac10626ace1d9e7
This commit is contained in:
Kartikaya Gupta 2018-02-01 16:28:53 -05:00
Родитель 00c2abf4c9
Коммит 7a2ef4343b
2 изменённых файлов: 24 добавлений и 14 удалений

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

@ -211,24 +211,28 @@ void
CompositorVsyncScheduler::Composite(TimeStamp aVsyncTimestamp)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
{
MOZ_ASSERT(mVsyncSchedulerOwner);
{ // scope lock
MonitorAutoLock lock(mCurrentCompositeTaskMonitor);
mCurrentCompositeTask = nullptr;
}
if ((aVsyncTimestamp < mLastCompose) && !mAsapScheduling) {
// We can sometimes get vsync timestamps that are in the past
// compared to the last compose with force composites.
// In those cases, wait until the next vsync;
return;
}
if (!mAsapScheduling) {
// Some early exit conditions if we're not in ASAP mode
if (aVsyncTimestamp < mLastCompose) {
// We can sometimes get vsync timestamps that are in the past
// compared to the last compose with force composites.
// In those cases, wait until the next vsync;
return;
}
MOZ_ASSERT(mVsyncSchedulerOwner);
if (!mAsapScheduling && mVsyncSchedulerOwner->IsPendingComposite()) {
// If previous composite is still on going, finish it and does a next
// composite in a next vsync.
mVsyncSchedulerOwner->FinishPendingComposite();
return;
if (mVsyncSchedulerOwner->IsPendingComposite()) {
// If previous composite is still on going, finish it and wait for the
// next vsync.
mVsyncSchedulerOwner->FinishPendingComposite();
return;
}
}
DispatchTouchEvents(aVsyncTimestamp);
@ -236,7 +240,10 @@ CompositorVsyncScheduler::Composite(TimeStamp aVsyncTimestamp)
if (mNeedsComposite || mAsapScheduling) {
mNeedsComposite = 0;
mLastCompose = aVsyncTimestamp;
// Tell the owner to do a composite
mVsyncSchedulerOwner->CompositeToTarget(nullptr, nullptr);
mVsyncNotificationsSkipped = 0;
TimeDuration compositeFrameTotal = TimeStamp::Now() - aVsyncTimestamp;

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

@ -58,7 +58,6 @@ public:
void ScheduleComposition();
void CancelCurrentCompositeTask();
bool NeedsComposite();
void Composite(TimeStamp aVsyncTimestamp);
void ForceComposeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect);
const TimeStamp& GetLastComposeTime()
@ -87,6 +86,10 @@ private:
// such a task already queued. Can be called from any thread.
void PostVRTask(TimeStamp aTimestamp);
// This gets run at vsync time and "does" a composite (which really means
// update internal state and call the owner to do the composite).
void Composite(TimeStamp aVsyncTimestamp);
void NotifyCompositeTaskExecuted();
void ObserveVsync();
void UnobserveVsync();