зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1138520 - Diagnostic patch for shutdown hangs (r=jchen)
This commit is contained in:
Родитель
5389bbbf54
Коммит
3c8a068364
|
@ -1881,6 +1881,9 @@ struct DelayedDeleteContentParentTask : public nsRunnable
|
|||
void
|
||||
ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ChildShutdownState"),
|
||||
NS_LITERAL_CSTRING("ActorDestroy"));
|
||||
|
||||
if (mForceKillTimer) {
|
||||
mForceKillTimer->Cancel();
|
||||
mForceKillTimer = nullptr;
|
||||
|
@ -2042,6 +2045,12 @@ ContentParent::NotifyTabDestroying(PBrowserParent* aTab)
|
|||
StartForceKillTimer();
|
||||
}
|
||||
|
||||
static int32_t
|
||||
ForceKillTimeout()
|
||||
{
|
||||
return Preferences::GetInt("dom.ipc.tabs.shutdownTimeoutSecs", 5);
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::StartForceKillTimer()
|
||||
{
|
||||
|
@ -2049,8 +2058,7 @@ ContentParent::StartForceKillTimer()
|
|||
return;
|
||||
}
|
||||
|
||||
int32_t timeoutSecs =
|
||||
Preferences::GetInt("dom.ipc.tabs.shutdownTimeoutSecs", 5);
|
||||
int32_t timeoutSecs = ForceKillTimeout();
|
||||
if (timeoutSecs > 0) {
|
||||
mForceKillTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
MOZ_ASSERT(mForceKillTimer);
|
||||
|
@ -2882,13 +2890,25 @@ ContentParent::Observe(nsISupports* aSubject,
|
|||
{
|
||||
if (mSubprocess && (!strcmp(aTopic, "profile-before-change") ||
|
||||
!strcmp(aTopic, "xpcom-shutdown"))) {
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ChildShutdownState"),
|
||||
NS_LITERAL_CSTRING("Begin"));
|
||||
|
||||
// Okay to call ShutDownProcess multiple times.
|
||||
ShutDownProcess(SEND_SHUTDOWN_MESSAGE);
|
||||
|
||||
int32_t timeout = ForceKillTimeout();
|
||||
|
||||
// Make sure we have a KillHard timer before we start waiting.
|
||||
MOZ_RELEASE_ASSERT(!timeout || !mIPCOpen || mCalledKillHard || mForceKillTimer);
|
||||
|
||||
// Wait for shutdown to complete, so that we receive any shutdown
|
||||
// data (e.g. telemetry) from the child before we quit.
|
||||
// This loop terminate prematurely based on mForceKillTimer.
|
||||
while (mIPCOpen) {
|
||||
// If we clear the KillHard timer, it should only be because we
|
||||
// called KillHard. In that case, ActorDestroy should happen
|
||||
// momentarily.
|
||||
MOZ_RELEASE_ASSERT(!timeout || mCalledKillHard || mForceKillTimer);
|
||||
NS_ProcessNextEvent(nullptr, true);
|
||||
}
|
||||
NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess");
|
||||
|
@ -3335,6 +3355,9 @@ ContentParent::ForceKillTimerCallback(nsITimer* aTimer, void* aClosure)
|
|||
void
|
||||
ContentParent::KillHard(const char* aReason)
|
||||
{
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ChildShutdownState"),
|
||||
NS_LITERAL_CSTRING("KillHard"));
|
||||
|
||||
// On Windows, calling KillHard multiple times causes problems - the
|
||||
// process handle becomes invalid on the first call, causing a second call
|
||||
// to crash our process - more details in bug 890840.
|
||||
|
|
|
@ -318,4 +318,4 @@ user_pref("network.proxy.pac_generator", false);
|
|||
// Make tests run consistently on DevEdition (which has a lightweight theme
|
||||
// selected by default).
|
||||
user_pref("lightweightThemes.selectedThemeID", "");
|
||||
user_pref("browser.devedition.theme.enabled", false);
|
||||
user_pref("browser.devedition.theme.enabled", false);
|
||||
|
|
Загрузка…
Ссылка в новой задаче