Bug 1697585 - Rename high priority to vsync priority r=smaug
☠☠ backed out by dc555adb9f36 ☠ ☠
authorSean Feng <sefeng@mozilla.com>
Tue, 06 Apr 2021 13:10:50 +0000
changeset 642061 074ebebaee27545a70e221e8a5c2ad9dc7a2533b
parent 642060 6df772b29a9dcdf5444bf736e737c885f74d9cad
child 642062 0b1bc6cb84af5930615de50823527b74872d4918
push id15309
push userffxbld-merge
push dateMon, 19 Apr 2021 17:51:21 +0000
treeherdermozilla-beta@842785ce363f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1697585
milestone89.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1697585 - Rename high priority to vsync priority r=smaug `High` priority is being used for vsync tasks, so we should rename it to make it clear, and renaming it also makes our priority naming less confusing. Differential Revision: https://phabricator.services.mozilla.com/D109536
dom/ipc/PVsync.ipdl
ipc/chromium/src/chrome/common/ipc_message.h
ipc/glue/MessageChannel.cpp
ipc/ipdl/ipdl/ast.py
ipc/ipdl/ipdl/lower.py
ipc/ipdl/ipdl/type.py
ipc/ipdl/test/cxx/PTestPriority.ipdl
ipc/ipdl/test/ipdl/ok/Prio.ipdl
layout/base/nsRefreshDriver.cpp
xpcom/tests/gtest/TestEventPriorities.cpp
xpcom/threads/EventQueue.cpp
xpcom/threads/EventQueue.h
xpcom/threads/ThreadEventQueue.cpp
xpcom/threads/nsIRunnable.idl
--- a/dom/ipc/PVsync.ipdl
+++ b/dom/ipc/PVsync.ipdl
@@ -19,17 +19,17 @@ namespace dom {
  * interfaces for content to observe/unobserve vsync event notifications.
  */
 async protocol PVsync
 {
   manager PBackground or PBrowser;
 
 child:
   // Send vsync event and vsync rate from chrome to content process.
-  [Compress, Priority=high] async Notify(VsyncEvent aVsync, float aVsyncRate);
+  [Compress, Priority=vsync] async Notify(VsyncEvent aVsync, float aVsyncRate);
 
 parent:
   // Content process use these messages to acquire the vsync event.
   async Observe();
   async Unobserve();
 
   // This message is never sent. Each PVsync actor will stay alive as long as
   // its PBackground or PBrowser manager.
--- a/ipc/chromium/src/chrome/common/ipc_message.h
+++ b/ipc/chromium/src/chrome/common/ipc_message.h
@@ -56,17 +56,17 @@ class Message : public Pickle {
     NOT_NESTED = 1,
     NESTED_INSIDE_SYNC = 2,
     NESTED_INSIDE_CPOW = 3
   };
 
   enum PriorityValue {
     NORMAL_PRIORITY = 0,
     INPUT_PRIORITY = 1,
-    HIGH_PRIORITY = 2,
+    VSYNC_PRIORITY = 2,
     MEDIUMHIGH_PRIORITY = 3,
   };
 
   enum MessageCompression {
     COMPRESSION_NONE,
     COMPRESSION_ENABLED,
     COMPRESSION_ALL
   };
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -2008,18 +2008,18 @@ NS_IMETHODIMP
 MessageChannel::MessageTask::GetPriority(uint32_t* aPriority) {
   switch (mMessage.priority()) {
     case Message::NORMAL_PRIORITY:
       *aPriority = PRIORITY_NORMAL;
       break;
     case Message::INPUT_PRIORITY:
       *aPriority = PRIORITY_INPUT_HIGH;
       break;
-    case Message::HIGH_PRIORITY:
-      *aPriority = PRIORITY_HIGH;
+    case Message::VSYNC_PRIORITY:
+      *aPriority = PRIORITY_VSYNC;
       break;
     case Message::MEDIUMHIGH_PRIORITY:
       *aPriority = PRIORITY_MEDIUMHIGH;
       break;
     default:
       MOZ_ASSERT(false);
       break;
   }
--- a/ipc/ipdl/ipdl/ast.py
+++ b/ipc/ipdl/ipdl/ast.py
@@ -6,17 +6,17 @@ from .util import hash_str
 
 
 NOT_NESTED = 1
 INSIDE_SYNC_NESTED = 2
 INSIDE_CPOW_NESTED = 3
 
 NORMAL_PRIORITY = 1
 INPUT_PRIORITY = 2
-HIGH_PRIORITY = 3
+VSYNC_PRIORITY = 3
 MEDIUMHIGH_PRIORITY = 4
 
 
 class Visitor:
     def defaultVisit(self, node):
         raise Exception(
             "INTERNAL ERROR: no visitor for node type `%s'" % (node.__class__.__name__)
         )
@@ -344,17 +344,17 @@ class MessageDecl(Node):
 
     def priority(self):
         if "Priority" not in self.attributes:
             return NORMAL_PRIORITY
 
         return {
             "normal": NORMAL_PRIORITY,
             "input": INPUT_PRIORITY,
-            "high": HIGH_PRIORITY,
+            "vsync": VSYNC_PRIORITY,
             "mediumhigh": MEDIUMHIGH_PRIORITY,
         }[self.attributes["Priority"].value]
 
 
 class Param(Node):
     def __init__(self, loc, typespec, name, attributes={}):
         Node.__init__(self, loc)
         self.name = name
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -1878,18 +1878,18 @@ def _generateMessageConstructor(md, segm
     else:
         assert nested == ipdl.ast.INSIDE_CPOW_NESTED
         nestedEnum = "NESTED_INSIDE_CPOW"
 
     if prio == ipdl.ast.NORMAL_PRIORITY:
         prioEnum = "NORMAL_PRIORITY"
     elif prio == ipdl.ast.INPUT_PRIORITY:
         prioEnum = "INPUT_PRIORITY"
-    elif prio == ipdl.ast.HIGH_PRIORITY:
-        prioEnum = "HIGH_PRIORITY"
+    elif prio == ipdl.ast.VSYNC_PRIORITY:
+        prioEnum = "VSYNC_PRIORITY"
     else:
         prioEnum = "MEDIUMHIGH_PRIORITY"
 
     if md.decl.type.isSync():
         syncEnum = "SYNC"
     else:
         syncEnum = "ASYNC"
 
--- a/ipc/ipdl/ipdl/type.py
+++ b/ipc/ipdl/ipdl/type.py
@@ -1244,17 +1244,17 @@ class GatherDecls(TcheckVisitor):
         msgname = md.name
         loc = md.loc
 
         self.checkAttributes(
             md.attributes,
             {
                 "Tainted": None,
                 "Compress": (None, "all"),
-                "Priority": ("normal", "input", "high", "mediumhigh"),
+                "Priority": ("normal", "input", "vsync", "mediumhigh"),
                 "Nested": ("not", "inside_sync", "inside_cpow"),
             },
         )
 
         if md.sendSemantics is INTR and "Priority" in md.attributes:
             self.error(loc, "intr message `%s' cannot specify [Priority]", msgname)
 
         if md.sendSemantics is INTR and "Nested" in md.attributes:
--- a/ipc/ipdl/test/cxx/PTestPriority.ipdl
+++ b/ipc/ipdl/test/cxx/PTestPriority.ipdl
@@ -1,20 +1,20 @@
 namespace mozilla {
 namespace _ipdltest {
 
 sync protocol PTestPriority {
 parent:
     [Priority=input] async PMsg1();
     [Priority=input] sync PMsg2();
-    [Priority=high] async PMsg3();
-    [Priority=high] sync PMsg4();
+    [Priority=vsync] async PMsg3();
+    [Priority=vsync] sync PMsg4();
     [Priority=mediumhigh] async PMsg5();
     [Priority=mediumhigh] sync PMsg6();
 
 child:
     [Priority=input] async CMsg1();
-    [Priority=high] async CMsg2();
+    [Priority=vsync] async CMsg2();
     [Priority=mediumhigh] async CMsg3();
 };
 
 } // namespace _ipdltest
 } // namespace mozilla
--- a/ipc/ipdl/test/ipdl/ok/Prio.ipdl
+++ b/ipc/ipdl/test/ipdl/ok/Prio.ipdl
@@ -1,8 +1,8 @@
 async protocol Prio
 {
 child:
   [Priority=normal] async NormalPrio();
-  [Priority=high] async HighPrio();
+  [Priority=vsync] async VsyncPrio();
   [Priority=input] async InputPrio();
   [Priority=mediumhigh] async MediumHighPrio();
 };
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -496,33 +496,33 @@ class VsyncRefreshDriverTimer : public R
                 "VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::"
                 "ParentProcessVsyncNotifier"),
             mObserver(aObserver) {}
 
       NS_DECL_ISUPPORTS_INHERITED
 
       NS_IMETHOD Run() override {
         MOZ_ASSERT(NS_IsMainThread());
-        sHighPriorityEnabled = mozilla::BrowserTabsRemoteAutostart();
+        sVsyncPriorityEnabled = mozilla::BrowserTabsRemoteAutostart();
 
         mObserver->NotifyParentProcessVsync();
         return NS_OK;
       }
 
       NS_IMETHOD GetPriority(uint32_t* aPriority) override {
-        *aPriority = sHighPriorityEnabled
-                         ? nsIRunnablePriority::PRIORITY_HIGH
+        *aPriority = sVsyncPriorityEnabled
+                         ? nsIRunnablePriority::PRIORITY_VSYNC
                          : nsIRunnablePriority::PRIORITY_NORMAL;
         return NS_OK;
       }
 
      private:
       ~ParentProcessVsyncNotifier() = default;
       RefPtr<RefreshDriverVsyncObserver> mObserver;
-      static mozilla::Atomic<bool> sHighPriorityEnabled;
+      static mozilla::Atomic<bool> sVsyncPriorityEnabled;
     };
 
     bool NotifyVsync(const VsyncEvent& aVsync) override {
       // 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
         MonitorAutoLock lock(mParentProcessRefreshTickLock);
@@ -790,17 +790,17 @@ class VsyncRefreshDriverTimer : public R
 };  // VsyncRefreshDriverTimer
 
 NS_IMPL_ISUPPORTS_INHERITED(
     VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::
         ParentProcessVsyncNotifier,
     Runnable, nsIRunnablePriority)
 
 mozilla::Atomic<bool> VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::
-    ParentProcessVsyncNotifier::sHighPriorityEnabled(false);
+    ParentProcessVsyncNotifier::sVsyncPriorityEnabled(false);
 
 /**
  * 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.
@@ -1457,17 +1457,17 @@ void nsRefreshDriver::EnsureTimerStarted
               [self]() -> void {
                 // Re-check if we can still do a catch-up, in case anything
                 // changed while the runnable was pending.
                 if (self->CanDoCatchUpTick()) {
                   self->Tick(self->mActiveTimer->MostRecentRefreshVsyncId(),
                              self->mActiveTimer->MostRecentRefresh());
                 }
               }),
-          EventQueuePriority::High);
+          EventQueuePriority::Vsync);
     }
   }
 
   // When switching from an inactive timer to an active timer, the root
   // refresh driver is skipped due to being set to the content refresh
   // driver's timestamp. In case of EnsureTimerStarted is called from
   // ScheduleViewManagerFlush, we should avoid this behavior to flush
   // a paint in the same tick on the root refresh driver.
--- a/xpcom/tests/gtest/TestEventPriorities.cpp
+++ b/xpcom/tests/gtest/TestEventPriorities.cpp
@@ -70,17 +70,17 @@ TEST(EventPriorities, IdleAfterNormal)
 TEST(EventPriorities, HighNormal)
 {
   int normalRan = 0, highRan = 0;
 
   RefPtr<TestEvent> evNormal = new TestEvent(
       &normalRan, [&] { ASSERT_TRUE((highRan - normalRan) >= 0); });
   RefPtr<TestEvent> evHigh = new TestEvent(
       &highRan, [&] { ASSERT_TRUE((highRan - normalRan) >= 0); },
-      nsIRunnablePriority::PRIORITY_HIGH);
+      nsIRunnablePriority::PRIORITY_VSYNC);
 
   NS_DispatchToMainThread(evNormal);
   NS_DispatchToMainThread(evNormal);
   NS_DispatchToMainThread(evNormal);
   NS_DispatchToMainThread(evHigh);
   NS_DispatchToMainThread(evHigh);
   NS_DispatchToMainThread(evHigh);
 
--- a/xpcom/threads/EventQueue.cpp
+++ b/xpcom/threads/EventQueue.cpp
@@ -25,18 +25,18 @@ void EventQueueInternal<ItemsPerPage>::P
   static_assert(static_cast<uint32_t>(nsIRunnablePriority::PRIORITY_NORMAL) ==
                 static_cast<uint32_t>(EventQueuePriority::Normal));
   static_assert(
       static_cast<uint32_t>(nsIRunnablePriority::PRIORITY_MEDIUMHIGH) ==
       static_cast<uint32_t>(EventQueuePriority::MediumHigh));
   static_assert(
       static_cast<uint32_t>(nsIRunnablePriority::PRIORITY_INPUT_HIGH) ==
       static_cast<uint32_t>(EventQueuePriority::InputHigh));
-  static_assert(static_cast<uint32_t>(nsIRunnablePriority::PRIORITY_HIGH) ==
-                static_cast<uint32_t>(EventQueuePriority::High));
+  static_assert(static_cast<uint32_t>(nsIRunnablePriority::PRIORITY_VSYNC) ==
+                static_cast<uint32_t>(EventQueuePriority::Vsync));
 
   if (mForwardToTC) {
     TaskController* tc = TaskController::Get();
 
     TaskManager* manager = nullptr;
     if (aPriority == EventQueuePriority::InputHigh) {
       if (InputTaskManager::Get()->State() ==
           InputTaskManager::STATE_DISABLED) {
--- a/xpcom/threads/EventQueue.h
+++ b/xpcom/threads/EventQueue.h
@@ -18,17 +18,17 @@ namespace mozilla {
 
 enum class EventQueuePriority {
   Idle,
   DeferredTimers,
   InputLow,
   Normal,
   MediumHigh,
   InputHigh,
-  High,
+  Vsync,
 
   Count
 };
 
 class IdlePeriodState;
 
 namespace detail {
 
--- a/xpcom/threads/ThreadEventQueue.cpp
+++ b/xpcom/threads/ThreadEventQueue.cpp
@@ -76,18 +76,18 @@ bool ThreadEventQueue::PutEventInternal(
     // Check if the runnable wants to override the passed-in priority.
     // Do this outside the lock, so runnables implemented in JS can QI
     // (and possibly GC) outside of the lock.
     if (mIsMainThread) {
       auto* e = event.get();  // can't do_QueryInterface on LeakRefPtr.
       if (nsCOMPtr<nsIRunnablePriority> runnablePrio = do_QueryInterface(e)) {
         uint32_t prio = nsIRunnablePriority::PRIORITY_NORMAL;
         runnablePrio->GetPriority(&prio);
-        if (prio == nsIRunnablePriority::PRIORITY_HIGH) {
-          aPriority = EventQueuePriority::High;
+        if (prio == nsIRunnablePriority::PRIORITY_VSYNC) {
+          aPriority = EventQueuePriority::Vsync;
         } else if (prio == nsIRunnablePriority::PRIORITY_INPUT_HIGH) {
           aPriority = EventQueuePriority::InputHigh;
         } else if (prio == nsIRunnablePriority::PRIORITY_MEDIUMHIGH) {
           aPriority = EventQueuePriority::MediumHigh;
         } else if (prio == nsIRunnablePriority::PRIORITY_DEFERRED_TIMERS) {
           aPriority = EventQueuePriority::DeferredTimers;
         } else if (prio == nsIRunnablePriority::PRIORITY_IDLE) {
           aPriority = EventQueuePriority::Idle;
--- a/xpcom/threads/nsIRunnable.idl
+++ b/xpcom/threads/nsIRunnable.idl
@@ -23,17 +23,17 @@ interface nsIRunnablePriority : nsISuppo
 {
     const unsigned short PRIORITY_IDLE = 0;
     const unsigned short PRIORITY_DEFERRED_TIMERS = 1;
     // INPUT_LOW isn't supposed to be used directly.
     // const unsigned short PRIORITY_INPUT_LOW = 2;
     const unsigned short PRIORITY_NORMAL = 3;
     const unsigned short PRIORITY_MEDIUMHIGH = 4;
     const unsigned short PRIORITY_INPUT_HIGH = 5;
-    const unsigned short PRIORITY_HIGH = 6;
+    const unsigned short PRIORITY_VSYNC = 6;
     readonly attribute unsigned long priority;
 };
 
 [builtinclass, uuid(3114c36c-a482-4c6e-9523-1dcfc6f605b9)]
 interface nsIRunnableIPCMessageType : nsISupports
 {
     readonly attribute unsigned long type;
 };