Skip to content

Commit

Permalink
Bug 1435022 - Inline OnForceComposeToTarget and clarify the comment. …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
staktrace committed Feb 1, 2018
1 parent d66e19e commit a4734bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
32 changes: 16 additions & 16 deletions gfx/layers/ipc/CompositorVsyncScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,27 +289,27 @@ CompositorVsyncScheduler::Composite(TimeStamp aVsyncTimestamp)
}

void
CompositorVsyncScheduler::OnForceComposeToTarget()
CompositorVsyncScheduler::ForceComposeToTarget(gfx::DrawTarget* aTarget, const IntRect* aRect)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());

/**
* 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.
* 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.
*/
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
mVsyncNotificationsSkipped = 0;
}

void
CompositorVsyncScheduler::ForceComposeToTarget(gfx::DrawTarget* aTarget, const IntRect* aRect)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
OnForceComposeToTarget();
mLastCompose = TimeStamp::Now();
ComposeToTarget(aTarget, aRect);
}
Expand Down
1 change: 0 additions & 1 deletion gfx/layers/ipc/CompositorVsyncScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class CompositorVsyncScheduler

bool NotifyVsync(TimeStamp aVsyncTimestamp);
void SetNeedsComposite();
void OnForceComposeToTarget();

void ScheduleTask(already_AddRefed<CancelableRunnable>, int);
void ResumeComposition();
Expand Down

0 comments on commit a4734bc

Please sign in to comment.