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/IPCMessageUtils.h"
10 #include "mozilla/Observer.h"
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
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_MASTER
,
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 "???".
50 ProcessPriorityToString(ProcessPriority aPriority
);
53 * Used by ModifyWakeLock
55 enum WakeLockControl
{
56 WAKE_LOCK_REMOVE_ONE
= -1,
57 WAKE_LOCK_NO_CHANGE
= 0,
58 WAKE_LOCK_ADD_ONE
= 1,
63 } // namespace mozilla
68 * WakeLockControl serializer.
71 struct ParamTraits
<mozilla::hal::WakeLockControl
>
72 : public ContiguousEnumSerializer
<
73 mozilla::hal::WakeLockControl
,
74 mozilla::hal::WAKE_LOCK_REMOVE_ONE
,
75 mozilla::hal::NUM_WAKE_LOCK
>
79 struct ParamTraits
<mozilla::hal::ProcessPriority
>:
80 public ContiguousEnumSerializer
<
81 mozilla::hal::ProcessPriority
,
82 mozilla::hal::PROCESS_PRIORITY_UNKNOWN
,
83 mozilla::hal::NUM_PROCESS_PRIORITY
> {
89 #endif // mozilla_hal_Types_h