зеркало из https://github.com/mozilla/gecko-dev.git
Bug 838625 - Add hal::ProcessPriorityToString and use it in ProcessPriorityManager logging. r=cjones, a=bajaj
This commit is contained in:
Родитель
5c255da1a3
Коммит
625e4e3621
|
@ -394,8 +394,8 @@ ProcessPriorityManager::SetIsForeground()
|
|||
runnable->Cancel();
|
||||
}
|
||||
|
||||
LOG("Setting priority to FOREGROUND.");
|
||||
mProcessPriority = PROCESS_PRIORITY_FOREGROUND;
|
||||
LOG("Setting priority to %s.", ProcessPriorityToString(mProcessPriority));
|
||||
hal::SetProcessPriority(getpid(), PROCESS_PRIORITY_FOREGROUND);
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ ProcessPriorityManager::SetIsBackgroundNow()
|
|||
}
|
||||
|
||||
mProcessPriority = backgroundPriority;
|
||||
LOG("Setting priority to BACKGROUND (type %d)", mProcessPriority);
|
||||
LOG("Setting priority to %s", ProcessPriorityToString(mProcessPriority));
|
||||
hal::SetProcessPriority(getpid(), mProcessPriority);
|
||||
|
||||
// We're in the background; dump as much memory as we can.
|
||||
|
|
21
hal/Hal.cpp
21
hal/Hal.cpp
|
@ -838,6 +838,27 @@ SetProcessPriority(int aPid, ProcessPriority aPriority)
|
|||
PROXY_IF_SANDBOXED(SetProcessPriority(aPid, aPriority));
|
||||
}
|
||||
|
||||
// From HalTypes.h.
|
||||
const char*
|
||||
ProcessPriorityToString(ProcessPriority aPriority)
|
||||
{
|
||||
switch (aPriority) {
|
||||
case PROCESS_PRIORITY_MASTER:
|
||||
return "MASTER";
|
||||
case PROCESS_PRIORITY_FOREGROUND:
|
||||
return "FOREGROUND";
|
||||
case PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE:
|
||||
return "BACKGROUND_PERCEIVABLE";
|
||||
case PROCESS_PRIORITY_BACKGROUND_HOMESCREEN:
|
||||
return "BACKGROUND_HOMESCREEN";
|
||||
case PROCESS_PRIORITY_BACKGROUND:
|
||||
return "BACKGROUND";
|
||||
default:
|
||||
MOZ_ASSERT(false);
|
||||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
static StaticAutoPtr<ObserverList<FMRadioOperationInformation> > sFMRadioObservers;
|
||||
|
||||
static void
|
||||
|
|
|
@ -79,6 +79,14 @@ enum ProcessPriority {
|
|||
NUM_PROCESS_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 (or NUM_PROCESS_PRIORITY), we
|
||||
// fatally assert in debug builds and otherwise return "???".
|
||||
const char*
|
||||
ProcessPriorityToString(ProcessPriority aPriority);
|
||||
|
||||
/**
|
||||
* Used by ModifyWakeLock
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче