Bug 1043863 - AsyncShutdown for e10s;r=froydnj
--- a/toolkit/components/asyncshutdown/AsyncShutdown.jsm
+++ b/toolkit/components/asyncshutdown/AsyncShutdown.jsm
@@ -935,17 +935,21 @@ Barrier.prototype = Object.freeze({
// List of well-known phases
// Ideally, phases should be registered from the component that decides
// when they start/stop. For compatibility with existing startup/shutdown
// mechanisms, we register a few phases here.
+// Parent process
this.AsyncShutdown.profileChangeTeardown = getPhase("profile-change-teardown");
this.AsyncShutdown.profileBeforeChange = getPhase("profile-before-change");
this.AsyncShutdown.sendTelemetry = getPhase("profile-before-change2");
this.AsyncShutdown.webWorkersShutdown = getPhase("web-workers-shutdown");
this.AsyncShutdown.xpcomThreadsShutdown = getPhase("xpcom-threads-shutdown");
+// Child process
+this.AsyncShutdown.contentChildShutdown = getPhase("content-child-shutdown");
+
this.AsyncShutdown.Barrier = Barrier;
Object.freeze(this.AsyncShutdown);
--- a/toolkit/components/asyncshutdown/nsAsyncShutdown.js
+++ b/toolkit/components/asyncshutdown/nsAsyncShutdown.js
@@ -225,17 +225,18 @@ nsAsyncShutdownBarrier.prototype = {
function nsAsyncShutdownService() {
// Cache for the getters
for (let _k of
["profileBeforeChange",
"profileChangeTeardown",
"sendTelemetry",
"webWorkersShutdown",
- "xpcomThreadsShutdown"]) {
+ "xpcomThreadsShutdown",
+ "contentChildShutdown"]) {
let k = _k;
Object.defineProperty(this, k, {
configurable: true,
get: function() {
delete this[k];
let result = new nsAsyncShutdownClient(AsyncShutdown[k]);
Object.defineProperty(this, k, {
value: result
@@ -261,9 +262,8 @@ nsAsyncShutdownService.prototype = {
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
nsAsyncShutdownService,
nsAsyncShutdownBarrier,
nsAsyncShutdownClient,
]);
-
--- a/toolkit/components/asyncshutdown/nsIAsyncShutdown.idl
+++ b/toolkit/components/asyncshutdown/nsIAsyncShutdown.idl
@@ -155,17 +155,17 @@ interface nsIAsyncShutdownBarrier: nsISu
* The callback always receives NS_OK.
*/
void wait(in nsIAsyncShutdownCompletionCallback aOnReady);
};
/**
* A service that allows registering shutdown-time dependencies.
*/
-[scriptable, uuid(8a9a0859-0404-4d50-9e76-10a4f56dfb51)]
+[scriptable, uuid(9f37e55f-8be2-4797-9926-70c513e45289)]
interface nsIAsyncShutdownService: nsISupports {
/**
* Create a new barrier.
*
* By convention, the name should respect the following format:
* "MyModuleName: Doing something while it's time"
* e.g.
* "OS.File: Waiting for clients to flush before shutting down"
@@ -195,13 +195,18 @@ interface nsIAsyncShutdownService: nsISu
* Barrier for notification web-workers-shutdown.
*/
readonly attribute nsIAsyncShutdownClient webWorkersShutdown;
/**
* Barrier for notification xpcom-threads-shutdown.
*/
readonly attribute nsIAsyncShutdownClient xpcomThreadsShutdown;
+
+ /**
+ * Barrier for notification content-child-shutdown (content child only).
+ */
+ readonly attribute nsIAsyncShutdownClient contentChildShutdown;
};
%{C++
#define NS_ASYNCSHUTDOWNSERVICE_CONTRACTID "@mozilla.org/async-shutdown-service;1"
%}