Bug 1435022 - Inline OnForceComposeToTarget and clarify the comment. r=sotaro

This function has only one call site and there's no need to make it
public.

MozReview-Commit-ID: 5o7B9KMyVqy

--HG--
extra : rebase_source : 38a915c19d48784ce086ebecd66b9f872ae03327
This commit is contained in:
Kartikaya Gupta 2018-02-01 16:28:49 -05:00
parent d66e19eaaa
commit a4734bc1f0
2 changed files with 18 additions and 19 deletions

View File

@ -288,28 +288,28 @@ CompositorVsyncScheduler::Composite(TimeStamp aVsyncTimestamp)
}
}
void
CompositorVsyncScheduler::OnForceComposeToTarget()
{
/**
* bug 1138502 - There are cases such as during long-running window resizing events
* where we receive many sync RecvFlushComposites. We also get vsync notifications which
* will increment mVsyncNotificationsSkipped because a composite just occurred. After
* enough vsyncs and RecvFlushComposites occurred, we will disable vsync. Then at the next
* ScheduleComposite, we will enable vsync, then get a RecvFlushComposite, which will
* force us to unobserve vsync again. On some platforms, enabling/disabling vsync is not
* free and this oscillating behavior causes a performance hit. In order to avoid this problem,
* we reset the mVsyncNotificationsSkipped counter to keep vsync enabled.
*/
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
mVsyncNotificationsSkipped = 0;
}
void
CompositorVsyncScheduler::ForceComposeToTarget(gfx::DrawTarget* aTarget, const IntRect* aRect)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
OnForceComposeToTarget();
/**
* bug 1138502 - There are cases such as during long-running window resizing
* events where we receive many force-composites. We also continue to get
* vsync notifications. Because the force-composites trigger compositing and
* clear the mNeedsComposite counter, the vsync notifications will not need
* to do anything and so will increment the mVsyncNotificationsSkipped counter
* to indicate the vsync was ignored. If this happens enough times, we will
* disable listening for vsync entirely. On the next force-composite we will
* enable listening for vsync again, and continued force-composites and vsyncs
* will cause oscillation between observing vsync and not.
* On some platforms, enabling/disabling vsync is not free and this
* oscillating behavior causes a performance hit. In order to avoid this
* problem, we reset the mVsyncNotificationsSkipped counter to keep vsync
* enabled.
*/
mVsyncNotificationsSkipped = 0;
mLastCompose = TimeStamp::Now();
ComposeToTarget(aTarget, aRect);
}

View File

@ -50,7 +50,6 @@ public:
bool NotifyVsync(TimeStamp aVsyncTimestamp);
void SetNeedsComposite();
void OnForceComposeToTarget();
void ScheduleTask(already_AddRefed<CancelableRunnable>, int);
void ResumeComposition();