Bug 1257319 - Remove BROADCAST GeckoEvent; r=me
☠☠ backed out by c539b5bbdb36 ☠ ☠
authorJim Chen <nchen@mozilla.com>
Tue, 22 Mar 2016 22:24:32 -0400
changeset 289972 48d6faa3bf0f8d032a43b6898222fea27eae4216
parent 289971 9d6577fd74f3cd1fb026623a53d18dccd4588e53
child 289973 81ba35b38dc1626863841170cf5293e6d238b6bf
push id18337
push usercbook@mozilla.com
push dateWed, 23 Mar 2016 15:30:25 +0000
treeherderfx-team@67ac681f7e53 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1257319
milestone48.0a1
Bug 1257319 - Remove BROADCAST GeckoEvent; r=me Remove the now-obsolete BROADCAST GeckoEvent.
mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
widget/android/AndroidJNI.cpp
widget/android/AndroidJavaWrappers.cpp
widget/android/AndroidJavaWrappers.h
widget/android/nsAppShell.cpp
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
@@ -72,17 +72,16 @@ public class GeckoEvent {
         NATIVE_POKE(0),
         MOTION_EVENT(2),
         SENSOR_EVENT(3),
         LOCATION_EVENT(5),
         APP_BACKGROUNDING(9),
         APP_FOREGROUNDING(10),
         LOAD_URI(12),
         NOOP(15),
-        BROADCAST(19),
         VIEWPORT(20),
         VISITED(21),
         NETWORK_CHANGED(22),
         THUMBNAIL(25),
         SCREENORIENTATION_CHANGED(27),
         NATIVE_GESTURE_EVENT(31),
         CALL_OBSERVER(33),
         REMOVE_OBSERVER(34),
@@ -456,24 +455,16 @@ public class GeckoEvent {
     }
 
     public static GeckoEvent createLocationEvent(Location l) {
         GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.LOCATION_EVENT);
         event.mLocation = l;
         return event;
     }
 
-    @RobocopTarget
-    public static GeckoEvent createBroadcastEvent(String subject, String data) {
-        GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.BROADCAST);
-        event.mCharacters = subject;
-        event.mCharactersExtra = data;
-        return event;
-    }
-
     public static GeckoEvent createViewportEvent(ImmutableViewportMetrics metrics, DisplayPortMetrics displayPort) {
         GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.VIEWPORT);
         event.mCharacters = "Viewport:Change";
         StringBuilder sb = new StringBuilder(256);
         sb.append("{ \"x\" : ").append(metrics.viewportRectLeft)
           .append(", \"y\" : ").append(metrics.viewportRectTop)
           .append(", \"zoom\" : ").append(metrics.zoomFactor)
           .append(", \"displayPort\" :").append(displayPort.toJSON())
--- a/widget/android/AndroidJNI.cpp
+++ b/widget/android/AndroidJNI.cpp
@@ -58,39 +58,16 @@ Java_org_mozilla_gecko_GeckoAppShell_reg
 
 NS_EXPORT void JNICALL
 Java_org_mozilla_gecko_GeckoAppShell_notifyGeckoOfEvent(JNIEnv *jenv, jclass jc, jobject event)
 {
     // poke the appshell
     nsAppShell::PostEvent(AndroidGeckoEvent::MakeFromJavaObject(jenv, event));
 }
 
