Bug 1346644 - Disable high priority vsync handling in parent process, r=ehsan a=gchang
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Mon, 13 Mar 2017 18:25:10 +0200
changeset 395239 67bbe2d00028efff1ca24b9df98f4260384eb1b1
parent 395238 3b34b60914cc620bbd7ea9e94b7de9e103faeff7
child 395240 0129d0167217c4f563c8d765d3beacb1e6bc4e2d
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, gchang
bugs1346644
milestone54.0a2
Bug 1346644 - Disable high priority vsync handling in parent process, r=ehsan a=gchang
layout/base/nsRefreshDriver.cpp
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -480,44 +480,16 @@ private:
       , mRecentVsync(TimeStamp::Now())
       , mLastChildTick(TimeStamp::Now())
       , mVsyncRate(TimeDuration::Forever())
       , mProcessedVsync(true)
     {
       MOZ_ASSERT(NS_IsMainThread());
     }
 
-    class ParentProcessVsyncNotifier final: public Runnable,
-                                            public nsIRunnablePriority
-    {
-    public:
-      ParentProcessVsyncNotifier(RefreshDriverVsyncObserver* aObserver,
-                                 TimeStamp aVsyncTimestamp)
-        : mObserver(aObserver), mVsyncTimestamp(aVsyncTimestamp) {}
-
-      NS_DECL_ISUPPORTS_INHERITED
-
-      NS_IMETHOD Run() override
-      {
-        mObserver->TickRefreshDriver(mVsyncTimestamp);
-        return NS_OK;
-      }
-
-      NS_IMETHOD GetPriority(uint32_t* aPriority) override
-      {
-        *aPriority = nsIRunnablePriority::PRIORITY_HIGH;
-        return NS_OK;
-      }
-
-    private:
-      ~ParentProcessVsyncNotifier() {}
-      RefPtr<RefreshDriverVsyncObserver> mObserver;
-      TimeStamp mVsyncTimestamp;
-    };
-
     bool NotifyVsync(TimeStamp aVsyncTimestamp) override
     {
       if (!NS_IsMainThread()) {
         MOZ_ASSERT(XRE_IsParentProcess());
         // Compress vsync notifications such that only 1 may run at a time
         // This is so that we don't flood the refresh driver with vsync messages
         // if the main thread is blocked for long periods of time
         { // scope lock
@@ -525,17 +497,19 @@ private:
           mRecentVsync = aVsyncTimestamp;
           if (!mProcessedVsync) {
             return true;
           }
           mProcessedVsync = false;
         }
 
         nsCOMPtr<nsIRunnable> vsyncEvent =
-          new ParentProcessVsyncNotifier(this, aVsyncTimestamp);
+             NewRunnableMethod<TimeStamp>(this,
+                                          &RefreshDriverVsyncObserver::TickRefreshDriver,
+                                          aVsyncTimestamp);
         NS_DispatchToMainThread(vsyncEvent);
       } else {
         mRecentVsync = aVsyncTimestamp;
         if (!mBlockUntil.IsNull() && mBlockUntil > aVsyncTimestamp) {
           if (mProcessedVsync) {
             // Re-post vsync update as a normal priority runnable. This way
             // runnables already in normal priority queue get processed.
             mProcessedVsync = false;
@@ -742,21 +716,16 @@ private:
   RefPtr<RefreshTimerVsyncDispatcher> mVsyncDispatcher;
   // Used for child process.
   // The mVsyncChild will be always available before VsncChild::ActorDestroy().
   // After ActorDestroy(), StartTimer() and StopTimer() calls will be non-op.
   RefPtr<VsyncChild> mVsyncChild;
   TimeDuration mVsyncRate;
 }; // VsyncRefreshDriverTimer
 
-NS_IMPL_ISUPPORTS_INHERITED(VsyncRefreshDriverTimer::
-                            RefreshDriverVsyncObserver::
-                            ParentProcessVsyncNotifier,
-                            Runnable, nsIRunnablePriority)
-
 /**
  * Since the content process takes some time to setup
  * the vsync IPC connection, this timer is used
  * during the intial startup process.
  * During initial startup, the refresh drivers
  * are ticked off this timer, and are swapped out once content
  * vsync IPC connection is established.
  */