Bug 1305271 - 3. Use @JNITarget for Distribution.getDistributionDirectories; r=snorp
authorJim Chen <nchen@mozilla.com>
Wed, 28 Sep 2016 23:49:25 -0400
changeset 315701 d700a47ef29500aeb3230ad8a1729d005c66644b
parent 315700 41f3ef3587650a8c3e436b3b23b983aa07b68820
child 315702 a461830b4d2fcd5ad64df13ba9f7618be9a34ee9
push id20623
push usercbook@mozilla.com
push dateThu, 29 Sep 2016 09:49:42 +0000
treeherderfx-team@dc21ccd6a304 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1305271
milestone52.0a1
Bug 1305271 - 3. Use @JNITarget for Distribution.getDistributionDirectories; r=snorp Distribution.getDistributionDirectories is currently annotated with @WrapForJNI, but because it's used from JS through JNI.jsm, the @JNITarget annotation is more appropriate.
mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
widget/android/fennec/FennecJNIWrappers.cpp
widget/android/fennec/FennecJNIWrappers.h
--- a/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
+++ b/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
@@ -36,17 +36,17 @@ import ch.boye.httpclientandroidlib.prot
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.mozilla.gecko.annotation.RobocopTarget;
 import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoSharedPrefs;
 import org.mozilla.gecko.Telemetry;
-import org.mozilla.gecko.annotation.WrapForJNI;
+import org.mozilla.gecko.annotation.JNITarget;
 import org.mozilla.gecko.util.FileUtils;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.app.Activity;
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.os.SystemClock;
@@ -868,17 +868,17 @@ public class Distribution {
 
         return null;
     }
 
     private String getDataDir() {
         return context.getApplicationInfo().dataDir;
     }
 
-    @WrapForJNI(calledFrom = "gecko")
+    @JNITarget
     public static String[] getDistributionDirectories() {
         final Context context = GeckoAppShell.getApplicationContext();
 
         final String[] dataDirectories = getDataDistributionDirectories(context);
         final String[] systemDirectories = getSystemDistributionDirectories(context);
 
         final String[] directories = new String[dataDirectories.length + systemDirectories.length];
 
--- a/widget/android/fennec/FennecJNIWrappers.cpp
+++ b/widget/android/fennec/FennecJNIWrappers.cpp
@@ -154,27 +154,16 @@ constexpr char ThumbnailHelper::RequestT
 constexpr char ThumbnailHelper::RequestThumbnail_t::signature[];
 
 const char ZoomedView::name[] =
         "org/mozilla/gecko/ZoomedView";
 
 constexpr char ZoomedView::RequestZoomedViewData_t::name[];
 constexpr char ZoomedView::RequestZoomedViewData_t::signature[];
 
-const char Distribution::name[] =
-        "org/mozilla/gecko/distribution/Distribution";
-
-constexpr char Distribution::GetDistributionDirectories_t::name[];
-constexpr char Distribution::GetDistributionDirectories_t::signature[];
-
-auto Distribution::GetDistributionDirectories() -> mozilla::jni::ObjectArray::LocalRef
-{
-    return mozilla::jni::Method<GetDistributionDirectories_t>::Call(Distribution::Context(), nullptr);
-}
-
 const char AudioFocusAgent::name[] =
         "org/mozilla/gecko/media/AudioFocusAgent";
 
 constexpr char AudioFocusAgent::NotifyStartedPlaying_t::name[];
 constexpr char AudioFocusAgent::NotifyStartedPlaying_t::signature[];
 
 auto AudioFocusAgent::NotifyStartedPlaying() -> void
 {
--- a/widget/android/fennec/FennecJNIWrappers.h
+++ b/widget/android/fennec/FennecJNIWrappers.h
@@ -599,47 +599,16 @@ public:
     };
 
     static const mozilla::jni::CallingThread callingThread =
             mozilla::jni::CallingThread::ANY;
 
     template<class Impl> class Natives;
 };
 
-class Distribution : public mozilla::jni::ObjectBase<Distribution>
-{
-public:
-    static const char name[];
-
-    explicit Distribution(const Context& ctx) : ObjectBase<Distribution>(ctx) {}
-
-    struct GetDistributionDirectories_t {
-        typedef Distribution Owner;
-        typedef mozilla::jni::ObjectArray::LocalRef ReturnType;
-        typedef mozilla::jni::ObjectArray::Param SetterType;
-        typedef mozilla::jni::Args<> Args;
-        static constexpr char name[] = "getDistributionDirectories";
-        static constexpr char signature[] =
-                "()[Ljava/lang/String;";
-        static const bool isStatic = true;
-        static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::ABORT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::GECKO;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    static auto GetDistributionDirectories() -> mozilla::jni::ObjectArray::LocalRef;
-
-    static const mozilla::jni::CallingThread callingThread =
-            mozilla::jni::CallingThread::GECKO;
-
-};
-
 class AudioFocusAgent : public mozilla::jni::ObjectBase<AudioFocusAgent>
 {
 public:
     static const char name[];
 
     explicit AudioFocusAgent(const Context& ctx) : ObjectBase<AudioFocusAgent>(ctx) {}
 
     struct NotifyStartedPlaying_t {