|
@@ -2,7 +2,7 @@
|
|
|
# User Ryan Hunt <rhunt@eqrion.net>
|
|
|
# Date 1524167282 18000
|
|
|
# Node ID 43fb3472db5f3c1e811697993316cfd4e434cfdb
|
|
|
-# Parent bb94ed972a9fd86ba96e75dd0ad86a1c9090df01
|
|
|
+# Parent 2511fcd35299373476185e2db2ebfd704bc60b0b
|
|
|
Bug 1455408 - Remove thread priority suppport from HAL as it isn't used any longer. r=gsvelto
|
|
|
|
|
|
MozReview-Commit-ID: KJ2byDuYWr9
|
|
@@ -10,48 +10,42 @@ MozReview-Commit-ID: KJ2byDuYWr9
|
|
|
diff --git a/hal/Hal.cpp b/hal/Hal.cpp
|
|
|
--- a/hal/Hal.cpp
|
|
|
+++ b/hal/Hal.cpp
|
|
|
-@@ -591,29 +591,16 @@ SetProcessPrioritySupported()
|
|
|
- void
|
|
|
- SetProcessPriority(int aPid, ProcessPriority aPriority)
|
|
|
- {
|
|
|
+@@ -511,25 +511,16 @@ bool 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)
|
|
|
--{
|
|
|
+-void SetCurrentThreadPriority(hal::ThreadPriority aThreadPriority) {
|
|
|
- PROXY_IF_SANDBOXED(SetCurrentThreadPriority(aThreadPriority));
|
|
|
-}
|
|
|
-
|
|
|
--void
|
|
|
--SetThreadPriority(PlatformThreadId aThreadId,
|
|
|
-- hal::ThreadPriority aThreadPriority)
|
|
|
--{
|
|
|
+-void SetThreadPriority(PlatformThreadId aThreadId,
|
|
|
+- hal::ThreadPriority aThreadPriority) {
|
|
|
- PROXY_IF_SANDBOXED(SetThreadPriority(aThreadId, aThreadPriority));
|
|
|
-}
|
|
|
-
|
|
|
// From HalTypes.h.
|
|
|
- const char*
|
|
|
- ProcessPriorityToString(ProcessPriority aPriority)
|
|
|
- {
|
|
|
+ const char* ProcessPriorityToString(ProcessPriority aPriority) {
|
|
|
switch (aPriority) {
|
|
|
- case PROCESS_PRIORITY_MASTER:
|
|
|
- return "MASTER";
|
|
|
- case PROCESS_PRIORITY_PREALLOC:
|
|
|
-@@ -631,22 +618,10 @@ ProcessPriorityToString(ProcessPriority
|
|
|
- case PROCESS_PRIORITY_UNKNOWN:
|
|
|
- return "UNKNOWN";
|
|
|
- default:
|
|
|
- MOZ_ASSERT(false);
|
|
|
- return "???";
|
|
|
+ case PROCESS_PRIORITY_MASTER:
|
|
|
+ return "MASTER";
|
|
|
+ case PROCESS_PRIORITY_PREALLOC:
|
|
|
+ return "PREALLOC";
|
|
|
+ case PROCESS_PRIORITY_FOREGROUND_HIGH:
|
|
|
+@@ -545,26 +536,16 @@ const char* ProcessPriorityToString(Proc
|
|
|
+ case PROCESS_PRIORITY_UNKNOWN:
|
|
|
+ return "UNKNOWN";
|
|
|
+ default:
|
|
|
+ MOZ_ASSERT(false);
|
|
|
+ return "???";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
--const char *
|
|
|
--ThreadPriorityToString(ThreadPriority aPriority)
|
|
|
--{
|
|
|
+-const char* ThreadPriorityToString(ThreadPriority aPriority) {
|
|
|
- switch (aPriority) {
|
|
|
- case THREAD_PRIORITY_COMPOSITOR:
|
|
|
- return "COMPOSITOR";
|
|
@@ -61,13 +55,18 @@ diff --git a/hal/Hal.cpp b/hal/Hal.cpp
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
- } // namespace hal
|
|
|
- } // namespace mozilla
|
|
|
+ void StartDiskSpaceWatcher() {
|
|
|
+ AssertMainProcess();
|
|
|
+ AssertMainThread();
|
|
|
+ PROXY_IF_SANDBOXED(StartDiskSpaceWatcher());
|
|
|
+ }
|
|
|
+
|
|
|
+ void StopDiskSpaceWatcher() {
|
|
|
+ AssertMainProcess();
|
|
|
diff --git a/hal/Hal.h b/hal/Hal.h
|
|
|
--- a/hal/Hal.h
|
|
|
+++ b/hal/Hal.h
|
|
|
-@@ -271,32 +271,16 @@ bool SetProcessPrioritySupported();
|
|
|
- * Set the priority of the given process.
|
|
|
+@@ -274,31 +274,16 @@ bool SetProcessPrioritySupported();
|
|
|
*
|
|
|
* Exactly what this does will vary between platforms. On *nix we might give
|
|
|
* background processes higher nice values. On other platforms, we might
|
|
@@ -75,8 +74,7 @@ diff --git a/hal/Hal.h b/hal/Hal.h
|
|
|
*/
|
|
|
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.
|
|
@@ -91,18 +89,19 @@ diff --git a/hal/Hal.h b/hal/Hal.h
|
|
|
-void SetThreadPriority(PlatformThreadId aThreadId,
|
|
|
- hal::ThreadPriority aThreadPriority);
|
|
|
-
|
|
|
- } // namespace MOZ_HAL_NAMESPACE
|
|
|
- } // namespace mozilla
|
|
|
-
|
|
|
- #ifdef MOZ_DEFINED_HAL_NAMESPACE
|
|
|
- # undef MOZ_DEFINED_HAL_NAMESPACE
|
|
|
- # undef MOZ_HAL_NAMESPACE
|
|
|
- #endif
|
|
|
+-/**
|
|
|
+ * Start monitoring disk space for low space situations.
|
|
|
+ *
|
|
|
+ * This API is currently only allowed to be used from the main process.
|
|
|
+ */
|
|
|
+ void StartDiskSpaceWatcher();
|
|
|
|
|
|
+ /**
|
|
|
+ * Stop monitoring disk space for low space situations.
|
|
|
diff --git a/hal/HalTypes.h b/hal/HalTypes.h
|
|
|
--- a/hal/HalTypes.h
|
|
|
+++ b/hal/HalTypes.h
|
|
|
-@@ -35,48 +35,26 @@ enum ProcessPriority {
|
|
|
+@@ -35,43 +35,25 @@ enum ProcessPriority {
|
|
|
// CurrentProcessIsForeground().
|
|
|
PROCESS_PRIORITY_FOREGROUND,
|
|
|
PROCESS_PRIORITY_FOREGROUND_HIGH,
|
|
@@ -111,16 +110,13 @@ diff --git a/hal/HalTypes.h b/hal/HalTypes.h
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
-- * 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 gonk
|
|
|
-- * or android we may want different priority schemes than on windows, etc.
|
|
|
+- * 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
|
|
|
--};
|
|
|
+-enum ThreadPriority { THREAD_PRIORITY_COMPOSITOR, NUM_THREAD_PRIORITY };
|
|
|
-
|
|
|
-/**
|
|
|
* Convert a ProcessPriority enum value to a string. The strings returned by
|
|
@@ -129,8 +125,7 @@ diff --git a/hal/HalTypes.h b/hal/HalTypes.h
|
|
|
* If you pass an unknown process priority, we fatally assert in debug
|
|
|
* builds and otherwise return "???".
|
|
|
*/
|
|
|
- const char*
|
|
|
- ProcessPriorityToString(ProcessPriority aPriority);
|
|
|
+ const char* ProcessPriorityToString(ProcessPriority aPriority);
|
|
|
|
|
|
/**
|
|
|
- * Convert a ThreadPriority enum value to a string. The strings returned by
|
|
@@ -139,23 +134,22 @@ diff --git a/hal/HalTypes.h b/hal/HalTypes.h
|
|
|
- * If you pass an unknown process priority, we assert in debug builds
|
|
|
- * and otherwise return "???".
|
|
|
- */
|
|
|
--const char *
|
|
|
--ThreadPriorityToString(ThreadPriority aPriority);
|
|
|
+-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,
|
|
|
+ WAKE_LOCK_NO_CHANGE = 0,
|
|
|
+ WAKE_LOCK_ADD_ONE = 1,
|
|
|
NUM_WAKE_LOCK
|
|
|
};
|
|
|
diff --git a/hal/fallback/FallbackThreadPriority.cpp b/hal/fallback/FallbackThreadPriority.cpp
|
|
|
deleted file mode 100644
|
|
|
--- a/hal/fallback/FallbackThreadPriority.cpp
|
|
|
+++ /dev/null
|
|
|
-@@ -1,29 +0,0 @@
|
|
|
+@@ -1,24 +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/. */
|
|
@@ -168,34 +162,29 @@ deleted file mode 100644
|
|
|
-namespace mozilla {
|
|
|
-namespace hal_impl {
|
|
|
-
|
|
|
--void
|
|
|
--SetCurrentThreadPriority(ThreadPriority aPriority)
|
|
|
--{
|
|
|
+-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));
|
|
|
+-void SetThreadPriority(PlatformThreadId aThreadId, ThreadPriority aPriority) {
|
|
|
+- HAL_LOG("FallbackThreadPriority - SetThreadPriority(%d, %s)\n", aThreadId,
|
|
|
+- ThreadPriorityToString(aPriority));
|
|
|
-}
|
|
|
-
|
|
|
--} // namespace hal_impl
|
|
|
--} // namespace mozilla
|
|
|
+-} // namespace hal_impl
|
|
|
+-} // namespace mozilla
|
|
|
diff --git a/hal/moz.build b/hal/moz.build
|
|
|
--- a/hal/moz.build
|
|
|
+++ b/hal/moz.build
|
|
|
-@@ -93,17 +93,16 @@ else:
|
|
|
- 'fallback/FallbackScreenConfiguration.cpp',
|
|
|
+@@ -94,17 +94,16 @@ else:
|
|
|
'fallback/FallbackSensor.cpp',
|
|
|
'fallback/FallbackVibration.cpp',
|
|
|
]
|
|
|
|
|
|
- # Fallbacks for backends implemented on Gonk only.
|
|
|
+ # Fallbacks for backends no longer implemented.
|
|
|
UNIFIED_SOURCES += [
|
|
|
+ 'fallback/FallbackDiskSpaceWatcher.cpp',
|
|
|
'fallback/FallbackProcessPriority.cpp',
|
|
|
- 'fallback/FallbackThreadPriority.cpp',
|
|
|
]
|
|
@@ -209,33 +198,32 @@ diff --git a/hal/moz.build b/hal/moz.build
|
|
|
diff --git a/hal/sandbox/SandboxHal.cpp b/hal/sandbox/SandboxHal.cpp
|
|
|
--- a/hal/sandbox/SandboxHal.cpp
|
|
|
+++ b/hal/sandbox/SandboxHal.cpp
|
|
|
-@@ -202,29 +202,16 @@ SetProcessPriority(int aPid, ProcessPrio
|
|
|
+@@ -137,28 +137,16 @@ bool SetAlarm(int32_t aSeconds, int32_t
|
|
|
+ void SetProcessPriority(int aPid, ProcessPriority aPriority) {
|
|
|
+ MOZ_CRASH("Only the main process may set processes' priorities.");
|
|
|
+ }
|
|
|
|
|
|
- bool
|
|
|
- SetProcessPrioritySupported()
|
|
|
- {
|
|
|
- NS_RUNTIMEABORT("Only the main process may call SetProcessPrioritySupported().");
|
|
|
- return false;
|
|
|
+ bool SetProcessPrioritySupported() {
|
|
|
+ MOZ_CRASH("Only the main process may call SetProcessPrioritySupported().");
|
|
|
}
|
|
|
|
|
|
--void
|
|
|
--SetCurrentThreadPriority(ThreadPriority aThreadPriority)
|
|
|
--{
|
|
|
-- NS_RUNTIMEABORT("Setting current thread priority cannot be called from sandboxed contexts.");
|
|
|
+-void SetCurrentThreadPriority(ThreadPriority aThreadPriority) {
|
|
|
+- MOZ_CRASH(
|
|
|
+- "Setting current thread priority cannot be called from sandboxed "
|
|
|
+- "contexts.");
|
|
|
-}
|
|
|
-
|
|
|
--void
|
|
|
--SetThreadPriority(PlatformThreadId aThreadId,
|
|
|
-- ThreadPriority aThreadPriority)
|
|
|
--{
|
|
|
-- NS_RUNTIMEABORT("Setting 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.");
|
|
|
-}
|
|
|
-
|
|
|
- class HalParent : public PHalParent
|
|
|
- , public BatteryObserver
|
|
|
- , public NetworkObserver
|
|
|
- , public ISensorObserver
|
|
|
- , public WakeLockObserver
|
|
|
- , public ScreenConfigurationObserver
|
|
|
- {
|
|
|
- public:
|
|
|
+ void StartDiskSpaceWatcher() {
|
|
|
+ MOZ_CRASH("StartDiskSpaceWatcher() can't be called from sandboxed contexts.");
|
|
|
+ }
|
|
|
+
|
|
|
+ void StopDiskSpaceWatcher() {
|
|
|
+ MOZ_CRASH("StopDiskSpaceWatcher() can't be called from sandboxed contexts.");
|
|
|
+ }
|
|
|
+
|