зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1752332: Tell ShouldSyncPreference if the destination is a web content process r=KrisWright
A couple places where it might be a web content process still pass 'false' - this will be corrected in a later patch. Depends on D141410 Differential Revision: https://phabricator.services.mozilla.com/D141411
This commit is contained in:
Родитель
4ef13ee7f8
Коммит
ef6d930532
|
@ -3641,7 +3641,8 @@ ContentParent::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
NS_LossyConvertUTF16toASCII strData(aData);
|
||||
|
||||
// A pref changed. If it is useful to do so, inform child processes.
|
||||
if (!ShouldSyncPreference(strData.Data())) {
|
||||
if (!ShouldSyncPreference(strData.Data(),
|
||||
/* will be fixed later */ false)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ void RDDProcessManager::OnPreferenceChange(const char16_t* aData) {
|
|||
NS_LossyConvertUTF16toASCII strData(aData);
|
||||
|
||||
// A pref changed. If it is useful to do so, inform child processes.
|
||||
if (!ShouldSyncPreference(strData.Data())) {
|
||||
if (!ShouldSyncPreference(strData.Data(), false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ void GPUProcessManager::OnPreferenceChange(const char16_t* aData) {
|
|||
NS_LossyConvertUTF16toASCII strData(aData);
|
||||
|
||||
// A pref changed. If it is useful to do so, inform child processes.
|
||||
if (!ShouldSyncPreference(strData.Data())) {
|
||||
if (!ShouldSyncPreference(strData.Data(), false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ void VRProcessManager::OnPreferenceChange(const char16_t* aData) {
|
|||
NS_LossyConvertUTF16toASCII strData(aData);
|
||||
|
||||
// A pref changed. If it is useful to do so, inform child processes.
|
||||
if (!ShouldSyncPreference(strData.Data())) {
|
||||
if (!ShouldSyncPreference(strData.Data(), false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ void SetThisProcessName(const char* aName);
|
|||
class SharedPreferenceSerializer final {
|
||||
public:
|
||||
explicit SharedPreferenceSerializer(
|
||||
std::function<bool(const char*)>&& aShouldSerializeFn);
|
||||
std::function<bool(const char*, bool)>&& aShouldSerializeFn);
|
||||
SharedPreferenceSerializer(SharedPreferenceSerializer&& aOther);
|
||||
~SharedPreferenceSerializer();
|
||||
|
||||
|
@ -48,7 +48,7 @@ class SharedPreferenceSerializer final {
|
|||
size_t mPrefsLength;
|
||||
UniqueFileHandle mPrefMapHandle;
|
||||
UniqueFileHandle mPrefsHandle;
|
||||
std::function<bool(const char*)> mShouldSerializeFn;
|
||||
std::function<bool(const char*, bool)> mShouldSerializeFn;
|
||||
};
|
||||
|
||||
class SharedPreferenceDeserializer final {
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace mozilla {
|
|||
namespace ipc {
|
||||
|
||||
SharedPreferenceSerializer::SharedPreferenceSerializer(
|
||||
std::function<bool(const char*)>&& aShouldSerializeFn)
|
||||
std::function<bool(const char*, bool)>&& aShouldSerializeFn)
|
||||
: mPrefMapSize(0), mPrefsLength(0), mShouldSerializeFn(aShouldSerializeFn) {
|
||||
MOZ_COUNT_CTOR(SharedPreferenceSerializer);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ void UtilityProcessManager::OnPreferenceChange(const char16_t* aData) {
|
|||
NS_LossyConvertUTF16toASCII strData(aData);
|
||||
|
||||
// A pref changed. If it is useful to do so, inform child processes.
|
||||
if (!ShouldSyncPreference(strData.Data())) {
|
||||
if (!ShouldSyncPreference(strData.Data(), false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -3588,7 +3588,7 @@ NS_IMPL_ISUPPORTS(Preferences, nsIPrefService, nsIObserver, nsIPrefBranch,
|
|||
/* static */
|
||||
void Preferences::SerializePreferences(
|
||||
nsCString& aStr,
|
||||
const std::function<bool(const char*)>& aShouldSerializeFn) {
|
||||
const std::function<bool(const char*, bool)>& aShouldSerializeFn) {
|
||||
MOZ_RELEASE_ASSERT(InitStaticMembers());
|
||||
|
||||
aStr.Truncate();
|
||||
|
@ -3596,7 +3596,9 @@ void Preferences::SerializePreferences(
|
|||
for (auto iter = HashTable()->iter(); !iter.done(); iter.next()) {
|
||||
Pref* pref = iter.get().get();
|
||||
if (!pref->IsTypeNone() && pref->HasAdvisablySizedValues()) {
|
||||
pref->SerializeAndAppend(aStr, !aShouldSerializeFn(pref->Name()));
|
||||
pref->SerializeAndAppend(
|
||||
aStr, !aShouldSerializeFn(pref->Name(),
|
||||
/* will be fixed later */ false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5673,7 +5675,7 @@ namespace mozilla {
|
|||
|
||||
void UnloadPrefsModule() { Preferences::Shutdown(); }
|
||||
|
||||
bool ShouldSyncPreference(const char* aPref) {
|
||||
bool ShouldSyncPreference(const char* aPref, bool aIsDestWebContentProcess) {
|
||||
#define PREF_LIST_ENTRY(s) \
|
||||
{ s, (sizeof(s) / sizeof(char)) - 1 }
|
||||
struct PrefListEntry {
|
||||
|
|
|
@ -401,7 +401,7 @@ class Preferences final : public nsIPrefService,
|
|||
// prefs in bulk from the parent process, via shared memory.
|
||||
static void SerializePreferences(
|
||||
nsCString& aStr,
|
||||
const std::function<bool(const char*)>& aShouldSerializeFn);
|
||||
const std::function<bool(const char*, bool)>& aShouldSerializeFn);
|
||||
static void DeserializePreferences(char* aStr, size_t aPrefsLen);
|
||||
|
||||
static mozilla::ipc::FileDescriptor EnsureSnapshot(size_t* aSize);
|
||||
|
@ -532,7 +532,7 @@ class Preferences final : public nsIPrefService,
|
|||
static bool InitStaticMembers();
|
||||
};
|
||||
|
||||
bool ShouldSyncPreference(const char* aPref);
|
||||
bool ShouldSyncPreference(const char* aPref, bool aIsDestWebContentProcess);
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ TEST(PrefsBasics, Serialize)
|
|||
|
||||
nsCString str;
|
||||
Preferences::SerializePreferences(
|
||||
str, [](const char* aPref) -> bool { return false; });
|
||||
str, [](const char* aPref, bool) -> bool { return false; });
|
||||
ASSERT_STREQ(str.Data(), "");
|
||||
|
||||
Preferences::SerializePreferences(str, [](const char* aPref) -> bool {
|
||||
Preferences::SerializePreferences(str, [](const char* aPref, bool) -> bool {
|
||||
return strncmp(aPref, "foo.bool", 8) == 0;
|
||||
});
|
||||
ASSERT_STREQ(str.Data(), "B-:8/foo.bool:T:F\n");
|
||||
|
|
Загрузка…
Ссылка в новой задаче