зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1510934 - Change ContentParent's alive/dead tracking to launching/alive/dead. r=mrbkap
We need content processes that are created but not finished launching (not "alive" yet) to be treated differently from ones that have exited (no longer "alive"), so the boolean mIsAlive is expanded to a 3-state enumeration, which could be expanded more in the future if needed. (This is similar to GeckoChildProcessHost::mProcessState, but it's synchronized with the rest of the ContentParent's state, which can lag the GeckoChildProcessHost state due to runnable dispatch.) This patch also removes mIsAvailable/IsAvailable/MarkAsTroubled, which are unused as of bug 1459212. Differential Revision: https://phabricator.services.mozilla.com/D14089 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a3aee981a7
Коммит
4213a3e9b6
|
@ -1509,14 +1509,9 @@ void ContentParent::RemoveFromList() {
|
|||
}
|
||||
}
|
||||
|
||||
void ContentParent::MarkAsTroubled() {
|
||||
RemoveFromList();
|
||||
mIsAvailable = false;
|
||||
}
|
||||
|
||||
void ContentParent::MarkAsDead() {
|
||||
MarkAsTroubled();
|
||||
mIsAlive = false;
|
||||
RemoveFromList();
|
||||
mLifecycleState = LifecycleState::DEAD;
|
||||
}
|
||||
|
||||
void ContentParent::OnChannelError() {
|
||||
|
@ -1733,7 +1728,7 @@ bool ContentParent::TryToRecycle() {
|
|||
// This life time check should be replaced by a memory health check (memory
|
||||
// usage + fragmentation).
|
||||
const double kMaxLifeSpan = 5;
|
||||
if (mShutdownPending || mCalledKillHard || !IsAvailable() ||
|
||||
if (mShutdownPending || mCalledKillHard || !IsAlive() ||
|
||||
!mRemoteType.EqualsLiteral(DEFAULT_REMOTE_TYPE) ||
|
||||
(TimeStamp::Now() - mActivateTS).ToSeconds() > kMaxLifeSpan ||
|
||||
!PreallocatedProcessManager::Provide(this)) {
|
||||
|
@ -1760,8 +1755,8 @@ bool ContentParent::ShouldKeepProcessAlive() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
// If we have already been marked as troubled/dead, don't prevent shutdown.
|
||||
if (!IsAvailable()) {
|
||||
// If we have already been marked as dead, don't prevent shutdown.
|
||||
if (!IsAlive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2244,7 +2239,7 @@ void ContentParent::LaunchSubprocessInternal(
|
|||
CodeCoverageHandler::Get()->GetMutexHandle(procId));
|
||||
#endif
|
||||
|
||||
mIsAlive = true;
|
||||
mLifecycleState = LifecycleState::ALIVE;
|
||||
InitInternal(aInitialPriority);
|
||||
|
||||
ContentProcessManager::GetSingleton()->AddContentProcess(this);
|
||||
|
@ -2335,8 +2330,7 @@ ContentParent::ContentParent(ContentParent* aOpener,
|
|||
mJSPluginID(aJSPluginID),
|
||||
mRemoteWorkerActors(0),
|
||||
mNumDestroyingTabs(0),
|
||||
mIsAvailable(true),
|
||||
mIsAlive(false),
|
||||
mLifecycleState(LifecycleState::LAUNCHING),
|
||||
mIsForBrowser(!mRemoteType.IsEmpty()),
|
||||
mRecordReplayState(aRecordReplayState),
|
||||
mRecordingFile(aRecordingFile),
|
||||
|
@ -2736,7 +2730,9 @@ void ContentParent::InitInternal(ProcessPriority aInitialPriority) {
|
|||
MaybeEnableRemoteInputEventQueue();
|
||||
}
|
||||
|
||||
bool ContentParent::IsAlive() const { return mIsAlive; }
|
||||
bool ContentParent::IsAlive() const {
|
||||
return mLifecycleState == LifecycleState::ALIVE;
|
||||
}
|
||||
|
||||
int32_t ContentParent::Pid() const {
|
||||
if (!mSubprocess || !mSubprocess->GetChildProcessHandle()) {
|
||||
|
@ -3045,7 +3041,7 @@ ContentParent::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess");
|
||||
}
|
||||
|
||||
if (!mIsAlive || !mSubprocess) return NS_OK;
|
||||
if (!IsAlive() || !mSubprocess) return NS_OK;
|
||||
|
||||
// listening for memory pressure event
|
||||
if (!strcmp(aTopic, "memory-pressure")) {
|
||||
|
|
|
@ -223,7 +223,7 @@ class ContentParent final : public PContentParent,
|
|||
|
||||
ContentParentIterator begin() {
|
||||
// Move the cursor to the first element that matches the policy.
|
||||
while (mPolicy != eAll && mCurrent && !mCurrent->mIsAlive) {
|
||||
while (mPolicy != eAll && mCurrent && !mCurrent->IsAlive()) {
|
||||
mCurrent = mCurrent->LinkedListElement<ContentParent>::getNext();
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ class ContentParent final : public PContentParent,
|
|||
MOZ_ASSERT(mCurrent);
|
||||
do {
|
||||
mCurrent = mCurrent->LinkedListElement<ContentParent>::getNext();
|
||||
} while (mPolicy != eAll && mCurrent && !mCurrent->mIsAlive);
|
||||
} while (mPolicy != eAll && mCurrent && !mCurrent->IsAlive());
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -360,7 +360,9 @@ class ContentParent final : public PContentParent,
|
|||
|
||||
void UpdateCookieStatus(nsIChannel* aChannel);
|
||||
|
||||
bool IsAvailable() const { return mIsAvailable; }
|
||||
bool IsLaunching() const {
|
||||
return mLifecycleState == LifecycleState::LAUNCHING;
|
||||
}
|
||||
bool IsAlive() const override;
|
||||
|
||||
virtual bool IsForBrowser() const override { return mIsForBrowser; }
|
||||
|
@ -1242,13 +1244,19 @@ class ContentParent final : public PContentParent,
|
|||
// sequence. Precisely, how many TabParents have called
|
||||
// NotifyTabDestroying() but not called NotifyTabDestroyed().
|
||||
int32_t mNumDestroyingTabs;
|
||||
// True only while this process is in "good health" and may be used for
|
||||
// new remote tabs.
|
||||
bool mIsAvailable;
|
||||
// True only while remote content is being actively used from this process.
|
||||
// After mIsAlive goes to false, some previously scheduled IPC traffic may
|
||||
// still pass through.
|
||||
bool mIsAlive;
|
||||
|
||||
// The process starts in the LAUNCHING state, and transitions to
|
||||
// ALIVE once it can accept IPC messages. It remains ALIVE only
|
||||
// while remote content is being actively used from this process.
|
||||
// After the state becaomes DEAD, some previously scheduled IPC
|
||||
// traffic may still pass through.
|
||||
enum class LifecycleState : uint8_t {
|
||||
LAUNCHING,
|
||||
ALIVE,
|
||||
DEAD,
|
||||
};
|
||||
|
||||
LifecycleState mLifecycleState;
|
||||
|
||||
bool mShuttingDown;
|
||||
bool mIsForBrowser;
|
||||
|
|
Загрузка…
Ссылка в новой задаче