Bug 1246828 - Part 1: Add an additional notification profile-before-change3 and update telemetry sending code to use it; r=asuth

This commit is contained in:
Jan Varga 2016-06-15 11:48:39 +01:00
parent 7dfaffa147
commit b85865d615
8 changed files with 9 additions and 5 deletions

View File

@ -1316,7 +1316,7 @@ if (isGonk) {
Services.obs.addObserver(function resetProfile(subject, topic, data) {
Services.obs.removeObserver(resetProfile, topic);
// Listening for 'profile-before-change2' which is late in the shutdown
// Listening for 'profile-before-change3' which is late in the shutdown
// sequence, but still has xpcom access.
Services.obs.addObserver(function clearProfile(subject, topic, data) {
Services.obs.removeObserver(clearProfile, topic);
@ -1357,7 +1357,7 @@ Services.obs.addObserver(function resetProfile(subject, topic, data) {
}
}
},
'profile-before-change2', false);
'profile-before-change3', false);
let appStartup = Cc['@mozilla.org/toolkit/app-startup;1']
.getService(Ci.nsIAppStartup);

View File

@ -129,6 +129,7 @@ PowerManagerService::SyncProfile()
obsServ->NotifyObservers(nullptr, "profile-change-teardown", context.get());
obsServ->NotifyObservers(nullptr, "profile-before-change", context.get());
obsServ->NotifyObservers(nullptr, "profile-before-change2", context.get());
obsServ->NotifyObservers(nullptr, "profile-before-change3", context.get());
}
}

View File

@ -1021,7 +1021,7 @@ if (!isContent) {
this.AsyncShutdown.profileChangeTeardown = getPhase("profile-change-teardown");
this.AsyncShutdown.profileBeforeChange = getPhase("profile-before-change");
this.AsyncShutdown.placesClosingInternalConnection = getPhase("places-will-close-connection");
this.AsyncShutdown.sendTelemetry = getPhase("profile-before-change2");
this.AsyncShutdown.sendTelemetry = getPhase("profile-before-change3");
}
// Notifications that fire in the parent and content process, but should

View File

@ -193,7 +193,7 @@ interface nsIAsyncShutdownService: nsISupports {
readonly attribute nsIAsyncShutdownClient quitApplicationGranted;
/**
* Barrier for notification profile-before-change2.
* Barrier for notification profile-before-change3.
*/
readonly attribute nsIAsyncShutdownClient sendTelemetry;

View File

@ -249,7 +249,7 @@ List of phases
``AsyncShutdown.sendTelemetry``
The client capability for clients wishing to block asynchronously
during observer notification "profile-before-change2". Once the
during observer notification "profile-before-change3". Once the
barrier is resolved, Telemetry must stop its operations.
``AsyncShutdown.webWorkersShutdown``

View File

@ -1082,6 +1082,7 @@ nsXREDirProvider::DoShutdown()
// Phase 3: Notify observers of a profile change
obsSvc->NotifyObservers(nullptr, "profile-before-change", kShutdownPersist);
obsSvc->NotifyObservers(nullptr, "profile-before-change2", kShutdownPersist);
obsSvc->NotifyObservers(nullptr, "profile-before-change3", kShutdownPersist);
}
mProfileNotified = false;
}

View File

@ -4747,6 +4747,7 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
obsServ->NotifyObservers(nullptr, "profile-change-teardown", context.get());
obsServ->NotifyObservers(nullptr, "profile-before-change", context.get());
obsServ->NotifyObservers(nullptr, "profile-before-change2", context.get());
obsServ->NotifyObservers(nullptr, "profile-before-change3", context.get());
// Then a controlled but very quick exit.
_exit(0);
}

View File

@ -120,6 +120,7 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2
MOZ_ALWAYS_SUCCEEDS(os->NotifyObservers(nullptr, "profile-change-teardown", nullptr));
MOZ_ALWAYS_SUCCEEDS(os->NotifyObservers(nullptr, "profile-before-change", nullptr));
MOZ_ALWAYS_SUCCEEDS(os->NotifyObservers(nullptr, "profile-before-change2", nullptr));
MOZ_ALWAYS_SUCCEEDS(os->NotifyObservers(nullptr, "profile-before-change3", nullptr));
}
if (NS_FAILED(mProfD->Remove(true))) {