mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 1591877
- Share the same cached pref value of dom.storage.next_gen across all relevant processes; r=dom-storage-reviewers,jstutte a=pascalc
Differential Revision: https://phabricator.services.mozilla.com/D119711
This commit is contained in:
parent
111d671d77
commit
2ee8ae7b02
@ -4359,6 +4359,13 @@ mozilla::ipc::IPCResult ContentChild::RecvDecoderSupportedMimeTypes(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvInitNextGenLocalStorageEnabled(
|
||||
const bool& aEnabled) {
|
||||
mozilla::dom::RecvInitNextGenLocalStorageEnabled(aEnabled);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
/* static */ void ContentChild::DispatchBeforeUnloadToSubtree(
|
||||
BrowsingContext* aStartingAt,
|
||||
const DispatchBeforeUnloadToSubtreeResolver& aResolver) {
|
||||
|
@ -820,6 +820,9 @@ class ContentChild final : public PContentChild,
|
||||
mozilla::ipc::IPCResult RecvDecoderSupportedMimeTypes(
|
||||
nsTArray<nsCString>&& aSupportedTypes);
|
||||
|
||||
mozilla::ipc::IPCResult RecvInitNextGenLocalStorageEnabled(
|
||||
const bool& aEnabled);
|
||||
|
||||
public:
|
||||
static void DispatchBeforeUnloadToSubtree(
|
||||
BrowsingContext* aStartingAt,
|
||||
|
@ -1715,6 +1715,8 @@ void ContentParent::Init() {
|
||||
Unused << NS_WARN_IF(!SendPreferenceUpdate(pref));
|
||||
}
|
||||
mQueuedPrefs.Clear();
|
||||
|
||||
Unused << SendInitNextGenLocalStorageEnabled(NextGenLocalStorageEnabled());
|
||||
}
|
||||
|
||||
void ContentParent::MaybeBeginShutDown(uint32_t aExpectedBrowserCount,
|
||||
|
@ -964,6 +964,11 @@ child:
|
||||
// Send the list of the supported mimetypes in the given process. GeckoView-specific
|
||||
async DecoderSupportedMimeTypes(nsCString[] supportedTypes);
|
||||
|
||||
// Used to initialize the global variable in content processes with the
|
||||
// latched value in the parent process. See dom/LocalStorageCommon.h for more
|
||||
// details.
|
||||
async InitNextGenLocalStorageEnabled(bool enabled);
|
||||
|
||||
parent:
|
||||
|
||||
async SynchronizeLayoutHistoryState(MaybeDiscardedBrowsingContext aContext,
|
||||
|
@ -72,14 +72,15 @@ bool NextGenLocalStorageEnabled() {
|
||||
return !!gNextGenLocalStorageEnabled;
|
||||
}
|
||||
|
||||
return CachedNextGenLocalStorageEnabled();
|
||||
}
|
||||
|
||||
void RecvInitNextGenLocalStorageEnabled(const bool aEnabled) {
|
||||
MOZ_ASSERT(!XRE_IsParentProcess());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(gNextGenLocalStorageEnabled == -1);
|
||||
|
||||
if (gNextGenLocalStorageEnabled == -1) {
|
||||
bool enabled = Preferences::GetBool("dom.storage.next_gen", false);
|
||||
gNextGenLocalStorageEnabled = enabled ? 1 : 0;
|
||||
}
|
||||
|
||||
return !!gNextGenLocalStorageEnabled;
|
||||
gNextGenLocalStorageEnabled = aEnabled ? 1 : 0;
|
||||
}
|
||||
|
||||
bool CachedNextGenLocalStorageEnabled() {
|
||||
|
@ -230,14 +230,23 @@ void MaybeEnableNextGenLocalStorage();
|
||||
|
||||
/**
|
||||
* A check of LSNG being enabled, the value is latched once initialized so
|
||||
* changing the preference during runtime has no effect.
|
||||
* May be called on any thread in the parent process, but you should call
|
||||
* changing the preference during runtime has no effect. May be called on any
|
||||
* thread in the parent process, but you should call
|
||||
* CachedNextGenLocalStorageEnabled if you know that NextGenLocalStorageEnabled
|
||||
* was already called because it is faster.
|
||||
* May be called on the main thread only in a content process.
|
||||
* was already called because it is faster. May be called on any thread in
|
||||
* content processes, but you should call CachedNextGenLocalStorageEnabled
|
||||
* directly if you know you are in a content process because it is slightly
|
||||
* faster.
|
||||
*/
|
||||
bool NextGenLocalStorageEnabled();
|
||||
|
||||
/**
|
||||
* Called by ContentChild during content process initialization to initialize
|
||||
* the global variable in the content process with the latched value in the
|
||||
* parent process."
|
||||
*/
|
||||
void RecvInitNextGenLocalStorageEnabled(const bool aEnabled);
|
||||
|
||||
/**
|
||||
* Cached any-thread version of NextGenLocalStorageEnabled().
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user