Bug 1435022 - Inline a one-line function with a confusing name. r?sotaro draft
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 01 Feb 2018 16:28:52 -0500
changeset 750295 7d2c8b917ad750e97fd5c97ce20e3da1c5c5a007
parent 750294 52539b143f316b945b16c5393b87a11d3b521b44
child 750296 48257aca0ac608ee39bbddbc9759eadcae91bf8a
push id97612
push userkgupta@mozilla.com
push dateThu, 01 Feb 2018 21:30:35 +0000
reviewerssotaro
bugs1435022
milestone60.0a1
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
gfx/layers/ipc/CompositorVsyncScheduler.cpp
gfx/layers/ipc/CompositorVsyncScheduler.h
--- 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);