gfx/thebes/gfxPrefs.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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;
    15 void
    16 gfxPrefs::DestroySingleton()
    17 {
    18   if (sInstance) {
    19     delete sInstance;
    20     sInstance = nullptr;
    21   }
    22 }
    24 bool
    25 gfxPrefs::SingletonExists()
    26 {
    27   return sInstance != nullptr;
    28 }
    30 gfxPrefs::gfxPrefs()
    31 {
    32   // Needs to be created on the main thread.
    33   MOZ_ASSERT(NS_IsMainThread(), "must be constructed on the main thread");
    34 }
    36 gfxPrefs::~gfxPrefs()
    37 {
    38   MOZ_ASSERT(NS_IsMainThread(), "must be destructed on the main thread");
    39 }
    41 void gfxPrefs::PrefAddVarCache(bool* aVariable,
    42                                const char* aPref,
    43                                bool aDefault)
    44 {
    45   Preferences::AddBoolVarCache(aVariable, aPref, aDefault);
    46 }
    48 void gfxPrefs::PrefAddVarCache(int32_t* aVariable,
    49                                const char* aPref,
    50                                int32_t aDefault)
    51 {
    52   Preferences::AddIntVarCache(aVariable, aPref, aDefault);
    53 }
    55 void gfxPrefs::PrefAddVarCache(uint32_t* aVariable,
    56                                const char* aPref,
    57                                uint32_t aDefault)
    58 {
    59   Preferences::AddUintVarCache(aVariable, aPref, aDefault);
    60 }
    62 void gfxPrefs::PrefAddVarCache(float* aVariable,
    63                                const char* aPref,
    64                                float aDefault)
    65 {
    66   Preferences::AddFloatVarCache(aVariable, aPref, aDefault);
    67 }
    69 bool gfxPrefs::PrefGet(const char* aPref, bool aDefault)
    70 {
    71   return Preferences::GetBool(aPref, aDefault);
    72 }
    74 int32_t gfxPrefs::PrefGet(const char* aPref, int32_t aDefault)
    75 {
    76   return Preferences::GetInt(aPref, aDefault);
    77 }
    79 uint32_t gfxPrefs::PrefGet(const char* aPref, uint32_t aDefault)
    80 {
    81   return Preferences::GetUint(aPref, aDefault);
    82 }
    84 float gfxPrefs::PrefGet(const char* aPref, float aDefault)
    85 {
    86   return Preferences::GetFloat(aPref, aDefault);
    87 }

mercurial