Bug 1413230 - Expose updateTexImage() and releaseTexImage() failures in GeckoSurfaceTexture JNI wrapper r=jchen draft
authorJames Willcox <snorp@snorp.net>
Tue, 31 Oct 2017 11:08:56 -0500
changeset 689568 0159326e0f85d50ca3370208dbf27f1edee283fd
parent 689567 c362de2c683cc49161579ce80b853c7f46b92234
child 738336 bd462780d1f8686b1473b4288e3bc182ef812f97
push id87045
push userbmo:snorp@snorp.net
push dateTue, 31 Oct 2017 17:43:45 +0000
reviewersjchen
bugs1413230
milestone58.0a1
Bug 1413230 - Expose updateTexImage() and releaseTexImage() failures in GeckoSurfaceTexture JNI wrapper r=jchen MozReview-Commit-ID: LZ9n9wjXLDL
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
widget/android/GeneratedJNIWrappers.cpp
widget/android/GeneratedJNIWrappers.h
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoSurfaceTexture.java
@@ -83,42 +83,34 @@ public final class GeckoSurfaceTexture e
     }
 
     @WrapForJNI
     public boolean isSingleBuffer() {
         return mIsSingleBuffer;
     }
 
     @Override
-    @WrapForJNI
+    @WrapForJNI(exceptionMode = "nsresult")
     public synchronized void updateTexImage() {
-        try {
-            super.updateTexImage();
-            if (mListener != null) {
-                mListener.onUpdateTexImage();
-            }
-        } catch (Exception e) {
-            Log.w(LOGTAG, "updateTexImage() failed", e);
+        super.updateTexImage();
+        if (mListener != null) {
+            mListener.onUpdateTexImage();
         }
     }
 
     @Override
-    @WrapForJNI
+    @WrapForJNI(exceptionMode = "nsresult")
     public synchronized void releaseTexImage() {
         if (!mIsSingleBuffer) {
             return;
         }
 
-        try {
-            super.releaseTexImage();
-            if (mListener != null) {
-                mListener.onReleaseTexImage();
-            }
-        } catch (Exception e) {
-            Log.w(LOGTAG, "releaseTexImage() failed", e);
+        super.releaseTexImage();
+        if (mListener != null) {
+            mListener.onReleaseTexImage();
         }
     }
 
     public synchronized void setListener(GeckoSurfaceTexture.Callbacks listener) {
         mListener = listener;
     }
 
     @WrapForJNI
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -1202,27 +1202,31 @@ constexpr char GeckoSurfaceTexture::Look
 auto GeckoSurfaceTexture::Lookup(int32_t a0) -> GeckoSurfaceTexture::LocalRef
 {
     return mozilla::jni::Method<Lookup_t>::Call(GeckoSurfaceTexture::Context(), nullptr, a0);
 }
 
 constexpr char GeckoSurfaceTexture::ReleaseTexImage_t::name[];
 constexpr char GeckoSurfaceTexture::ReleaseTexImage_t::signature[];
 
-auto GeckoSurfaceTexture::ReleaseTexImage() const -> void
+auto GeckoSurfaceTexture::ReleaseTexImage() const -> nsresult
 {
-    return mozilla::jni::Method<ReleaseTexImage_t>::Call(GeckoSurfaceTexture::mCtx, nullptr);
+    nsresult rv = NS_OK;
+    mozilla::jni::Method<ReleaseTexImage_t>::Call(GeckoSurfaceTexture::mCtx, &rv);
+    return rv;
 }
 
 constexpr char GeckoSurfaceTexture::UpdateTexImage_t::name[];
 constexpr char GeckoSurfaceTexture::UpdateTexImage_t::signature[];
 
-auto GeckoSurfaceTexture::UpdateTexImage() const -> void
+auto GeckoSurfaceTexture::UpdateTexImage() const -> nsresult
 {
-    return mozilla::jni::Method<UpdateTexImage_t>::Call(GeckoSurfaceTexture::mCtx, nullptr);
+    nsresult rv = NS_OK;
+    mozilla::jni::Method<UpdateTexImage_t>::Call(GeckoSurfaceTexture::mCtx, &rv);
+    return rv;
 }
 
 const char LayerView::name[] =
         "org/mozilla/gecko/gfx/LayerView";
 
 constexpr char LayerView::GetCompositor_t::name[];
 constexpr char LayerView::GetCompositor_t::signature[];
 
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -3659,43 +3659,43 @@ public:
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "releaseTexImage";
         static constexpr char signature[] =
                 "()V";
         static const bool isStatic = false;
         static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::ABORT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::ANY;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    auto ReleaseTexImage() const -> void;
+                mozilla::jni::ExceptionMode::NSRESULT;
+        static const mozilla::jni::CallingThread callingThread =
+                mozilla::jni::CallingThread::ANY;
+        static const mozilla::jni::DispatchTarget dispatchTarget =
+                mozilla::jni::DispatchTarget::CURRENT;
+    };
+
+    auto ReleaseTexImage() const -> nsresult;
 
     struct UpdateTexImage_t {
         typedef GeckoSurfaceTexture Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<> Args;
         static constexpr char name[] = "updateTexImage";
         static constexpr char signature[] =
                 "()V";
         static const bool isStatic = false;
         static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::ABORT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::ANY;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    auto UpdateTexImage() const -> void;
+                mozilla::jni::ExceptionMode::NSRESULT;
+        static const mozilla::jni::CallingThread callingThread =
+                mozilla::jni::CallingThread::ANY;
+        static const mozilla::jni::DispatchTarget dispatchTarget =
+                mozilla::jni::DispatchTarget::CURRENT;
+    };
+
+    auto UpdateTexImage() const -> nsresult;
 
     static const mozilla::jni::CallingThread callingThread =
             mozilla::jni::CallingThread::ANY;
 
 };
 
 class LayerView : public mozilla::jni::ObjectBase<LayerView>
 {