Bumping manifests a=b2g-bump
[gecko.git] / gfx / thebes / gfxPrefs.cpp
blob1e59820db37b66446fa0e89bd02f3e7b340a16db
1 /* -*- Mode: C++; tab-width: 20; 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
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "gfxPrefs.h"
8 #include "mozilla/Preferences.h"
9 #include "MainThreadUtils.h"
11 using namespace mozilla;
13 gfxPrefs* gfxPrefs::sInstance = nullptr;
14 bool gfxPrefs::sInstanceHasBeenDestroyed = false;
16 void
17 gfxPrefs::DestroySingleton()
19 if (sInstance) {
20 delete sInstance;
21 sInstance = nullptr;
22 sInstanceHasBeenDestroyed = true;
24 MOZ_ASSERT(!SingletonExists());
27 bool
28 gfxPrefs::SingletonExists()
30 return sInstance != nullptr;
33 gfxPrefs::gfxPrefs()
35 gfxPrefs::AssertMainThread();
38 gfxPrefs::~gfxPrefs()
40 gfxPrefs::AssertMainThread();
43 void gfxPrefs::AssertMainThread()
45 MOZ_ASSERT(NS_IsMainThread(), "this code must be run on the main thread");
48 void gfxPrefs::PrefAddVarCache(bool* aVariable,
49 const char* aPref,
50 bool aDefault)
52 Preferences::AddBoolVarCache(aVariable, aPref, aDefault);
55 void gfxPrefs::PrefAddVarCache(int32_t* aVariable,
56 const char* aPref,
57 int32_t aDefault)
59 Preferences::AddIntVarCache(aVariable, aPref, aDefault);
62 void gfxPrefs::PrefAddVarCache(uint32_t* aVariable,
63 const char* aPref,
64 uint32_t aDefault)
66 Preferences::AddUintVarCache(aVariable, aPref, aDefault);
69 void gfxPrefs::PrefAddVarCache(float* aVariable,
70 const char* aPref,
71 float aDefault)
73 Preferences::AddFloatVarCache(aVariable, aPref, aDefault);
76 bool gfxPrefs::PrefGet(const char* aPref, bool aDefault)
78 return Preferences::GetBool(aPref, aDefault);
81 int32_t gfxPrefs::PrefGet(const char* aPref, int32_t aDefault)
83 return Preferences::GetInt(aPref, aDefault);
86 uint32_t gfxPrefs::PrefGet(const char* aPref, uint32_t aDefault)
88 return Preferences::GetUint(aPref, aDefault);
91 float gfxPrefs::PrefGet(const char* aPref, float aDefault)
93 return Preferences::GetFloat(aPref, aDefault);
96 void gfxPrefs::PrefSet(const char* aPref, bool aValue)
98 Preferences::SetBool(aPref, aValue);
101 void gfxPrefs::PrefSet(const char* aPref, int32_t aValue)
103 Preferences::SetInt(aPref, aValue);
106 void gfxPrefs::PrefSet(const char* aPref, uint32_t aValue)
108 Preferences::SetUint(aPref, aValue);
111 void gfxPrefs::PrefSet(const char* aPref, float aValue)
113 Preferences::SetFloat(aPref, aValue);