mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1416613 - Improve comments about pref IPC. r=glandium
These would have saved me some time last week when I was figuring out how this stuff works. MozReview-Commit-ID: DUhxGDht6xT
This commit is contained in:
parent
03a781381b
commit
994d5726c4
@ -1296,7 +1296,11 @@ ContentParent::Init()
|
||||
obs->AddObserver(this, sObserverTopics[i], false);
|
||||
}
|
||||
}
|
||||
|
||||
// Register ContentParent as an observer for changes to any pref whose prefix
|
||||
// matches the empty string, i.e. all of them.
|
||||
Preferences::AddStrongObserver(this, "");
|
||||
|
||||
if (obs) {
|
||||
nsAutoString cpId;
|
||||
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
|
||||
@ -2773,14 +2777,14 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||
NS_LITERAL_STRING("-no-forward"))) {
|
||||
Unused << SendFlushMemory(nsDependentString(aData));
|
||||
}
|
||||
// listening for remotePrefs...
|
||||
else if (!strcmp(aTopic, "nsPref:changed")) {
|
||||
// Some prefs are not useful in the content process.
|
||||
// A pref changed. If it's not on the blacklist, inform child processes.
|
||||
#define BLACKLIST_ENTRY(s) { s, (sizeof(s)/sizeof(char16_t)) - 1 }
|
||||
struct BlacklistEntry {
|
||||
const char16_t* mPrefBranch;
|
||||
size_t mLen;
|
||||
};
|
||||
// These prefs are not useful in child processes.
|
||||
static const BlacklistEntry sContentPrefBranchBlacklist[] = {
|
||||
BLACKLIST_ENTRY(u"app.update.lastUpdateTime."),
|
||||
BLACKLIST_ENTRY(u"datareporting.policy."),
|
||||
|
@ -289,13 +289,16 @@ public:
|
||||
const char* aPref,
|
||||
float aDefault = 0.0f);
|
||||
|
||||
// Used to synchronise preferences between chrome and content processes.
|
||||
// When a content process is created these methods are used to pass prefs in
|
||||
// bulk from the parent process.
|
||||
static void GetPreferences(InfallibleTArray<PrefSetting>* aPrefs);
|
||||
static void SetInitPreferences(nsTArray<PrefSetting>* aPrefs);
|
||||
|
||||
// When a pref is changed in the parent process, these methods are used to
|
||||
// pass the update to content processes.
|
||||
static void GetPreference(PrefSetting* aPref);
|
||||
static void SetPreference(const PrefSetting& aPref);
|
||||
|
||||
static void SetInitPreferences(nsTArray<PrefSetting>* aPrefs);
|
||||
|
||||
#ifdef DEBUG
|
||||
static void SetInitPhase(pref_initPhase phase);
|
||||
static pref_initPhase InitPhase();
|
||||
|
Loading…
Reference in New Issue
Block a user