-NS_EXPORT void JNICALL
-Java_org_mozilla_gecko_GeckoAppShell_notifyGeckoObservers(JNIEnv *aEnv, jclass,
-                                                         jstring aTopic, jstring aData)
-{
-    if (!NS_IsMainThread()) {
-        jni::ThrowException(aEnv,
-            "java/lang/IllegalThreadStateException", "Not on Gecko main thread");
-        return;
-    }
-
-    nsCOMPtr<nsIObserverService> obsServ =
-        mozilla::services::GetObserverService();
-    if (!obsServ) {
-        jni::ThrowException(aEnv,
-            "java/lang/IllegalStateException", "No observer service");
-        return;
-    }
-
-    const nsJNICString topic(aTopic, aEnv);
-    const nsJNIString data(aData, aEnv);
-    obsServ->NotifyObservers(nullptr, topic.get(), data.get());
-}
-
 NS_EXPORT jlong JNICALL
 Java_org_mozilla_gecko_GeckoAppShell_runUiThreadCallback(JNIEnv* env, jclass)
 {
     if (!AndroidBridge::Bridge()) {
         return -1;
     }
 
     return AndroidBridge::Bridge()->RunDelayedUiThreadTasks();
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -385,18 +385,17 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jo
         }
 
         case LOAD_URI: {
             ReadCharactersField(jenv);
             ReadCharactersExtraField(jenv);
             break;
         }
 
-        case VIEWPORT:
-        case BROADCAST: {
+        case VIEWPORT: {
             ReadCharactersField(jenv);
             ReadCharactersExtraField(jenv);
             break;
         }
 
         case NETWORK_CHANGED: {
             mConnectionType = jenv->GetIntField(jobj, jConnectionTypeField);
             mIsWifi = jenv->GetBooleanField(jobj, jIsWifiField);
--- a/widget/android/AndroidJavaWrappers.h
+++ b/widget/android/AndroidJavaWrappers.h
@@ -439,24 +439,16 @@ public:
     }
 
     static AndroidGeckoEvent* MakeFromJavaObject(JNIEnv *jenv, jobject jobj) {
         AndroidGeckoEvent *event = new AndroidGeckoEvent();
         event->Init(jenv, jobj);
         return event;
     }
 
-    static AndroidGeckoEvent* MakeBroadcastEvent(const nsCString& topic, const nsCString& data) {
-        AndroidGeckoEvent* event = new AndroidGeckoEvent();
-        event->Init(BROADCAST);
-        CopyUTF8toUTF16(topic, event->mCharacters);
-        CopyUTF8toUTF16(data, event->mCharactersExtra);
-        return event;
-    }
-
     static AndroidGeckoEvent* MakeAddObserver(const nsAString &key, nsIObserver *observer) {
         AndroidGeckoEvent *event = new AndroidGeckoEvent();
         event->Init(ADD_OBSERVER);
         event->mCharacters.Assign(key);
         event->mObserver = observer;
         return event;
     }
 
@@ -636,17 +628,16 @@ public:
         MOTION_EVENT = 2,
         SENSOR_EVENT = 3,
         LOCATION_EVENT = 5,
         APP_BACKGROUNDING = 9,
         APP_FOREGROUNDING = 10,
         LOAD_URI = 12,
         NOOP = 15,
         APZ_INPUT_EVENT = 17, // used internally in AndroidJNI/nsAppShell/nsWindow
-        BROADCAST = 19,
         VIEWPORT = 20,
         VISITED = 21,
         NETWORK_CHANGED = 22,
         THUMBNAIL = 25,
         SCREENORIENTATION_CHANGED = 27,
         NATIVE_GESTURE_EVENT = 31,
         CALL_OBSERVER = 33,
         REMOVE_OBSERVER = 34,
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -673,18 +673,17 @@ nsAppShell::LegacyGeckoEvent::Run()
             break;
         }
         NS_ASSERTION(points.Length() == 2, "ZoomedView event does not have enough coordinates");
         nsIntRect r(points[0].x, points[0].y, points[1].x, points[1].y);
         AndroidBridge::Bridge()->CaptureZoomedView(domWindow, r, mBuffer, scaleFactor);
         break;
     }
 
-    case AndroidGeckoEvent::VIEWPORT:
-    case AndroidGeckoEvent::BROADCAST: {
+    case AndroidGeckoEvent::VIEWPORT: {
         if (curEvent->Characters().Length() == 0)
             break;
 
         nsCOMPtr<nsIObserverService> obsServ =
             mozilla::services::GetObserverService();
 
         const NS_ConvertUTF16toUTF8 topic(curEvent->Characters());
         const nsPromiseFlatString& data = PromiseFlatString(curEvent->CharactersExtra());