Bug 1043863 - AsyncShutdown for e10s;r=froydnj draft
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Thu, 23 Apr 2015 11:31:19 +0200
changeset 269027 7506504483f91c405ba26d71e2244baefe09d1e6
parent 268846 f8d21278244bc0531513131f85a45e5736207ae1
child 269028 60b83c68ad5520c7bd40bea8c3aaca9c41681f00
push id2440
push userdteller@mozilla.com
push dateMon, 01 Jun 2015 21:16:18 +0000
reviewersfroydnj
bugs1043863
milestone41.0a1
Bug 1043863 - AsyncShutdown for e10s;r=froydnj
toolkit/components/asyncshutdown/AsyncShutdown.jsm
toolkit/components/asyncshutdown/nsAsyncShutdown.js
toolkit/components/asyncshutdown/nsIAsyncShutdown.idl
--- 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"
 %}