Bug 1425559 - "content-child-will-shutdown" notification when the content process starts the shutting down, r=smaug

This commit is contained in:
Andrea Marchesini 2018-01-28 08:41:36 +01:00
Родитель dd2cca5c61
Коммит 6f1cf8bc7a
2 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -2936,6 +2936,19 @@ ContentChild::ForceKillTimerCallback(nsITimer* aTimer, void* aClosure)
mozilla::ipc::IPCResult
ContentChild::RecvShutdown()
{
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->NotifyObservers(static_cast<nsIContentChild*>(this),
"content-child-will-shutdown", nullptr);
}
ShutdownInternal();
return IPC_OK();
}
void
ContentChild::ShutdownInternal()
{
// If we receive the shutdown message from within a nested event loop, we want
// to wait for that event loop to finish. Otherwise we could prematurely
@ -2956,9 +2969,10 @@ ContentChild::RecvShutdown()
// then.
MessageLoop::current()->PostDelayedTask(
NewRunnableMethod(
"dom::ContentChild::RecvShutdown", this, &ContentChild::RecvShutdown),
"dom::ContentChild::RecvShutdown", this,
&ContentChild::ShutdownInternal),
100);
return IPC_OK();
return;
}
mShuttingDown = true;
@ -3005,8 +3019,6 @@ ContentChild::RecvShutdown()
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
sent ? NS_LITERAL_CSTRING("SendFinishShutdown (sent)")
: NS_LITERAL_CSTRING("SendFinishShutdown (failed)"));
return IPC_OK();
}
PBrowserOrId

Просмотреть файл

@ -727,6 +727,8 @@ private:
static void ForceKillTimerCallback(nsITimer* aTimer, void* aClosure);
void StartForceKillTimer();
void ShutdownInternal();
virtual void ActorDestroy(ActorDestroyReason why) override;
virtual void ProcessingError(Result aCode, const char* aReason) override;