Bug 947736 - Build modules/libpref/ in unified mode; r=bsmedberg

This commit is contained in:
Ehsan Akhgari 2013-12-10 18:10:01 -05:00
parent 8d3efe596e
commit d9cd92fa17
41 changed files with 90 additions and 132 deletions

View File

@ -5511,14 +5511,13 @@ nsEventStateManager::WheelPrefs::Shutdown()
}
// static
int
void
nsEventStateManager::WheelPrefs::OnPrefChanged(const char* aPrefName,
void* aClosure)
{
// forget all prefs, it's not problem for performance.
sInstance->Reset();
DeltaAccumulator::GetInstance()->Reset();
return 0;
}
nsEventStateManager::WheelPrefs::WheelPrefs()
@ -5800,14 +5799,13 @@ nsEventStateManager::Prefs::Init()
}
// static
int
void
nsEventStateManager::Prefs::OnChange(const char* aPrefName, void*)
{
nsDependentCString prefName(aPrefName);
if (prefName.EqualsLiteral("dom.popup_allowed_events")) {
nsDOMEvent::PopupAllowedEventsChanged();
}
return 0;
}
// static

View File

@ -227,7 +227,7 @@ protected:
static int32_t ContentAccessModifierMask();
static void Init();
static int OnChange(const char* aPrefName, void*);
static void OnChange(const char* aPrefName, void*);
static void Shutdown();
private:
@ -409,7 +409,7 @@ protected:
WheelPrefs();
~WheelPrefs();
static int OnPrefChanged(const char* aPrefName, void* aClosure);
static void OnPrefChanged(const char* aPrefName, void* aClosure);
enum Index
{

View File

@ -42,7 +42,7 @@ double AudioStream::sVolumeScale;
uint32_t AudioStream::sCubebLatency;
bool AudioStream::sCubebLatencyPrefSet;
/*static*/ int AudioStream::PrefChanged(const char* aPref, void* aClosure)
/*static*/ void AudioStream::PrefChanged(const char* aPref, void* aClosure)
{
if (strcmp(aPref, PREF_VOLUME_SCALE) == 0) {
nsAdoptingString value = Preferences::GetString(aPref);
@ -62,7 +62,6 @@ bool AudioStream::sCubebLatencyPrefSet;
StaticMutexAutoLock lock(sMutex);
sCubebLatency = std::min<uint32_t>(std::max<uint32_t>(value, 1), 1000);
}
return 0;
}
/*static*/ double AudioStream::GetVolumeScale()

View File

@ -259,7 +259,7 @@ public:
nsresult SetPreservesPitch(bool aPreservesPitch);
private:
static int PrefChanged(const char* aPref, void* aClosure);
static void PrefChanged(const char* aPref, void* aClosure);
static double GetVolumeScale();
static cubeb* GetCubebContext();
static cubeb* GetCubebContextUnlocked();

View File

@ -4740,7 +4740,7 @@ XULDocument::ResetDocumentDirection()
DocumentStatesChanged(NS_DOCUMENT_STATE_RTL_LOCALE);
}
int
void
XULDocument::DirectionChanged(const char* aPrefName, void* aData)
{
// Reset the direction and restyle the document if necessary.
@ -4748,8 +4748,6 @@ XULDocument::DirectionChanged(const char* aPrefName, void* aData)
if (doc) {
doc->ResetDocumentDirection();
}
return 0;
}
int

View File

@ -279,7 +279,7 @@ protected:
already_AddRefed<nsPIWindowRoot> GetWindowRoot();
static NS_HIDDEN_(int) DirectionChanged(const char* aPrefName, void* aData);
static NS_HIDDEN_(void) DirectionChanged(const char* aPrefName, void* aData);
// pseudo constants
static int32_t gRefCnt;

View File

@ -53,7 +53,7 @@ UpdategDisableXULCache()
}
static int
static void
DisableXULCacheChangedCallback(const char* aPref, void* aClosure)
{
UpdategDisableXULCache();
@ -62,8 +62,6 @@ DisableXULCacheChangedCallback(const char* aPref, void* aClosure)
nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
if (cache)
cache->Flush();
return 0;
}
//----------------------------------------------------------------------
@ -461,7 +459,7 @@ nsXULPrototypeCache::HasData(nsIURI* uri, bool* exists)
return NS_OK;
}
static int
static void
CachePrefChangedCallback(const char* aPref, void* aClosure)
{
bool wasEnabled = !gDisableXULDiskCache;
@ -475,7 +473,6 @@ CachePrefChangedCallback(const char* aPref, void* aClosure)
if (cache)
cache->AbortCaching();
}
return 0;
}
nsresult

View File

@ -722,7 +722,7 @@ static const char js_ion_eager_str[] = JS_OPTIONS_DOT_STR "ion.unsafe_e
static const char js_parallel_parsing_str[] = JS_OPTIONS_DOT_STR "parallel_parsing";
static const char js_ion_parallel_compilation_str[] = JS_OPTIONS_DOT_STR "ion.parallel_compilation";
int
void
nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
{
nsJSContext *context = reinterpret_cast<nsJSContext *>(data);
@ -807,8 +807,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
if (zeal >= 0)
::JS_SetGCZeal(context->mContext, (uint8_t)zeal, frequency);
#endif
return 0;
}
nsJSContext::nsJSContext(bool aGCOnDestruction,
@ -2683,35 +2681,32 @@ mozilla::dom::StartupJSEnvironment()
gCCStats.Clear();
}
static int
static void
ReportAllJSExceptionsPrefChangedCallback(const char* aPrefName, void* aClosure)
{
bool reportAll = Preferences::GetBool(aPrefName, false);
nsContentUtils::XPConnect()->SetReportAllJSExceptions(reportAll);
return 0;
}
static int
static void
SetMemoryHighWaterMarkPrefChangedCallback(const char* aPrefName, void* aClosure)
{
int32_t highwatermark = Preferences::GetInt(aPrefName, 128);
JS_SetGCParameter(sRuntime, JSGC_MAX_MALLOC_BYTES,
highwatermark * 1024L * 1024L);
return 0;
}
static int
static void
SetMemoryMaxPrefChangedCallback(const char* aPrefName, void* aClosure)
{
int32_t pref = Preferences::GetInt(aPrefName, -1);
// handle overflow and negative pref values
uint32_t max = (pref <= 0 || pref >= 0x1000) ? -1 : (uint32_t)pref * 1024 * 1024;
JS_SetGCParameter(sRuntime, JSGC_MAX_BYTES, max);
return 0;
}
static int
static void
SetMemoryGCModePrefChangedCallback(const char* aPrefName, void* aClosure)
{
bool enableCompartmentGC = Preferences::GetBool("javascript.options.mem.gc_per_compartment");
@ -2725,43 +2720,38 @@ SetMemoryGCModePrefChangedCallback(const char* aPrefName, void* aClosure)
mode = JSGC_MODE_GLOBAL;
}
JS_SetGCParameter(sRuntime, JSGC_MODE, mode);
return 0;
}
static int
static void
SetMemoryGCSliceTimePrefChangedCallback(const char* aPrefName, void* aClosure)
{
int32_t pref = Preferences::GetInt(aPrefName, -1);
// handle overflow and negative pref values
if (pref > 0 && pref < 100000)
JS_SetGCParameter(sRuntime, JSGC_SLICE_TIME_BUDGET, pref);
return 0;
}
static int
static void
SetMemoryGCPrefChangedCallback(const char* aPrefName, void* aClosure)
{
int32_t pref = Preferences::GetInt(aPrefName, -1);
// handle overflow and negative pref values
if (pref >= 0 && pref < 10000)
JS_SetGCParameter(sRuntime, (JSGCParamKey)(intptr_t)aClosure, pref);
return 0;
}
static int
static void
SetMemoryGCDynamicHeapGrowthPrefChangedCallback(const char* aPrefName, void* aClosure)
{
bool pref = Preferences::GetBool(aPrefName);
JS_SetGCParameter(sRuntime, JSGC_DYNAMIC_HEAP_GROWTH, pref);
return 0;
}
static int
static void
SetMemoryGCDynamicMarkSlicePrefChangedCallback(const char* aPrefName, void* aClosure)
{
bool pref = Preferences::GetBool(aPrefName);
JS_SetGCParameter(sRuntime, JSGC_DYNAMIC_MARK_SLICE, pref);
return 0;
}
JSObject*

View File

@ -181,7 +181,7 @@ private:
// context does. It is eventually collected by the cycle collector.
nsCOMPtr<nsIScriptGlobalObject> mGlobalObjectRef;
static int JSOptionChangedCallback(const char *pref, void *data);
static void JSOptionChangedCallback(const char *pref, void *data);
static bool DOMOperationCallback(JSContext *cx);
};

View File

@ -101,13 +101,12 @@ FallbackEncoding::FromLocale(nsACString& aFallback)
}
// PrefChangedFunc
int
void
FallbackEncoding::PrefChanged(const char*, void*)
{
MOZ_ASSERT(FallbackEncoding::sInstance,
"Pref callback called with null fallback cache.");
FallbackEncoding::sInstance->Invalidate();
return 0;
}
void

View File

@ -54,7 +54,7 @@ private:
mFallback.Truncate();
}
static int PrefChanged(const char*, void*);
static void PrefChanged(const char*, void*);
/**
* Gets the fallback encoding label.

View File

@ -158,7 +158,7 @@ private:
static bool sInitialized;
static StaticRefPtr<ProcessPriorityManagerImpl> sSingleton;
static int PrefChangedCallback(const char* aPref, void* aClosure);
static void PrefChangedCallback(const char* aPref, void* aClosure);
ProcessPriorityManagerImpl();
~ProcessPriorityManagerImpl() {}
@ -345,12 +345,11 @@ private:
NS_IMPL_ISUPPORTS1(ProcessPriorityManagerImpl,
nsIObserver);
/* static */ int
/* static */ void
ProcessPriorityManagerImpl::PrefChangedCallback(const char* aPref,
void* aClosure)
{
StaticInit();
return 0;
}
/* static */ bool

View File

@ -264,7 +264,7 @@ PluginModuleParent::SetChildTimeout(const int32_t aChildTimeout)
SetReplyTimeoutMs(timeoutMs);
}
int
void
PluginModuleParent::TimeoutChanged(const char* aPref, void* aModule)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -284,7 +284,6 @@ PluginModuleParent::TimeoutChanged(const char* aPref, void* aModule)
int32_t timeoutSecs = Preferences::GetInt(kParentTimeoutPref, 0);
unused << static_cast<PluginModuleParent*>(aModule)->SendSetParentHangTimeout(timeoutSecs);
}
return 0;
}
void

View File

@ -287,7 +287,7 @@ private:
#endif
void CleanupFromTimeout(const bool aByHangUI);
void SetChildTimeout(const int32_t aChildTimeout);
static int TimeoutChanged(const char* aPref, void* aModule);
static void TimeoutChanged(const char* aPref, void* aModule);
void NotifyPluginCrashed();
#ifdef MOZ_ENABLE_PROFILER_SPS

View File

@ -270,7 +270,7 @@ GetWorkerPref(const nsACString& aPref,
return result;
}
int
void
LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
{
AssertIsOnMainThread();
@ -278,7 +278,7 @@ LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
RuntimeService* rts = RuntimeService::GetService();
if (!rts && !gRuntimeServiceDuringInit) {
// May be shutting down, just bail.
return 0;
return;
}
const nsDependentCString prefName(aPrefName);
@ -293,13 +293,13 @@ LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
PREF_MEM_OPTIONS_PREFIX)) ||
prefName.EqualsLiteral(PREF_JS_OPTIONS_PREFIX PREF_JIT_HARDENING) ||
prefName.EqualsLiteral(PREF_WORKERS_OPTIONS_PREFIX PREF_JIT_HARDENING)) {
return 0;
return;
}
#ifdef JS_GC_ZEAL
if (prefName.EqualsLiteral(PREF_JS_OPTIONS_PREFIX PREF_GCZEAL) ||
prefName.EqualsLiteral(PREF_WORKERS_OPTIONS_PREFIX PREF_GCZEAL)) {
return 0;
return;
}
#endif
@ -349,12 +349,10 @@ LoadJSContextOptions(const char* aPrefName, void* /* aClosure */)
if (rts) {
rts->UpdateAllWorkerJSContextOptions();
}
return 0;
}
#ifdef JS_GC_ZEAL
int
void
LoadGCZealOptions(const char* /* aPrefName */, void* /* aClosure */)
{
AssertIsOnMainThread();
@ -362,7 +360,7 @@ LoadGCZealOptions(const char* /* aPrefName */, void* /* aClosure */)
RuntimeService* rts = RuntimeService::GetService();
if (!rts && !gRuntimeServiceDuringInit) {
// May be shutting down, just bail.
return 0;
return;
}
int32_t gczeal = GetWorkerPref<int32_t>(NS_LITERAL_CSTRING(PREF_GCZEAL), -1);
@ -381,8 +379,6 @@ LoadGCZealOptions(const char* /* aPrefName */, void* /* aClosure */)
if (rts) {
rts->UpdateAllWorkerGCZeal();
}
return 0;
}
#endif
@ -418,7 +414,7 @@ UpdatOtherJSGCMemoryOption(RuntimeService* aRuntimeService,
}
int
void
LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */)
{
AssertIsOnMainThread();
@ -427,7 +423,7 @@ LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */)
if (!rts && !gRuntimeServiceDuringInit) {
// May be shutting down, just bail.
return 0;
return;
}
NS_NAMED_LITERAL_CSTRING(jsPrefix, PREF_JS_OPTIONS_PREFIX);
@ -446,7 +442,7 @@ LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */)
}
else {
NS_ERROR("Unknown pref name!");
return 0;
return;
}
#ifdef DEBUG
@ -569,11 +565,9 @@ LoadJSGCMemoryOptions(const char* aPrefName, void* /* aClosure */)
NS_WARNING(message.get());
#endif
}
return 0;
}
int
void
LoadJITHardeningOption(const char* /* aPrefName */, void* /* aClosure */)
{
AssertIsOnMainThread();
@ -582,7 +576,7 @@ LoadJITHardeningOption(const char* /* aPrefName */, void* /* aClosure */)
if (!rts && !gRuntimeServiceDuringInit) {
// May be shutting down, just bail.
return 0;
return;
}
bool value = GetWorkerPref(NS_LITERAL_CSTRING(PREF_JIT_HARDENING), false);
@ -592,8 +586,6 @@ LoadJITHardeningOption(const char* /* aPrefName */, void* /* aClosure */)
if (rts) {
rts->UpdateAllWorkerJITHardening(value);
}
return 0;
}
void
@ -2312,7 +2304,7 @@ RuntimeService::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK;
}
/* static */ int
/* static */ void
RuntimeService::WorkerPrefChanged(const char* aPrefName, void* aClosure)
{
AssertIsOnMainThread();
@ -2340,5 +2332,4 @@ RuntimeService::WorkerPrefChanged(const char* aPrefName, void* aClosure)
if (rts) {
rts->UpdateAllWorkerPreference(key, sDefaultPreferences[key]);
}
return 0;
}

View File

@ -293,7 +293,7 @@ private:
static void
ShutdownIdleThreads(nsITimer* aTimer, void* aClosure);
static int
static void
WorkerPrefChanged(const char* aPrefName, void* aClosure);
};

View File

@ -146,7 +146,7 @@ NS_IMETHODIMP nsPlaintextEditor::Init(nsIDOMDocument *aDoc,
static int32_t sNewlineHandlingPref = -1,
sCaretStylePref = -1;
static int
static void
EditorPrefsChangedCallback(const char *aPrefName, void *)
{
if (nsCRT::strcmp(aPrefName, "editor.singleLine.pasteNewlines") == 0) {
@ -163,7 +163,6 @@ EditorPrefsChangedCallback(const char *aPrefName, void *)
0);
#endif
}
return 0;
}
// static

View File

@ -323,7 +323,7 @@ gfxPlatform::GetPlatform()
return gPlatform;
}
int RecordingPrefChanged(const char *aPrefName, void *aClosure)
void RecordingPrefChanged(const char *aPrefName, void *aClosure)
{
if (Preferences::GetBool("gfx.2d.recording", false)) {
nsAutoCString fileName;
@ -334,17 +334,17 @@ int RecordingPrefChanged(const char *aPrefName, void *aClosure)
} else {
nsCOMPtr<nsIFile> tmpFile;
if (NS_FAILED(NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpFile)))) {
return 0;
return;
}
fileName.AppendPrintf("moz2drec_%i_%i.aer", XRE_GetProcessType(), getpid());
nsresult rv = tmpFile->AppendNative(fileName);
if (NS_FAILED(rv))
return 0;
return;
rv = tmpFile->GetNativePath(fileName);
if (NS_FAILED(rv))
return 0;
return;
}
gPlatform->mRecorder = Factory::CreateEventRecorderForFile(fileName.BeginReading());
@ -353,8 +353,6 @@ int RecordingPrefChanged(const char *aPrefName, void *aClosure)
} else {
Factory::SetGlobalEventRecorder(nullptr);
}
return 0;
}
void

View File

@ -702,7 +702,7 @@ private:
static void CreateCMSOutputProfile();
friend int RecordingPrefChanged(const char *aPrefName, void *aClosure);
friend void RecordingPrefChanged(const char *aPrefName, void *aClosure);
virtual qcms_profile* GetPlatformCMSOutputProfile();

View File

@ -39,11 +39,10 @@ DiscardTracker::DiscardRunnable::Run()
return NS_OK;
}
int
void
DiscardTimeoutChangedCallback(const char* aPref, void *aClosure)
{
DiscardTracker::ReloadTimeout();
return 0;
}
nsresult

View File

@ -93,7 +93,7 @@ class DiscardTracker
/**
* This is called when the discard timer fires; it calls into DiscardNow().
*/
friend int DiscardTimeoutChangedCallback(const char* aPref, void *aClosure);
friend void DiscardTimeoutChangedCallback(const char* aPref, void *aClosure);
/**
* When run, this runnable sets sDiscardRunnablePending to false and calls

View File

@ -128,7 +128,7 @@ static ContentMap& GetContentMap() {
// When the pref "layout.css.sticky.enabled" changes, this function is invoked
// to let us update kPositionKTable, to selectively disable or restore the
// entry for "sticky" in that table.
static int
static void
StickyEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
{
MOZ_ASSERT(strncmp(aPrefName, STICKY_ENABLED_PREF_NAME,
@ -156,14 +156,12 @@ StickyEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
// depending on whether the sticky pref is enabled vs. disabled.
nsCSSProps::kPositionKTable[sIndexOfStickyInPositionTable] =
isStickyEnabled ? eCSSKeyword_sticky : eCSSKeyword_UNKNOWN;
return 0;
}
// When the pref "layout.css.text-align-true-value.enabled" changes, this
// function is called to let us update kTextAlignKTable & kTextAlignLastKTable,
// to selectively disable or restore the entries for "true" in those tables.
static int
static void
TextAlignTrueEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
{
NS_ASSERTION(strcmp(aPrefName, TEXT_ALIGN_TRUE_ENABLED_PREF_NAME) == 0,
@ -195,8 +193,6 @@ TextAlignTrueEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
MOZ_ASSERT(sIndexOfTrueInTextAlignLastTable >= 0);
nsCSSProps::kTextAlignLastKTable[sIndexOfTrueInTextAlignLastTable] =
isTextAlignTrueEnabled ? eCSSKeyword_true : eCSSKeyword_UNKNOWN;
return 0;
}
template <class AnimationsOrTransitions>

View File

@ -140,7 +140,7 @@ nsPresContext::IsDOMPaintEventPending()
return false;
}
int
void
nsPresContext::PrefChangedCallback(const char* aPrefName, void* instance_data)
{
nsRefPtr<nsPresContext> presContext =
@ -150,7 +150,6 @@ nsPresContext::PrefChangedCallback(const char* aPrefName, void* instance_data)
if (nullptr != presContext) {
presContext->PreferenceChanged(aPrefName);
}
return 0; // PREF_OK
}

View File

@ -1019,7 +1019,7 @@ protected:
NS_HIDDEN_(void) GetDocumentColorPreferences();
NS_HIDDEN_(void) PreferenceChanged(const char* aPrefName);
static NS_HIDDEN_(int) PrefChangedCallback(const char*, void*);
static NS_HIDDEN_(void) PrefChangedCallback(const char*, void*);
NS_HIDDEN_(void) UpdateAfterPreferencesChanged();
static NS_HIDDEN_(void) PrefChangedUpdateTimerCallback(nsITimer *aTimer, void *aClosure);

View File

@ -213,7 +213,7 @@ NS_QUERYFRAME_HEAD(nsHTMLFramesetFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
// static
int
void
nsHTMLFramesetFrame::FrameResizePrefCallback(const char* aPref, void* aClosure)
{
nsHTMLFramesetFrame *frame =
@ -238,8 +238,6 @@ nsHTMLFramesetFrame::FrameResizePrefCallback(const char* aPref, void* aClosure)
nsGkAtoms::frameborder,
nsIDOMMutationEvent::MODIFICATION);
}
return 0;
}
void

View File

@ -185,7 +185,7 @@ protected:
void SetBorderResize(nsHTMLFramesetBorderFrame* aBorderFrame);
static int FrameResizePrefCallback(const char* aPref, void* aClosure);
static void FrameResizePrefCallback(const char* aPref, void* aClosure);
nsFramesetDrag mDrag;
nsBorderColor mEdgeColors;

View File

@ -5205,11 +5205,10 @@ nsComputedDOMStyle::DoGetAnimationPlayState()
return valueList;
}
static int
static void
MarkComputedStyleMapDirty(const char* aPref, void* aData)
{
static_cast<nsComputedStyleMap*>(aData)->MarkDirty();
return 0;
}
/* static */ nsComputedStyleMap*

View File

@ -273,14 +273,12 @@ nsXULTooltipListener::HandleEvent(nsIDOMEvent* aEvent)
//// nsXULTooltipListener
// static
int
void
nsXULTooltipListener::ToolbarTipsPrefChanged(const char *aPref,
void *aClosure)
{
sShowTooltips =
Preferences::GetBool("browser.chrome.toolbar_tips", sShowTooltips);
return 0;
}
//////////////////////////////////////////////////////////////////////////

View File

@ -66,7 +66,7 @@ protected:
nsresult GetTooltipFor(nsIContent* aTarget, nsIContent** aTooltip);
static nsXULTooltipListener* mInstance;
static int ToolbarTipsPrefChanged(const char *aPref, void *aClosure);
static void ToolbarTipsPrefChanged(const char *aPref, void *aClosure);
nsWeakPtr mSourceNode;
nsWeakPtr mTargetNode;

View File

@ -26,7 +26,7 @@ class nsAdoptingString;
class nsAdoptingCString;
#ifndef have_PrefChangedFunc_typedef
typedef int (*PrefChangedFunc)(const char *, void *);
typedef void (*PrefChangedFunc)(const char *, void *);
#define have_PrefChangedFunc_typedef
#endif

View File

@ -1672,12 +1672,11 @@ Preferences::UnregisterCallback(PrefChangedFunc aCallback,
return NS_OK;
}
static int BoolVarChanged(const char* aPref, void* aClosure)
static void BoolVarChanged(const char* aPref, void* aClosure)
{
CacheData* cache = static_cast<CacheData*>(aClosure);
*((bool*)cache->cacheLocation) =
Preferences::GetBool(aPref, cache->defaultValueBool);
return 0;
}
// static
@ -1695,12 +1694,11 @@ Preferences::AddBoolVarCache(bool* aCache,
return RegisterCallback(BoolVarChanged, aPref, data);
}
static int IntVarChanged(const char* aPref, void* aClosure)
static void IntVarChanged(const char* aPref, void* aClosure)
{
CacheData* cache = static_cast<CacheData*>(aClosure);
*((int32_t*)cache->cacheLocation) =
Preferences::GetInt(aPref, cache->defaultValueInt);
return 0;
}
// static
@ -1718,12 +1716,11 @@ Preferences::AddIntVarCache(int32_t* aCache,
return RegisterCallback(IntVarChanged, aPref, data);
}
static int UintVarChanged(const char* aPref, void* aClosure)
static void UintVarChanged(const char* aPref, void* aClosure)
{
CacheData* cache = static_cast<CacheData*>(aClosure);
*((uint32_t*)cache->cacheLocation) =
Preferences::GetUint(aPref, cache->defaultValueUint);
return 0;
}
// static
@ -1741,12 +1738,11 @@ Preferences::AddUintVarCache(uint32_t* aCache,
return RegisterCallback(UintVarChanged, aPref, data);
}
static int FloatVarChanged(const char* aPref, void* aClosure)
static void FloatVarChanged(const char* aPref, void* aClosure)
{
CacheData* cache = static_cast<CacheData*>(aClosure);
*((float*)cache->cacheLocation) =
Preferences::GetFloat(aPref, cache->defaultValueFloat);
return 0;
}
// static

View File

@ -4,14 +4,18 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
SOURCES += [
UNIFIED_SOURCES += [
'nsPrefBranch.cpp',
'nsPrefsFactory.cpp',
'prefapi.cpp',
'Preferences.cpp',
'prefread.cpp',
]
# prefapi.cpp cannot be built in unified mode because it uses plarena.h
SOURCES += [
'prefapi.cpp',
]
MSVC_ENABLE_PGO = True
include('/ipc/chromium/chromium-config.mozbuild')

View File

@ -681,7 +681,7 @@ NS_IMETHODIMP nsPrefBranch::Observe(nsISupports *aSubject, const char *aTopic, c
}
/* static */
nsresult nsPrefBranch::NotifyObserver(const char *newpref, void *data)
void nsPrefBranch::NotifyObserver(const char *newpref, void *data)
{
PrefCallback *pCallback = (PrefCallback *)data;
@ -689,7 +689,7 @@ nsresult nsPrefBranch::NotifyObserver(const char *newpref, void *data)
if (!observer) {
// The observer has expired. Let's remove this callback.
pCallback->GetPrefBranch()->RemoveExpiredCallback(pCallback);
return NS_OK;
return;
}
// remove any root this string may contain so as to not confuse the observer
@ -700,7 +700,6 @@ nsresult nsPrefBranch::NotifyObserver(const char *newpref, void *data)
observer->Observe(static_cast<nsIPrefBranch *>(pCallback->GetPrefBranch()),
NS_PREFBRANCH_PREFCHANGE_TOPIC_ID,
NS_ConvertASCIItoUTF16(suffix).get());
return NS_OK;
}
PLDHashOperator

View File

@ -3,6 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsPrefBranch_h
#define nsPrefBranch_h
#include "nsCOMPtr.h"
#include "nsIObserver.h"
#include "nsIPrefBranch.h"
@ -191,7 +194,7 @@ public:
nsresult RemoveObserverFromMap(const char *aDomain, nsISupports *aObserver);
static nsresult NotifyObserver(const char *newpref, void *data);
static void NotifyObserver(const char *newpref, void *data);
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
@ -260,3 +263,5 @@ private:
nsCOMPtr<nsIFile> mFile;
nsCString mRelativeToKey;
};
#endif

View File

@ -953,9 +953,7 @@ static nsresult pref_DoCallback(const char* changed_pref)
node->domain,
strlen(node->domain)) == 0 )
{
nsresult rv2 = (*node->func) (changed_pref, node->data);
if (NS_FAILED(rv2))
rv = rv2;
(*node->func) (changed_pref, node->data);
}
}

View File

@ -154,7 +154,7 @@ nsresult PREF_ClearAllUserPrefs();
** compilers were having problems with multiple definitions.
*/
#ifndef have_PrefChangedFunc_typedef
typedef nsresult (*PrefChangedFunc) (const char *, void *);
typedef void (*PrefChangedFunc) (const char *, void *);
#define have_PrefChangedFunc_typedef
#endif

View File

@ -5,6 +5,9 @@
/* Data shared between prefapi.c and nsPref.cpp */
#ifndef prefapi_private_data_h
#define prefapi_private_data_h
#include "mozilla/MemoryReporting.h"
extern PLDHashTable gHashTable;
@ -42,3 +45,5 @@ void pref_GetPrefFromEntry(PrefHashEntry *aHashEntry,
size_t
pref_SizeOfPrivateData(mozilla::MallocSizeOf aMallocSizeOf);
#endif

View File

@ -334,10 +334,9 @@ private:
private:
void Init();
static int OnChange(const char* aPrefName, void* aClosure)
static void OnChange(const char* aPrefName, void* aClosure)
{
static_cast<UserPrefs*>(aClosure)->MarkDirty();
return 0;
}
bool mInitialized;
@ -516,4 +515,4 @@ public:
} // namespace widget
} // namespace mozilla
#endif // mozilla_widget_WinMouseScrollHandler_h__
#endif // mozilla_widget_WinMouseScrollHandler_h__

View File

@ -384,7 +384,7 @@ nsXPLookAndFeel::InitColorFromPref(int32_t i)
}
// static
int
void
nsXPLookAndFeel::OnPrefChanged(const char* aPref, void* aClosure)
{
@ -395,25 +395,23 @@ nsXPLookAndFeel::OnPrefChanged(const char* aPref, void* aClosure)
for (i = 0; i < ArrayLength(sIntPrefs); ++i) {
if (prefName.Equals(sIntPrefs[i].name)) {
IntPrefChanged(&sIntPrefs[i]);
return 0;
return;
}
}
for (i = 0; i < ArrayLength(sFloatPrefs); ++i) {
if (prefName.Equals(sFloatPrefs[i].name)) {
FloatPrefChanged(&sFloatPrefs[i]);
return 0;
return;
}
}
for (i = 0; i < ArrayLength(sColorPrefs); ++i) {
if (prefName.Equals(sColorPrefs[i])) {
ColorPrefChanged(i, sColorPrefs[i]);
return 0;
return;
}
}
return 0;
}
//

View File

@ -91,7 +91,7 @@ protected:
virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult) = 0;
bool IsSpecialColor(ColorID aID, nscolor &aColor);
static int OnPrefChanged(const char* aPref, void* aClosure);
static void OnPrefChanged(const char* aPref, void* aClosure);
static bool sInitialized;
static nsLookAndFeelIntPref sIntPrefs[];

View File

@ -70,7 +70,7 @@ static const int32_t MAX_CALL_STACK_PCS = 400;
#endif
// PrefChangedFunc
int
void
PrefChanged(const char*, void*)
{
int32_t newval = Preferences::GetInt(kHangMonitorPrefName);
@ -88,8 +88,6 @@ PrefChanged(const char*, void*)
gTimeout = newval;
lock.Notify();
}
return 0;
}
void