Bug 1731282 [wpt PR 30785] - Fix endpoint URL for a COEP navigation reporting test...
[gecko.git] / modules / libpref / StaticPrefsBase.h
blob23df6d918b52d2d55bae4652f0dafc3c4de1b4bc
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_StaticPrefsBase_h
8 #define mozilla_StaticPrefsBase_h
10 #include <type_traits>
12 #include "mozilla/Atomics.h"
14 namespace mozilla {
16 class SharedPrefMapBuilder;
18 // These typedefs are for use within init/StaticPrefList*.h.
20 typedef const char* String;
22 typedef Atomic<bool, Relaxed> RelaxedAtomicBool;
23 typedef Atomic<bool, ReleaseAcquire> ReleaseAcquireAtomicBool;
24 typedef Atomic<bool, SequentiallyConsistent> SequentiallyConsistentAtomicBool;
26 typedef Atomic<int32_t, Relaxed> RelaxedAtomicInt32;
27 typedef Atomic<int32_t, ReleaseAcquire> ReleaseAcquireAtomicInt32;
28 typedef Atomic<int32_t, SequentiallyConsistent>
29 SequentiallyConsistentAtomicInt32;
31 typedef Atomic<uint32_t, Relaxed> RelaxedAtomicUint32;
32 typedef Atomic<uint32_t, ReleaseAcquire> ReleaseAcquireAtomicUint32;
33 typedef Atomic<uint32_t, SequentiallyConsistent>
34 SequentiallyConsistentAtomicUint32;
36 // XXX: Atomic<float> currently doesn't work (see bug 1552086). Once it's
37 // supported we will be able to use Atomic<float> here.
38 typedef std::atomic<float> AtomicFloat;
40 template <typename T>
41 struct StripAtomicImpl {
42 typedef T Type;
45 template <typename T, MemoryOrdering Order>
46 struct StripAtomicImpl<Atomic<T, Order>> {
47 typedef T Type;
50 template <typename T>
51 struct StripAtomicImpl<std::atomic<T>> {
52 typedef T Type;
55 template <typename T>
56 using StripAtomic = typename StripAtomicImpl<T>::Type;
58 template <typename T>
59 struct IsAtomic : std::false_type {};
61 template <typename T, MemoryOrdering Order>
62 struct IsAtomic<Atomic<T, Order>> : std::true_type {};
64 template <typename T>
65 struct IsAtomic<std::atomic<T>> : std::true_type {};
67 namespace StaticPrefs {
69 void MaybeInitOncePrefs();
71 } // namespace StaticPrefs
73 } // namespace mozilla
75 #endif // mozilla_StaticPrefsBase_h