Bug 1455408 - Remove thread priority suppport from HAL as it isn't used any longer. r=gsvelto
authorRyan Hunt <rhunt@eqrion.net>
Thu, 19 Apr 2018 14:48:02 -0500
changeset 469207 43fb3472db5f3c1e811697993316cfd4e434cfdb
parent 469206 c1e5abfc4b6a52d25aed3381b4beb64f8ea66c67
child 469208 49295192e8a854f21854f70d658f04cb51e8aa36
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgsvelto
bugs1455408
milestone61.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 1455408 - Remove thread priority suppport from HAL as it isn't used any longer. r=gsvelto MozReview-Commit-ID: KJ2byDuYWr9
hal/Hal.cpp
hal/Hal.h
hal/HalTypes.h
hal/fallback/FallbackThreadPriority.cpp
hal/moz.build
hal/sandbox/SandboxHal.cpp
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -660,29 +660,16 @@ SetProcessPrioritySupported()
 void
 SetProcessPriority(int aPid, ProcessPriority aPriority)
 {
   // n.b. The sandboxed implementation crashes; SetProcessPriority works only
   // from the main process.
   PROXY_IF_SANDBOXED(SetProcessPriority(aPid, aPriority));
 }
 
-void
-SetCurrentThreadPriority(hal::ThreadPriority aThreadPriority)
-{
-  PROXY_IF_SANDBOXED(SetCurrentThreadPriority(aThreadPriority));
-}
-
-void
-SetThreadPriority(PlatformThreadId aThreadId,
-                  hal::ThreadPriority aThreadPriority)
-{
-  PROXY_IF_SANDBOXED(SetThreadPriority(aThreadId, aThreadPriority));
-}
-
 // From HalTypes.h.
 const char*
 ProcessPriorityToString(ProcessPriority aPriority)
 {
   switch (aPriority) {
   case PROCESS_PRIORITY_MASTER:
     return "MASTER";
   case PROCESS_PRIORITY_PREALLOC:
@@ -700,28 +687,16 @@ ProcessPriorityToString(ProcessPriority 
   case PROCESS_PRIORITY_UNKNOWN:
     return "UNKNOWN";
   default:
     MOZ_ASSERT(false);
     return "???";
   }
 }
 
-const char *
-ThreadPriorityToString(ThreadPriority aPriority)
-{
-  switch (aPriority) {
-    case THREAD_PRIORITY_COMPOSITOR:
-      return "COMPOSITOR";
-    default:
-      MOZ_ASSERT(false);
-      return "???";
-  }
-}
-
 void
 StartDiskSpaceWatcher()
 {
   AssertMainProcess();
   AssertMainThread();
   PROXY_IF_SANDBOXED(StartDiskSpaceWatcher());
 }
 
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -291,32 +291,16 @@ bool SetProcessPrioritySupported();
  * Set the priority of the given process.
  *
  * Exactly what this does will vary between platforms.  On *nix we might give
  * background processes higher nice values.  On other platforms, we might
  * ignore this call entirely.
  */
 void SetProcessPriority(int aPid, hal::ProcessPriority aPriority);
 
-
-/**
- * Set the current thread's priority to appropriate platform-specific value for
- * given functionality. Instead of providing arbitrary priority numbers you
- * must specify a type of function like THREAD_PRIORITY_COMPOSITOR.
- */
-void SetCurrentThreadPriority(hal::ThreadPriority aThreadPriority);
-
-/**
- * Set a thread priority to appropriate platform-specific value for
- * given functionality. Instead of providing arbitrary priority numbers you
- * must specify a type of function like THREAD_PRIORITY_COMPOSITOR.
- */
-void SetThreadPriority(PlatformThreadId aThreadId,
-                       hal::ThreadPriority aThreadPriority);
-
 /**
  * Start monitoring disk space for low space situations.
  *
  * This API is currently only allowed to be used from the main process.
  */
 void StartDiskSpaceWatcher();
 
 /**
--- a/hal/HalTypes.h
+++ b/hal/HalTypes.h
@@ -55,48 +55,26 @@ enum ProcessPriority {
   // CurrentProcessIsForeground().
   PROCESS_PRIORITY_FOREGROUND,
   PROCESS_PRIORITY_FOREGROUND_HIGH,
   PROCESS_PRIORITY_MASTER,
   NUM_PROCESS_PRIORITY
 };
 
 /**
- * Values that can be passed to hal::SetCurrentThreadPriority().  These should be
- * functional in nature, such as COMPOSITOR, instead of levels, like LOW/HIGH.
- * This allows us to tune our priority scheme for the system in one place such
- * that it makes sense holistically for the overall operating system.  On
- * android we may want different priority schemes than on windows, etc.
- */
-enum ThreadPriority {
-  THREAD_PRIORITY_COMPOSITOR,
-  NUM_THREAD_PRIORITY
-};
-
-/**
  * Convert a ProcessPriority enum value to a string.  The strings returned by
  * this function are statically allocated; do not attempt to free one!
  *
  * If you pass an unknown process priority, we fatally assert in debug
  * builds and otherwise return "???".
  */
 const char*
 ProcessPriorityToString(ProcessPriority aPriority);
 
 /**
- * Convert a ThreadPriority enum value to a string.  The strings returned by
- * this function are statically allocated; do not attempt to free one!
- *
- * If you pass an unknown process priority, we assert in debug builds
- * and otherwise return "???".
- */
-const char *
-ThreadPriorityToString(ThreadPriority aPriority);
-
-/**
  * Used by ModifyWakeLock
  */
 enum WakeLockControl {
   WAKE_LOCK_REMOVE_ONE = -1,
   WAKE_LOCK_NO_CHANGE  = 0,
   WAKE_LOCK_ADD_ONE    = 1,
   NUM_WAKE_LOCK
 };
deleted file mode 100644
--- a/hal/fallback/FallbackThreadPriority.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "Hal.h"
-#include "HalLog.h"
-
-using namespace mozilla::hal;
-
-namespace mozilla {
-namespace hal_impl {
-
-void
-SetCurrentThreadPriority(ThreadPriority aPriority)
-{
-  HAL_LOG("FallbackThreadPriority - SetCurrentThreadPriority(%s)\n",
-          ThreadPriorityToString(aPriority));
-}
-
-void
-SetThreadPriority(PlatformThreadId aThreadId,
-                  ThreadPriority aPriority)
-{
-  HAL_LOG("FallbackThreadPriority - SetThreadPriority(%d, %s)\n",
-          aThreadId, ThreadPriorityToString(aPriority));
-}
-
-} // namespace hal_impl
-} // namespace mozilla
--- a/hal/moz.build
+++ b/hal/moz.build
@@ -95,17 +95,16 @@ else:
         'fallback/FallbackVibration.cpp',
     ]
 
 # Fallbacks for backends no longer implemented.
 UNIFIED_SOURCES += [
     'fallback/FallbackDiskSpaceWatcher.cpp',
     'fallback/FallbackProcessPriority.cpp',
     'fallback/FallbackSwitch.cpp',
-    'fallback/FallbackThreadPriority.cpp',
 ]
 
 # Fallbacks for backends implemented on Android only.
 if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
     UNIFIED_SOURCES += [
         'fallback/FallbackNetwork.cpp',
     ]
 
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -212,29 +212,16 @@ SetProcessPriority(int aPid, ProcessPrio
 
 bool
 SetProcessPrioritySupported()
 {
   MOZ_CRASH("Only the main process may call SetProcessPrioritySupported().");
 }
 
 void
-SetCurrentThreadPriority(ThreadPriority aThreadPriority)
-{
-  MOZ_CRASH("Setting current thread priority cannot be called from sandboxed contexts.");
-}
-
-void
-SetThreadPriority(PlatformThreadId aThreadId,
-                  ThreadPriority aThreadPriority)
-{
-  MOZ_CRASH("Setting thread priority cannot be called from sandboxed contexts.");
-}
-
-void
 StartDiskSpaceWatcher()
 {
   MOZ_CRASH("StartDiskSpaceWatcher() can't be called from sandboxed contexts.");
 }
 
 void
 StopDiskSpaceWatcher()
 {