Bug 1435022 - Inline a one-line function with a confusing name. r?sotaro
This function is exposed as public but only ever called from two places,
both of which are inside the class. It's confusing to have it as a
separate function because it just makes it harder to trace through the
code.
MozReview-Commit-ID: BC7mvOc9wo
--- a/gfx/layers/ipc/CompositorVsyncScheduler.cpp
+++ b/gfx/layers/ipc/CompositorVsyncScheduler.cpp
@@ -272,17 +272,17 @@ CompositorVsyncScheduler::Composite(Time
return;
}
DispatchTouchEvents(aVsyncTimestamp);
if (mNeedsComposite || mAsapScheduling) {
mNeedsComposite = 0;
mLastCompose = aVsyncTimestamp;
- ComposeToTarget(nullptr);
+ mVsyncSchedulerOwner->CompositeToTarget(nullptr, nullptr);
mVsyncNotificationsSkipped = 0;
TimeDuration compositeFrameTotal = TimeStamp::Now() - aVsyncTimestamp;
mozilla::Telemetry::Accumulate(mozilla::Telemetry::COMPOSITE_FRAME_ROUNDTRIP_TIME,
compositeFrameTotal.ToMilliseconds());
} else if (mVsyncNotificationsSkipped++ > gfxPrefs::CompositorUnobserveCount()) {
UnobserveVsync();
}
@@ -306,17 +306,18 @@ CompositorVsyncScheduler::ForceComposeTo
* 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);
+ MOZ_ASSERT(mVsyncSchedulerOwner);
+ mVsyncSchedulerOwner->CompositeToTarget(aTarget, aRect);
}
bool
CompositorVsyncScheduler::NeedsComposite()
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
return mNeedsComposite;
}
@@ -362,18 +363,10 @@ CompositorVsyncScheduler::DispatchVREven
void
CompositorVsyncScheduler::ScheduleTask(already_AddRefed<CancelableRunnable> aTask)
{
MOZ_ASSERT(CompositorThreadHolder::Loop());
CompositorThreadHolder::Loop()->PostDelayedTask(Move(aTask), 0);
}
-void
-CompositorVsyncScheduler::ComposeToTarget(gfx::DrawTarget* aTarget, const IntRect* aRect)
-{
- MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
- MOZ_ASSERT(mVsyncSchedulerOwner);
- mVsyncSchedulerOwner->CompositeToTarget(aTarget, aRect);
-}
-
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/ipc/CompositorVsyncScheduler.h
+++ b/gfx/layers/ipc/CompositorVsyncScheduler.h
@@ -46,17 +46,16 @@ class CompositorVsyncScheduler
public:
explicit CompositorVsyncScheduler(CompositorVsyncSchedulerOwner* aVsyncSchedulerOwner,
widget::CompositorWidget* aWidget);
bool NotifyVsync(TimeStamp aVsyncTimestamp);
void SetNeedsComposite();
- void ComposeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr);
void PostCompositeTask(TimeStamp aCompositeTimestamp);
void PostVRTask(TimeStamp aTimestamp);
void Destroy();
void ScheduleComposition();
void CancelCurrentCompositeTask();
bool NeedsComposite();
void Composite(TimeStamp aVsyncTimestamp);
void ForceComposeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect);