Bug 1799694 - Rename action/menu button class names in unified extensions. r=Itiel...
[gecko.git] / hal / HalTypes.h
blobe89392f355268dd63cf6eca0a7ac0012c5eac979
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_hal_Types_h
7 #define mozilla_hal_Types_h
9 #include "ipc/EnumSerializer.h"
10 #include "mozilla/Observer.h"
12 namespace mozilla {
13 namespace hal {
15 /**
16 * These constants specify special values for content process IDs. You can get
17 * a content process ID by calling ContentChild::GetID() or
18 * ContentParent::GetChildID().
20 const uint64_t CONTENT_PROCESS_ID_UNKNOWN = uint64_t(-1);
21 const uint64_t CONTENT_PROCESS_ID_MAIN = 0;
23 // Note that we rely on the order of this enum's entries. Higher priorities
24 // should have larger int values.
25 enum ProcessPriority {
26 PROCESS_PRIORITY_UNKNOWN = -1,
27 PROCESS_PRIORITY_BACKGROUND,
28 PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE,
29 PROCESS_PRIORITY_FOREGROUND_KEYBOARD,
30 // The special class for the preallocated process, high memory priority but
31 // low CPU priority.
32 PROCESS_PRIORITY_PREALLOC,
33 // Any priority greater than or equal to FOREGROUND is considered
34 // "foreground" for the purposes of priority testing, for example
35 // CurrentProcessIsForeground().
36 PROCESS_PRIORITY_FOREGROUND,
37 PROCESS_PRIORITY_FOREGROUND_HIGH,
38 PROCESS_PRIORITY_PARENT_PROCESS,
39 NUM_PROCESS_PRIORITY
42 /**
43 * Convert a ProcessPriority enum value to a string. The strings returned by
44 * this function are statically allocated; do not attempt to free one!
46 * If you pass an unknown process priority, we fatally assert in debug
47 * builds and otherwise return "???".
49 const char* ProcessPriorityToString(ProcessPriority aPriority);
51 /**
52 * Used by ModifyWakeLock
54 enum WakeLockControl {
55 WAKE_LOCK_REMOVE_ONE = -1,
56 WAKE_LOCK_NO_CHANGE = 0,
57 WAKE_LOCK_ADD_ONE = 1,
58 NUM_WAKE_LOCK
61 } // namespace hal
62 } // namespace mozilla
64 namespace IPC {
66 /**
67 * WakeLockControl serializer.
69 template <>
70 struct ParamTraits<mozilla::hal::WakeLockControl>
71 : public ContiguousEnumSerializer<mozilla::hal::WakeLockControl,
72 mozilla::hal::WAKE_LOCK_REMOVE_ONE,
73 mozilla::hal::NUM_WAKE_LOCK> {};
75 template <>
76 struct ParamTraits<mozilla::hal::ProcessPriority>
77 : public ContiguousEnumSerializer<mozilla::hal::ProcessPriority,
78 mozilla::hal::PROCESS_PRIORITY_UNKNOWN,
79 mozilla::hal::NUM_PROCESS_PRIORITY> {};
81 } // namespace IPC
83 #endif // mozilla_hal_Types_h