Bug 1312880 - Remove sync message when starting up RemoteAddonsChild. r?billm draft
authorMike Conley <mconley@mozilla.com>
Fri, 28 Oct 2016 10:16:00 -0400
changeset 430981 4eeb0c0496ae3d76413666356b67f209a60bb2d9
parent 429179 c6ccd71126ff514bfc44b53e2217562e29a0cc38
child 431016 8f00fe77bf505b1f9ac2701d2b24735b17537319
push id33963
push usermconley@mozilla.com
push dateFri, 28 Oct 2016 14:16:26 +0000
reviewersbillm
bugs1312880
milestone52.0a1
Bug 1312880 - Remove sync message when starting up RemoteAddonsChild. r?billm MozReview-Commit-ID: LHNXZOphynk
toolkit/components/addoncompat/RemoteAddonsChild.jsm
toolkit/components/addoncompat/RemoteAddonsParent.jsm
--- a/toolkit/components/addoncompat/RemoteAddonsChild.jsm
+++ b/toolkit/components/addoncompat/RemoteAddonsChild.jsm
@@ -44,18 +44,17 @@ function setDefault(dict, key, default_)
 //
 // In the child, clients can watch for changes to all paths that start
 // with a given component.
 var NotificationTracker = {
   init: function() {
     let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]
                .getService(Ci.nsISyncMessageSender);
     cpmm.addMessageListener("Addons:ChangeNotification", this);
-    let [paths] = cpmm.sendSyncMessage("Addons:GetNotifications");
-    this._paths = paths;
+    this._paths = cpmm.initialProcessData.remoteAddonsNotificationPaths;
     this._registered = new Map();
     this._watchers = {};
   },
 
   receiveMessage: function(msg) {
     let path = msg.data.path;
     let count = msg.data.count;
 
--- a/toolkit/components/addoncompat/RemoteAddonsParent.jsm
+++ b/toolkit/components/addoncompat/RemoteAddonsParent.jsm
@@ -48,17 +48,17 @@ var NotificationTracker = {
   // Each component in a path will be a key in some dictionary. At the
   // end, the _count property keeps track of how many instances of the
   // given path are present in _paths.
   _paths: {},
 
   init: function() {
     let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
                .getService(Ci.nsIMessageBroadcaster);
-    ppmm.addMessageListener("Addons:GetNotifications", this);
+    ppmm.initialProcessData.remoteAddonsNotificationPaths = this._paths;
   },
 
   add: function(path) {
     let tracked = this._paths;
     for (let component of path) {
       tracked = setDefault(tracked, component, {});
     }
     let count = tracked._count || 0;
@@ -76,23 +76,16 @@ var NotificationTracker = {
       tracked = setDefault(tracked, component, {});
     }
     tracked._count--;
 
     let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
                .getService(Ci.nsIMessageBroadcaster);
     ppmm.broadcastAsyncMessage("Addons:ChangeNotification", {path: path, count: tracked._count});
   },
-
-  receiveMessage: function(msg) {
-    if (msg.name == "Addons:GetNotifications") {
-      return this._paths;
-    }
-    return undefined;
-  }
 };
 NotificationTracker.init();
 
 // An interposition is an object with three properties: methods,
 // getters, and setters. See multiprocessShims.js for an explanation
 // of how these are used. The constructor here just allows one
 // interposition to inherit members from another.
 function Interposition(name, base)