Skip to content

Commit

Permalink
Bug 842679 - Part 2: Add PROCESS_PRIORITY_UNKNOWN to hal. r=cjones
Browse files Browse the repository at this point in the history
  • Loading branch information
jlebar committed Feb 23, 2013
1 parent 4db7b8a commit 619ff92
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions hal/Hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,8 @@ ProcessPriorityToString(ProcessPriority aPriority)
return "BACKGROUND_HOMESCREEN";
case PROCESS_PRIORITY_BACKGROUND:
return "BACKGROUND";
case PROCESS_PRIORITY_UNKNOWN:
return "UNKNOWN";
default:
MOZ_ASSERT(false);
return "???";
Expand Down
5 changes: 4 additions & 1 deletion hal/HalTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ enum SwitchState {

typedef Observer<SwitchEvent> SwitchObserver;

// Note that we rely on the order of this enum's entries. Higher priorities
// should have larger int values.
enum ProcessPriority {
PROCESS_PRIORITY_UNKNOWN = -1,
PROCESS_PRIORITY_BACKGROUND,
PROCESS_PRIORITY_BACKGROUND_HOMESCREEN,
PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE,
Expand Down Expand Up @@ -261,7 +264,7 @@ struct ParamTraits<mozilla::hal::SwitchDevice>:
template <>
struct ParamTraits<mozilla::hal::ProcessPriority>:
public EnumSerializer<mozilla::hal::ProcessPriority,
mozilla::hal::PROCESS_PRIORITY_BACKGROUND,
mozilla::hal::PROCESS_PRIORITY_UNKNOWN,
mozilla::hal::NUM_PROCESS_PRIORITY> {
};

Expand Down
5 changes: 4 additions & 1 deletion hal/gonk/GonkHal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,10 @@ SetProcessPriority(int aPid, ProcessPriority aPriority)
priorityStr = "master";
break;
default:
MOZ_NOT_REACHED();
// PROCESS_PRIORITY_UNKNOWN ends up in this branch, along with invalid enum
// values.
NS_ERROR("Invalid process priority!");
return;
}

// Notice that you can disable oom_adj and renice by deleting the prefs
Expand Down

0 comments on commit 619ff92

Please sign in to comment.