From 85e56139a4798f5ee181baa21620b6d7bff0ff90 Mon Sep 17 00:00:00 2001 From: Gabriele Svelto Date: Thu, 26 Feb 2015 12:43:22 +0100 Subject: [PATCH] Bug 1119277 - Remove the process CPU priority parameter and simplify all the associated code. r=khuey, r=dhylands --- .../mochitest/browserElementTestHelpers.js | 37 ++--- .../mochitest/priority/CAUTION | 15 -- .../mochitest/priority/mochitest.ini | 2 - .../priority/test_HighPriorityDowngrade.html | 81 ---------- .../priority/test_HighPriorityDowngrade2.html | 76 ---------- .../mochitest/priority/test_Preallocated.html | 2 +- dom/ipc/ProcessPriorityManager.cpp | 142 ++---------------- hal/Hal.cpp | 87 +---------- hal/Hal.h | 9 +- hal/HalTypes.h | 15 +- hal/fallback/FallbackProcessPriority.cpp | 4 +- hal/gonk/GonkHal.cpp | 5 +- hal/sandbox/SandboxHal.cpp | 1 - 13 files changed, 35 insertions(+), 441 deletions(-) delete mode 100644 dom/browser-element/mochitest/priority/CAUTION delete mode 100644 dom/browser-element/mochitest/priority/test_HighPriorityDowngrade.html delete mode 100644 dom/browser-element/mochitest/priority/test_HighPriorityDowngrade2.html diff --git a/dom/browser-element/mochitest/browserElementTestHelpers.js b/dom/browser-element/mochitest/browserElementTestHelpers.js index f6d9a867196..5f494777b2f 100644 --- a/dom/browser-element/mochitest/browserElementTestHelpers.js +++ b/dom/browser-element/mochitest/browserElementTestHelpers.js @@ -111,8 +111,7 @@ const browserElementTestHelpers = { // Returns a promise which is resolved when a subprocess is created. The // argument to resolve() is the childID of the subprocess. -function expectProcessCreated(/* optional */ initialPriority, - /* optional */ initialCPUPriority) { +function expectProcessCreated(/* optional */ initialPriority) { return new Promise(function(resolve, reject) { var observed = false; browserElementTestHelpers.addProcessPriorityObserver( @@ -128,7 +127,7 @@ function expectProcessCreated(/* optional */ initialPriority, var childID = parseInt(data); ok(true, 'Got new process, id=' + childID); if (initialPriority) { - expectPriorityChange(childID, initialPriority, initialCPUPriority).then(function() { + expectPriorityChange(childID, initialPriority).then(function() { resolve(childID); }); } else { @@ -141,9 +140,8 @@ function expectProcessCreated(/* optional */ initialPriority, // Just like expectProcessCreated(), except we'll call ok(false) if a second // process is created. -function expectOnlyOneProcessCreated(/* optional */ initialPriority, - /* optional */ initialCPUPriority) { - var p = expectProcessCreated(initialPriority, initialCPUPriority); +function expectOnlyOneProcessCreated(/* optional */ initialPriority) { + var p = expectProcessCreated(initialPriority); p.then(function() { expectProcessCreated().then(function(childID) { ok(false, 'Got unexpected process creation, childID=' + childID); @@ -153,15 +151,10 @@ function expectOnlyOneProcessCreated(/* optional */ initialPriority, } // Returns a promise which is resolved or rejected the next time the process -// childID changes its priority. We resolve if the (priority, CPU priority) -// tuple matches (expectedPriority, expectedCPUPriority) and we reject -// otherwise. -// -// expectedCPUPriority is an optional argument; if it's not specified, we -// resolve if priority matches expectedPriority. +// childID changes its priority. We resolve if the priority matches +// expectedPriority, and we reject otherwise. -function expectPriorityChange(childID, expectedPriority, - /* optional */ expectedCPUPriority) { +function expectPriorityChange(childID, expectedPriority) { return new Promise(function(resolve, reject) { var observed = false; browserElementTestHelpers.addProcessPriorityObserver( @@ -171,7 +164,7 @@ function expectPriorityChange(childID, expectedPriority, return; } - var [id, priority, cpuPriority] = data.split(":"); + var [id, priority] = data.split(":"); if (id != childID) { return; } @@ -184,14 +177,7 @@ function expectPriorityChange(childID, expectedPriority, 'Expected priority of childID ' + childID + ' to change to ' + expectedPriority); - if (expectedCPUPriority) { - is(cpuPriority, expectedCPUPriority, - 'Expected CPU priority of childID ' + childID + - ' to change to ' + expectedCPUPriority); - } - - if (priority == expectedPriority && - (!expectedCPUPriority || expectedCPUPriority == cpuPriority)) { + if (priority == expectedPriority) { resolve(); } else { reject(); @@ -212,13 +198,14 @@ function expectPriorityWithBackgroundLRUSet(childID, expectedBackgroundLRU) { 'process-priority-with-background-LRU-set', function(subject, topic, data) { - var [id, priority, cpuPriority, backgroundLRU] = data.split(":"); + var [id, priority, backgroundLRU] = data.split(":"); if (id != childID) { return; } is(backgroundLRU, expectedBackgroundLRU, - 'Expected backgroundLRU ' + backgroundLRU + ' of childID ' + childID + + 'Expected backgroundLRU ' + backgroundLRU + + ' of childID ' + childID + ' to change to ' + expectedBackgroundLRU); if (backgroundLRU == expectedBackgroundLRU) { diff --git a/dom/browser-element/mochitest/priority/CAUTION b/dom/browser-element/mochitest/priority/CAUTION deleted file mode 100644 index 5b878888eda..00000000000 --- a/dom/browser-element/mochitest/priority/CAUTION +++ /dev/null @@ -1,15 +0,0 @@ -A word to the wise: - -You must ensure that if your test finishes successfully, no processes have -priority FOREGROUND_HIGH. - -If you don't do this, expect to see tests randomly fail with mysterious -FOREGROUND --> FOREGROUND priority transitions. - -What's happening in this case is that your FOREGROUND_HIGH process lives until -the beginning of the next test. This causes the process started by the next -test to have low CPU priority. Then the FOREGROUND_HIGH process dies, because -its iframe gets GC'ed, and we transition the new test's process from low CPU -priority to regular CPU priority. - -Ouch. diff --git a/dom/browser-element/mochitest/priority/mochitest.ini b/dom/browser-element/mochitest/priority/mochitest.ini index a0804148e55..a1bf6a9b3af 100644 --- a/dom/browser-element/mochitest/priority/mochitest.ini +++ b/dom/browser-element/mochitest/priority/mochitest.ini @@ -10,8 +10,6 @@ skip-if = toolkit != "gtk2" || ((buildapp =='mulet' || buildapp == 'b2g') && (to [test_Visibility.html] [test_HighPriority.html] support-files = file_HighPriority.html -[test_HighPriorityDowngrade.html] -[test_HighPriorityDowngrade2.html] [test_Background.html] [test_BackgroundLRU.html] [test_Audio.html] diff --git a/dom/browser-element/mochitest/priority/test_HighPriorityDowngrade.html b/dom/browser-element/mochitest/priority/test_HighPriorityDowngrade.html deleted file mode 100644 index 3f2d71b0ffb..00000000000 --- a/dom/browser-element/mochitest/priority/test_HighPriorityDowngrade.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - diff --git a/dom/browser-element/mochitest/priority/test_HighPriorityDowngrade2.html b/dom/browser-element/mochitest/priority/test_HighPriorityDowngrade2.html deleted file mode 100644 index 49473341084..00000000000 --- a/dom/browser-element/mochitest/priority/test_HighPriorityDowngrade2.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - diff --git a/dom/browser-element/mochitest/priority/test_Preallocated.html b/dom/browser-element/mochitest/priority/test_Preallocated.html index f96eee878cd..b2cb0335ee6 100644 --- a/dom/browser-element/mochitest/priority/test_Preallocated.html +++ b/dom/browser-element/mochitest/priority/test_Preallocated.html @@ -53,7 +53,7 @@ function runTest() // Ensure that the preallocated process initially gets BACKGROUND priority. // That's it. - expectProcessCreated('PREALLOC', 'CPU_LOW').then(function() { + expectProcessCreated('PREALLOC').then(function() { // We need to set the pref asynchoronously or the preallocated process won't // be shut down. SimpleTest.executeSoon(function(){ diff --git a/dom/ipc/ProcessPriorityManager.cpp b/dom/ipc/ProcessPriorityManager.cpp index 139414f56e3..a337c38824e 100644 --- a/dom/ipc/ProcessPriorityManager.cpp +++ b/dom/ipc/ProcessPriorityManager.cpp @@ -138,13 +138,6 @@ public: void FireTestOnlyObserverNotification(const char* aTopic, const nsACString& aData = EmptyCString()); - /** - * Does some process, other than the one handled by aParticularManager, have - * priority FOREGROUND_HIGH? - */ - bool OtherProcessHasHighPriority( - ParticularProcessPriorityManager* aParticularManager); - /** * Does one of the child processes have priority FOREGROUND_HIGH? */ @@ -182,7 +175,6 @@ private: void ObserveContentParentCreated(nsISupports* aContentParent); void ObserveContentParentDestroyed(nsISupports* aSubject); - void ResetAllCPUPriorities(); nsDataHashtable > mParticularManagers; @@ -267,23 +259,11 @@ public: ProcessPriority CurrentPriority(); ProcessPriority ComputePriority(); - ProcessCPUPriority ComputeCPUPriority(ProcessPriority aPriority); void ScheduleResetPriority(const char* aTimeoutPref); void ResetPriority(); void ResetPriorityNow(); - void ResetCPUPriorityNow(); - - /** - * This overload is equivalent to SetPriorityNow(aPriority, - * ComputeCPUPriority()). - */ - void SetPriorityNow(ProcessPriority aPriority, - uint32_t aBackgroundLRU = 0); - - void SetPriorityNow(ProcessPriority aPriority, - ProcessCPUPriority aCPUPriority, - uint32_t aBackgroundLRU = 0); + void SetPriorityNow(ProcessPriority aPriority, uint32_t aBackgroundLRU = 0); void ShutDown(); @@ -299,7 +279,6 @@ private: ContentParent* mContentParent; uint64_t mChildID; ProcessPriority mPriority; - ProcessCPUPriority mCPUPriority; bool mHoldsCPUWakeLock; bool mHoldsHighPriorityWakeLock; @@ -439,8 +418,7 @@ ProcessPriorityManagerImpl::Init() // The master process's priority never changes; set it here and then forget // about it. We'll manage only subprocesses' priorities using the process // priority manager. - hal::SetProcessPriority(getpid(), PROCESS_PRIORITY_MASTER, - PROCESS_CPU_PRIORITY_NORMAL); + hal::SetProcessPriority(getpid(), PROCESS_PRIORITY_MASTER); nsCOMPtr os = services::GetObserverService(); if (os) { @@ -517,18 +495,6 @@ ProcessPriorityManagerImpl::ObserveContentParentCreated( GetParticularProcessPriorityManager(cp->AsContentParent()); } -static PLDHashOperator -EnumerateParticularProcessPriorityManagers( - const uint64_t& aKey, - nsRefPtr aValue, - void* aUserData) -{ - nsTArray >* aArray = - static_cast >*>(aUserData); - aArray->AppendElement(aValue); - return PL_DHASH_NEXT; -} - void ProcessPriorityManagerImpl::ObserveContentParentDestroyed(nsISupports* aSubject) { @@ -548,38 +514,10 @@ ProcessPriorityManagerImpl::ObserveContentParentDestroyed(nsISupports* aSubject) if (mHighPriorityChildIDs.Contains(childID)) { mHighPriorityChildIDs.RemoveEntry(childID); - - // We just lost a high-priority process; reset everyone's CPU priorities. - ResetAllCPUPriorities(); } } } -void -ProcessPriorityManagerImpl::ResetAllCPUPriorities( void ) -{ - nsTArray > pppms; - mParticularManagers.EnumerateRead( - &EnumerateParticularProcessPriorityManagers, - &pppms); - - for (uint32_t i = 0; i < pppms.Length(); i++) { - pppms[i]->ResetCPUPriorityNow(); - } -} - -bool -ProcessPriorityManagerImpl::OtherProcessHasHighPriority( - ParticularProcessPriorityManager* aParticularManager) -{ - if (mHighPriority) { - return true; - } else if (mHighPriorityChildIDs.Contains(aParticularManager->ChildID())) { - return mHighPriorityChildIDs.Count() > 1; - } - return mHighPriorityChildIDs.Count() > 0; -} - bool ProcessPriorityManagerImpl::ChildProcessHasHighPriority( void ) { @@ -591,8 +529,9 @@ ProcessPriorityManagerImpl::NotifyProcessPriorityChanged( ParticularProcessPriorityManager* aParticularManager, ProcessPriority aOldPriority) { - // This priority change can only affect other processes' priorities if we're - // changing to/from FOREGROUND_HIGH. + /* We're interested only in changes to/from FOREGROUND_HIGH as we use we + * need to track high priority processes so that we can react to their + * presence. */ if (aOldPriority < PROCESS_PRIORITY_FOREGROUND_HIGH && aParticularManager->CurrentPriority() < @@ -607,17 +546,6 @@ ProcessPriorityManagerImpl::NotifyProcessPriorityChanged( } else { mHighPriorityChildIDs.RemoveEntry(aParticularManager->ChildID()); } - - nsTArray > pppms; - mParticularManagers.EnumerateRead( - &EnumerateParticularProcessPriorityManagers, - &pppms); - - for (uint32_t i = 0; i < pppms.Length(); i++) { - if (pppms[i] != aParticularManager) { - pppms[i]->ResetCPUPriorityNow(); - } - } } /* virtual */ void @@ -633,10 +561,6 @@ ProcessPriorityManagerImpl::Notify(const WakeLockInformation& aInfo) mHighPriority = false; } - /* The main process got a high-priority wakelock change; reset everyone's - * CPU priorities. */ - ResetAllCPUPriorities(); - LOG("Got wake lock changed event. " "Now mHighPriorityParent = %d\n", mHighPriority); } @@ -653,7 +577,6 @@ ParticularProcessPriorityManager::ParticularProcessPriorityManager( : mContentParent(aContentParent) , mChildID(aContentParent->ChildID()) , mPriority(PROCESS_PRIORITY_UNKNOWN) - , mCPUPriority(PROCESS_CPU_PRIORITY_NORMAL) , mHoldsCPUWakeLock(false) , mHoldsHighPriorityWakeLock(false) { @@ -1015,40 +938,9 @@ ParticularProcessPriorityManager::ComputePriority() PROCESS_PRIORITY_BACKGROUND; } -ProcessCPUPriority -ParticularProcessPriorityManager::ComputeCPUPriority(ProcessPriority aPriority) -{ - if (aPriority == PROCESS_PRIORITY_PREALLOC) { - return PROCESS_CPU_PRIORITY_LOW; - } - - if (aPriority >= PROCESS_PRIORITY_FOREGROUND_HIGH) { - return PROCESS_CPU_PRIORITY_NORMAL; - } - - return ProcessPriorityManagerImpl::GetSingleton()-> - OtherProcessHasHighPriority(this) ? - PROCESS_CPU_PRIORITY_LOW : - PROCESS_CPU_PRIORITY_NORMAL; -} - -void -ParticularProcessPriorityManager::ResetCPUPriorityNow() -{ - SetPriorityNow(mPriority); -} - void ParticularProcessPriorityManager::SetPriorityNow(ProcessPriority aPriority, uint32_t aBackgroundLRU) -{ - SetPriorityNow(aPriority, ComputeCPUPriority(aPriority), aBackgroundLRU); -} - -void -ParticularProcessPriorityManager::SetPriorityNow(ProcessPriority aPriority, - ProcessCPUPriority aCPUPriority, - uint32_t aBackgroundLRU) { if (aPriority == PROCESS_PRIORITY_UNKNOWN) { MOZ_ASSERT(false); @@ -1058,11 +950,10 @@ ParticularProcessPriorityManager::SetPriorityNow(ProcessPriority aPriority, if (aBackgroundLRU > 0 && aPriority == PROCESS_PRIORITY_BACKGROUND && mPriority == PROCESS_PRIORITY_BACKGROUND) { - hal::SetProcessPriority(Pid(), mPriority, mCPUPriority, aBackgroundLRU); + hal::SetProcessPriority(Pid(), mPriority, aBackgroundLRU); nsPrintfCString ProcessPriorityWithBackgroundLRU("%s:%d", - ProcessPriorityToString(mPriority, mCPUPriority), - aBackgroundLRU); + ProcessPriorityToString(mPriority), aBackgroundLRU); FireTestOnlyObserverNotification("process-priority-with-background-LRU-set", ProcessPriorityWithBackgroundLRU.get()); @@ -1070,7 +961,7 @@ ParticularProcessPriorityManager::SetPriorityNow(ProcessPriority aPriority, if (!mContentParent || !ProcessPriorityManagerImpl::PrefsEnabled() || - (mPriority == aPriority && mCPUPriority == aCPUPriority)) { + (mPriority == aPriority)) { return; } @@ -1095,16 +986,18 @@ ParticularProcessPriorityManager::SetPriorityNow(ProcessPriority aPriority, } LOGP("Changing priority from %s to %s.", - ProcessPriorityToString(mPriority, mCPUPriority), - ProcessPriorityToString(aPriority, aCPUPriority)); + ProcessPriorityToString(mPriority), + ProcessPriorityToString(aPriority)); ProcessPriority oldPriority = mPriority; mPriority = aPriority; - mCPUPriority = aCPUPriority; - hal::SetProcessPriority(Pid(), mPriority, mCPUPriority); + hal::SetProcessPriority(Pid(), mPriority); if (oldPriority != mPriority) { + ProcessPriorityManagerImpl::GetSingleton()-> + NotifyProcessPriorityChanged(this, oldPriority); + unused << mContentParent->SendNotifyProcessPriorityChanged(mPriority); } @@ -1113,12 +1006,7 @@ ParticularProcessPriorityManager::SetPriorityNow(ProcessPriority aPriority, } FireTestOnlyObserverNotification("process-priority-set", - ProcessPriorityToString(mPriority, mCPUPriority)); - - if (oldPriority != mPriority) { - ProcessPriorityManagerImpl::GetSingleton()-> - NotifyProcessPriorityChanged(this, oldPriority); - } + ProcessPriorityToString(mPriority)); } void diff --git a/hal/Hal.cpp b/hal/Hal.cpp index d189888ae25..f798f02046b 100644 --- a/hal/Hal.cpp +++ b/hal/Hal.cpp @@ -863,14 +863,12 @@ SetAlarm(int32_t aSeconds, int32_t aNanoseconds) void SetProcessPriority(int aPid, ProcessPriority aPriority, - ProcessCPUPriority aCPUPriority, uint32_t aBackgroundLRU) { // n.b. The sandboxed implementation crashes; SetProcessPriority works only // from the main process. MOZ_ASSERT(aBackgroundLRU == 0 || aPriority == PROCESS_PRIORITY_BACKGROUND); - PROXY_IF_SANDBOXED(SetProcessPriority(aPid, aPriority, aCPUPriority, - aBackgroundLRU)); + PROXY_IF_SANDBOXED(SetProcessPriority(aPid, aPriority, aBackgroundLRU)); } void @@ -920,89 +918,6 @@ ThreadPriorityToString(ThreadPriority aPriority) } } -// From HalTypes.h. -const char* -ProcessPriorityToString(ProcessPriority aPriority, - ProcessCPUPriority aCPUPriority) -{ - // Sorry this is ugly. At least it's all in one place. - // - // We intentionally fall through if aCPUPriority is invalid; we won't hit any - // of the if statements further down, so it's OK. - - switch (aPriority) { - case PROCESS_PRIORITY_MASTER: - if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) { - return "MASTER:CPU_NORMAL"; - } - if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) { - return "MASTER:CPU_LOW"; - } - case PROCESS_PRIORITY_PREALLOC: - if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) { - return "PREALLOC:CPU_NORMAL"; - } - if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) { - return "PREALLOC:CPU_LOW"; - } - case PROCESS_PRIORITY_FOREGROUND_HIGH: - if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) { - return "FOREGROUND_HIGH:CPU_NORMAL"; - } - if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) { - return "FOREGROUND_HIGH:CPU_LOW"; - } - case PROCESS_PRIORITY_FOREGROUND: - if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) { - return "FOREGROUND:CPU_NORMAL"; - } - if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) { - return "FOREGROUND:CPU_LOW"; - } - case PROCESS_PRIORITY_FOREGROUND_KEYBOARD: - if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) { - return "FOREGROUND_KEYBOARD:CPU_NORMAL"; - } - if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) { - return "FOREGROUND_KEYBOARD:CPU_LOW"; - } - case PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE: - if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) { - return "BACKGROUND_PERCEIVABLE:CPU_NORMAL"; - } - if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) { - return "BACKGROUND_PERCEIVABLE:CPU_LOW"; - } - case PROCESS_PRIORITY_BACKGROUND_HOMESCREEN: - if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) { - return "BACKGROUND_HOMESCREEN:CPU_NORMAL"; - } - if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) { - return "BACKGROUND_HOMESCREEN:CPU_LOW"; - } - case PROCESS_PRIORITY_BACKGROUND: - if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) { - return "BACKGROUND:CPU_NORMAL"; - } - if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) { - return "BACKGROUND:CPU_LOW"; - } - case PROCESS_PRIORITY_UNKNOWN: - if (aCPUPriority == PROCESS_CPU_PRIORITY_NORMAL) { - return "UNKNOWN:CPU_NORMAL"; - } - if (aCPUPriority == PROCESS_CPU_PRIORITY_LOW) { - return "UNKNOWN:CPU_LOW"; - } - default: - // Fall through. (|default| is here to silence warnings.) - break; - } - - MOZ_ASSERT(false); - return "???"; -} - static StaticAutoPtr > sFMRadioObservers; static StaticAutoPtr > sFMRadioRDSObservers; diff --git a/hal/Hal.h b/hal/Hal.h index 4d4d8745fc0..ba256c3fe98 100644 --- a/hal/Hal.h +++ b/hal/Hal.h @@ -468,13 +468,7 @@ void NotifyAlarmFired(); bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds); /** - * Set the priority of the given process. A process's priority is a two-tuple - * consisting of a hal::ProcessPriority value and a hal::ProcessCPUPriority - * value. - * - * Two processes with the same ProcessCPUPriority value don't necessarily have - * the same CPU priority; the CPU priority we assign to a process is a function - * of its ProcessPriority and ProcessCPUPriority. + * 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 @@ -482,7 +476,6 @@ bool SetAlarm(int32_t aSeconds, int32_t aNanoseconds); */ void SetProcessPriority(int aPid, hal::ProcessPriority aPriority, - hal::ProcessCPUPriority aCPUPriority, uint32_t aLRU = 0); diff --git a/hal/HalTypes.h b/hal/HalTypes.h index 394b0d750d1..63e99a34eed 100644 --- a/hal/HalTypes.h +++ b/hal/HalTypes.h @@ -73,12 +73,6 @@ enum ProcessPriority { NUM_PROCESS_PRIORITY }; -enum ProcessCPUPriority { - PROCESS_CPU_PRIORITY_LOW, - PROCESS_CPU_PRIORITY_NORMAL, - NUM_PROCESS_CPU_PRIORITY -}; - /** * Values that can be passed to hal::SetCurrentThreadPriority(). These should be * functional in nature, such as COMPOSITOR, instead of levels, like LOW/HIGH. @@ -92,9 +86,8 @@ enum ThreadPriority { }; /** - * Convert a ProcessPriority enum value (with an optional ProcessCPUPriority) - * to a string. The strings returned by this function are statically - * allocated; do not attempt to free one! + * 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 "???". @@ -102,10 +95,6 @@ enum ThreadPriority { const char* ProcessPriorityToString(ProcessPriority aPriority); -const char* -ProcessPriorityToString(ProcessPriority aPriority, - ProcessCPUPriority aCPUPriority); - /** * Convert a ThreadPriority enum value to a string. The strings returned by * this function are statically allocated; do not attempt to free one! diff --git a/hal/fallback/FallbackProcessPriority.cpp b/hal/fallback/FallbackProcessPriority.cpp index db8eecc071e..34ce57ed43c 100644 --- a/hal/fallback/FallbackProcessPriority.cpp +++ b/hal/fallback/FallbackProcessPriority.cpp @@ -13,12 +13,10 @@ namespace hal_impl { void SetProcessPriority(int aPid, ProcessPriority aPriority, - ProcessCPUPriority aCPUPriority, uint32_t aBackgroundLRU) { HAL_LOG("FallbackProcessPriority - SetProcessPriority(%d, %s, %u)\n", - aPid, ProcessPriorityToString(aPriority, aCPUPriority), - aBackgroundLRU); + aPid, ProcessPriorityToString(aPriority), aBackgroundLRU); } } // hal_impl diff --git a/hal/gonk/GonkHal.cpp b/hal/gonk/GonkHal.cpp index bda465ef85e..334ef8a8ad5 100644 --- a/hal/gonk/GonkHal.cpp +++ b/hal/gonk/GonkHal.cpp @@ -1738,11 +1738,10 @@ EnsureKernelLowMemKillerParamsSet() void SetProcessPriority(int aPid, ProcessPriority aPriority, - ProcessCPUPriority aCPUPriority, uint32_t aBackgroundLRU) { - HAL_LOG("SetProcessPriority(pid=%d, priority=%d, cpuPriority=%d, LRU=%u)", - aPid, aPriority, aCPUPriority, aBackgroundLRU); + HAL_LOG("SetProcessPriority(pid=%d, priority=%d, LRU=%u)", + aPid, aPriority, aBackgroundLRU); // If this is the first time SetProcessPriority was called, set the kernel's // OOM parameters according to our prefs. diff --git a/hal/sandbox/SandboxHal.cpp b/hal/sandbox/SandboxHal.cpp index efa9dacf44f..5cb6fc99f56 100644 --- a/hal/sandbox/SandboxHal.cpp +++ b/hal/sandbox/SandboxHal.cpp @@ -357,7 +357,6 @@ SetAlarm(int32_t aSeconds, int32_t aNanoseconds) void SetProcessPriority(int aPid, ProcessPriority aPriority, - ProcessCPUPriority aCPUPriority, uint32_t aBackgroundLRU) { NS_RUNTIMEABORT("Only the main process may set processes' priorities.");