Bug 1328680 - Convert GeckoService event to bundle event; r=sebastian
authorJim Chen <nchen@mozilla.com>
Tue, 10 Jan 2017 23:01:27 -0500
changeset 328897 078d4f87b85452e0843d1201461ce22b32874c8e
parent 328896 66b64c1105db7b1a07273c9d31c07cfd6652231c
child 328898 81ec4f7867a78c2761fafd95198ef9c9300edc52
push id31191
push usercbook@mozilla.com
push dateWed, 11 Jan 2017 15:24:19 +0000
treeherdermozilla-central@63ad56438630 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1328680
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1328680 - Convert GeckoService event to bundle event; r=sebastian Convert the "Gecko:ScheduleRun" event that GeckoService listens to to a GeckoBundle/BundleEventListener event.
mobile/android/base/java/org/mozilla/gecko/GeckoService.java
mobile/android/components/AddonUpdateService.js
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
@@ -12,38 +12,38 @@ import android.content.Context;
 import android.content.Intent;
 import android.os.IBinder;
 import android.os.Handler;
 import android.os.Looper;
 import android.util.Log;
 
 import java.io.File;
 
-import org.mozilla.gecko.util.NativeEventListener;
-import org.mozilla.gecko.util.NativeJSObject;
+import org.mozilla.gecko.util.BundleEventListener;
+import org.mozilla.gecko.util.GeckoBundle;
 import org.mozilla.gecko.util.EventCallback;
 
 public class GeckoService extends Service {
 
     private static final String LOGTAG = "GeckoService";
     private static final boolean DEBUG = false;
 
     private static final String INTENT_PROFILE_NAME = "org.mozilla.gecko.intent.PROFILE_NAME";
     private static final String INTENT_PROFILE_DIR = "org.mozilla.gecko.intent.PROFILE_DIR";
 
     private static final String INTENT_ACTION_UPDATE_ADDONS = "update-addons";
     private static final String INTENT_ACTION_CREATE_SERVICES = "create-services";
 
     private static final String INTENT_SERVICE_CATEGORY = "category";
     private static final String INTENT_SERVICE_DATA = "data";
 
-    private static class EventListener implements NativeEventListener {
-        @Override // NativeEventListener
+    private static class EventListener implements BundleEventListener {
+        @Override // BundleEventListener
         public void handleMessage(final String event,
-                                  final NativeJSObject message,
+                                  final GeckoBundle message,
                                   final EventCallback callback) {
             final Context context = GeckoAppShell.getApplicationContext();
             switch (event) {
             case "Gecko:ScheduleRun":
                 if (DEBUG) {
                     Log.d(LOGTAG, "Scheduling " + message.getString("action") +
                                   " @ " + message.getInt("interval") + "ms");
                 }
--- a/mobile/android/components/AddonUpdateService.js
+++ b/mobile/android/components/AddonUpdateService.js
@@ -13,17 +13,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/AddonManager.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",
                                   "resource://gre/modules/addons/AddonRepository.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "GMPInstallManager",
                                   "resource://gre/modules/GMPInstallManager.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "Messaging",
+XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher",
                                   "resource://gre/modules/Messaging.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
 
 function getPref(func, preference, defaultValue) {
   try {
     return Services.prefs[func](preference);
   }
@@ -57,17 +57,17 @@ AddonUpdateService.prototype = {
       return;
 
     AddonManagerPrivate.backgroundUpdateCheck();
 
     let gmp = new GMPInstallManager();
     gmp.simpleCheckAndInstall().then(null, () => {});
 
     let interval = 1000 * getPref("getIntPref", PREF_ADDON_UPDATE_INTERVAL, 86400);
-    Messaging.sendRequest({
+    EventDispatcher.instance.sendRequest({
       type: "Gecko:ScheduleRun",
       action: "update-addons",
       trigger: interval,
       interval: interval,
     });
   }
 };