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

This commit is contained in:
Ehsan Akhgari 2013-12-10 14:48:10 -05:00
Родитель 0421ca62bb
Коммит fa14d1e021
8 изменённых файлов: 26 добавлений и 19 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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')

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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