зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1319985 - Expose ChangeCallback in gfxPrefs. r=milan
MozReview-Commit-ID: GiLq4OwmzYs
This commit is contained in:
Родитель
3468111c94
Коммит
9c57c957d6
|
@ -52,15 +52,15 @@ void
|
|||
gfxPrefs::Init()
|
||||
{
|
||||
// Set up Moz2D prefs.
|
||||
mPrefGfxLoggingLevel.SetChangeCallback([]() -> void {
|
||||
mozilla::gfx::LoggingPrefs::sGfxLogLevel = GetSingleton().mPrefGfxLoggingLevel.GetLiveValue();
|
||||
SetGfxLoggingLevelChangeCallback([](const GfxPrefValue& aValue) -> void {
|
||||
mozilla::gfx::LoggingPrefs::sGfxLogLevel = aValue.get_int32_t();
|
||||
});
|
||||
}
|
||||
|
||||
gfxPrefs::~gfxPrefs()
|
||||
{
|
||||
gfxPrefs::AssertMainThread();
|
||||
mPrefGfxLoggingLevel.SetChangeCallback(nullptr);
|
||||
SetGfxLoggingLevelChangeCallback(nullptr);
|
||||
delete sGfxPrefList;
|
||||
sGfxPrefList = nullptr;
|
||||
}
|
||||
|
@ -87,7 +87,9 @@ void
|
|||
gfxPrefs::Pref::FireChangeCallback()
|
||||
{
|
||||
if (mChangeCallback) {
|
||||
mChangeCallback();
|
||||
GfxPrefValue value;
|
||||
GetLiveValue(&value);
|
||||
mChangeCallback(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,9 @@ static void Set##Name(Type aVal) { MOZ_ASSERT(SingletonExists()); \
|
|||
GetSingleton().mPref##Name.Set(UpdatePolicy::Update, Get##Name##PrefName(), aVal); } \
|
||||
static const char* Get##Name##PrefName() { return Prefname; } \
|
||||
static Type Get##Name##PrefDefault() { return Default; } \
|
||||
static void Set##Name##ChangeCallback(Pref::ChangeCallback aCallback) { \
|
||||
MOZ_ASSERT(SingletonExists()); \
|
||||
GetSingleton().mPref##Name.SetChangeCallback(aCallback); } \
|
||||
private: \
|
||||
PrefTemplate<UpdatePolicy::Update, Type, Get##Name##PrefDefault, Get##Name##PrefName> mPref##Name
|
||||
|
||||
|
@ -105,7 +108,7 @@ public:
|
|||
size_t Index() const { return mIndex; }
|
||||
void OnChange();
|
||||
|
||||
typedef void (*ChangeCallback)();
|
||||
typedef void (*ChangeCallback)(const GfxPrefValue&);
|
||||
void SetChangeCallback(ChangeCallback aCallback);
|
||||
|
||||
virtual const char* Name() const = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче