зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1694036: Fix process-start delay and add pref for startup delay r=nika
Differential Revision: https://phabricator.services.mozilla.com/D105878
This commit is contained in:
Родитель
f508b30e41
Коммит
36fd177839
|
@ -58,7 +58,7 @@ class PreallocatedProcessManagerImpl final : public nsIObserver {
|
|||
void Init();
|
||||
|
||||
bool CanAllocate();
|
||||
void AllocateAfterDelay();
|
||||
void AllocateAfterDelay(bool aStartup = false);
|
||||
void AllocateOnIdle();
|
||||
void AllocateNow();
|
||||
|
||||
|
@ -204,7 +204,7 @@ already_AddRefed<ContentParent> PreallocatedProcessManagerImpl::Take(
|
|||
|
||||
// We took a preallocated process. Let's try to start up a new one
|
||||
// soon.
|
||||
AllocateOnIdle();
|
||||
AllocateAfterDelay();
|
||||
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||
("Use prealloc process %p", process.get()));
|
||||
}
|
||||
|
@ -224,12 +224,14 @@ void PreallocatedProcessManagerImpl::Erase(ContentParent* aParent) {
|
|||
|
||||
void PreallocatedProcessManagerImpl::Enable(uint32_t aProcesses) {
|
||||
mNumberPreallocs = aProcesses;
|
||||
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||
("Enabling preallocation: %u", aProcesses));
|
||||
if (mEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
mEnabled = true;
|
||||
AllocateAfterDelay();
|
||||
AllocateAfterDelay(/* aStartup */ true);
|
||||
}
|
||||
|
||||
void PreallocatedProcessManagerImpl::AddBlocker(ContentParent* aParent) {
|
||||
|
@ -267,15 +269,18 @@ bool PreallocatedProcessManagerImpl::CanAllocate() {
|
|||
!ContentParent::IsMaxProcessCountReached(DEFAULT_REMOTE_TYPE));
|
||||
}
|
||||
|
||||
void PreallocatedProcessManagerImpl::AllocateAfterDelay() {
|
||||
void PreallocatedProcessManagerImpl::AllocateAfterDelay(bool aStartup) {
|
||||
if (!mEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
long delay = aStartup ? StaticPrefs::dom_ipc_processPrelaunch_startupDelayMs()
|
||||
: StaticPrefs::dom_ipc_processPrelaunch_delayMs();
|
||||
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||
("Starting delayed process start, delay=%ld", delay));
|
||||
NS_DelayedDispatchToCurrentThread(
|
||||
NewRunnableMethod("PreallocatedProcessManagerImpl::AllocateOnIdle", this,
|
||||
&PreallocatedProcessManagerImpl::AllocateOnIdle),
|
||||
StaticPrefs::dom_ipc_processPrelaunch_delayMs());
|
||||
delay);
|
||||
}
|
||||
|
||||
void PreallocatedProcessManagerImpl::AllocateOnIdle() {
|
||||
|
@ -283,6 +288,8 @@ void PreallocatedProcessManagerImpl::AllocateOnIdle() {
|
|||
return;
|
||||
}
|
||||
|
||||
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||
("Starting process allocate on idle"));
|
||||
NS_DispatchToCurrentThreadQueue(
|
||||
NewRunnableMethod("PreallocatedProcessManagerImpl::AllocateNow", this,
|
||||
&PreallocatedProcessManagerImpl::AllocateNow),
|
||||
|
@ -290,6 +297,8 @@ void PreallocatedProcessManagerImpl::AllocateOnIdle() {
|
|||
}
|
||||
|
||||
void PreallocatedProcessManagerImpl::AllocateNow() {
|
||||
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||
("Trying to start process now"));
|
||||
if (!CanAllocate()) {
|
||||
if (mEnabled && !sShutdown && IsEmpty() && sNumBlockers > 0) {
|
||||
// If it's too early to allocate a process let's retry later.
|
||||
|
|
|
@ -2113,6 +2113,13 @@
|
|||
value: 1000
|
||||
mirror: always
|
||||
|
||||
- name: dom.ipc.processPrelaunch.startupDelayMs
|
||||
type: uint32_t
|
||||
# delay starting content processes for a short time after browser start
|
||||
# to provide time for the UI to come up
|
||||
value: 1000
|
||||
mirror: always
|
||||
|
||||
# Process preallocation cache
|
||||
# Only used in fission; in e10s we use 1 always
|
||||
- name: dom.ipc.processPrelaunch.fission.number
|
||||
|
|
Загрузка…
Ссылка в новой задаче