Backed out changeset 7cd055ed9366 (bug 1286663) for android bustage on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 21 Jul 2016 08:18:59 +0200
changeset 306034 3c9f2a1d387e77449e55d8b74580c6fe2d286638
parent 306033 4cf2ae920be031332de77f008b97c87cb8c55d2f
child 306035 6f859f324dce2551bd30d42a0bce38f2134e35a9
push id20080
push usercbook@mozilla.com
push dateThu, 21 Jul 2016 14:27:27 +0000
treeherderfx-team@f5154aaeaec4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1286663
milestone50.0a1
backs out7cd055ed9366e52affd17cec4d4b44ad2f14e39a
Backed out changeset 7cd055ed9366 (bug 1286663) for android bustage on a CLOSED TREE
dom/media/platforms/android/AndroidDecoderModule.cpp
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/GeneratedJNIWrappers.cpp
widget/android/GeneratedJNIWrappers.h
widget/android/nsAppShell.cpp
--- a/dom/media/platforms/android/AndroidDecoderModule.cpp
+++ b/dom/media/platforms/android/AndroidDecoderModule.cpp
@@ -169,17 +169,17 @@ class AudioDataDecoder : public MediaCod
 public:
   AudioDataDecoder(const AudioInfo& aConfig, MediaFormat::Param aFormat,
                    MediaDataDecoderCallback* aCallback)
     : MediaCodecDataDecoder(MediaData::Type::AUDIO_DATA, aConfig.mMimeType,
                             aFormat, aCallback)
   {
     JNIEnv* const env = jni::GetEnvForThread();
 
-    jni::ByteBuffer::LocalRef buffer(env);
+    jni::Object::LocalRef buffer(env);
     NS_ENSURE_SUCCESS_VOID(aFormat->GetByteBuffer(NS_LITERAL_STRING("csd-0"),
                                                   &buffer));
 
     if (!buffer && aConfig.mCodecSpecificConfig->Length() >= 2) {
       buffer = jni::Object::LocalRef::Adopt(
           env, env->NewDirectByteBuffer(aConfig.mCodecSpecificConfig->Elements(),
           aConfig.mCodecSpecificConfig->Length()));
       NS_ENSURE_SUCCESS_VOID(aFormat->SetByteBuffer(NS_LITERAL_STRING("csd-0"),
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -1763,17 +1763,17 @@ AndroidBridge::GetFrameNameJavaProfiling
 static float
 GetScaleFactor(nsPresContext* aPresContext) {
     nsIPresShell* presShell = aPresContext->PresShell();
     LayoutDeviceToLayerScale cumulativeResolution(presShell->GetCumulativeResolution());
     return cumulativeResolution.scale;
 }
 
 nsresult
-AndroidBridge::CaptureZoomedView(mozIDOMWindowProxy *window, nsIntRect zoomedViewRect, ByteBuffer::Param buffer,
+AndroidBridge::CaptureZoomedView(mozIDOMWindowProxy *window, nsIntRect zoomedViewRect, Object::Param buffer,
                                   float zoomFactor) {
     nsresult rv;
 
     if (!buffer)
         return NS_ERROR_FAILURE;
 
     nsCOMPtr <nsIDOMWindowUtils> utils = do_GetInterface(window);
     if (!utils)
@@ -1809,17 +1809,17 @@ AndroidBridge::CaptureZoomedView(mozIDOM
              presContext->DevPixelsToAppUnits(zoomedViewRect.width / scaleFactor ),
              presContext->DevPixelsToAppUnits(zoomedViewRect.height / scaleFactor ));
 
     bool is24bit = (GetScreenDepth() == 24);
     SurfaceFormat format = is24bit ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::R5G6B5_UINT16;
     gfxImageFormat iFormat = gfx::SurfaceFormatToImageFormat(format);
     uint32_t stride = gfxASurface::FormatStrideForWidth(iFormat, zoomedViewRect.width);
 
-    uint8_t* data = static_cast<uint8_t*>(buffer->Address());
+    uint8_t* data = static_cast<uint8_t*> (env->GetDirectBufferAddress(buffer.Get()));
     if (!data) {
         return NS_ERROR_FAILURE;
     }
 
     MOZ_ASSERT (gfxPlatform::GetPlatform()->SupportsAzureContentForType(BackendType::CAIRO),
               "Need BackendType::CAIRO support");
     RefPtr < DrawTarget > dt = Factory::CreateDrawTargetForData(
         BackendType::CAIRO, data, IntSize(zoomedViewRect.width, zoomedViewRect.height), stride,
@@ -1839,17 +1839,17 @@ AndroidBridge::CaptureZoomedView(mozIDOM
     }
 
     LayerView::updateZoomedView(buffer);
 
     NS_ENSURE_SUCCESS(rv, rv);
     return NS_OK;
 }
 
-nsresult AndroidBridge::CaptureThumbnail(mozIDOMWindowProxy *window, int32_t bufW, int32_t bufH, int32_t tabId, ByteBuffer::Param buffer, bool &shouldStore)
+nsresult AndroidBridge::CaptureThumbnail(mozIDOMWindowProxy *window, int32_t bufW, int32_t bufH, int32_t tabId, Object::Param buffer, bool &shouldStore)
 {
     nsresult rv;
     float scale = 1.0;
 
     if (!buffer)
         return NS_ERROR_FAILURE;
 
     // take a screenshot, as wide as possible, proportional to the destination size
@@ -1912,17 +1912,17 @@ nsresult AndroidBridge::CaptureThumbnail
     nsRect r(nsPresContext::CSSPixelsToAppUnits(srcX / scale),
              nsPresContext::CSSPixelsToAppUnits(srcY / scale),
              nsPresContext::CSSPixelsToAppUnits(srcW / scale),
              nsPresContext::CSSPixelsToAppUnits(srcH / scale));
 
     bool is24bit = (GetScreenDepth() == 24);
     uint32_t stride = bufW * (is24bit ? 4 : 2);
 
-    uint8_t* data = static_cast<uint8_t*>(buffer->Address());
+    uint8_t* data = static_cast<uint8_t*>(env->GetDirectBufferAddress(buffer.Get()));
     if (!data)
         return NS_ERROR_FAILURE;
 
     MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContentForType(BackendType::CAIRO),
                "Need BackendType::CAIRO support");
     RefPtr<DrawTarget> dt =
         Factory::CreateDrawTargetForData(BackendType::CAIRO,
                                          data,
@@ -2214,17 +2214,17 @@ uint32_t AndroidBridge::InputStreamAvail
     JNIEnv* const env = GetEnvForThread();
     auto rv = env->CallIntMethod(obj.Get(), sBridge->jAvailable);
     MOZ_CATCH_JNI_EXCEPTION(env);
     return rv;
 }
 
 nsresult AndroidBridge::InputStreamRead(Object::Param obj, char *aBuf, uint32_t aCount, uint32_t *aRead) {
     JNIEnv* const env = GetEnvForThread();
-    auto arr = ByteBuffer::New(aBuf, aCount);
+    auto arr = Object::LocalRef::Adopt(env, env->NewDirectByteBuffer(aBuf, aCount));
     jint read = env->CallIntMethod(obj.Get(), sBridge->jByteBufferRead, arr.Get());
 
     if (env->ExceptionCheck()) {
         env->ExceptionClear();
         return NS_ERROR_FAILURE;
     }
 
     if (read <= 0) {
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -142,18 +142,18 @@ public:
     static AndroidBridge *Bridge() {
         return sBridge;
     }
 
     /* These are all implemented in Java */
     bool GetThreadNameJavaProfiling(uint32_t aThreadId, nsCString & aResult);
     bool GetFrameNameJavaProfiling(uint32_t aThreadId, uint32_t aSampleId, uint32_t aFrameId, nsCString & aResult);
 
-    nsresult CaptureZoomedView(mozIDOMWindowProxy *window, nsIntRect zoomedViewRect, jni::ByteBuffer::Param buffer, float zoomFactor);
-    nsresult CaptureThumbnail(mozIDOMWindowProxy *window, int32_t bufW, int32_t bufH, int32_t tabId, jni::ByteBuffer::Param buffer, bool &shouldStore);
+    nsresult CaptureZoomedView(mozIDOMWindowProxy *window, nsIntRect zoomedViewRect, jni::Object::Param buffer, float zoomFactor);
+    nsresult CaptureThumbnail(mozIDOMWindowProxy *window, int32_t bufW, int32_t bufH, int32_t tabId, jni::Object::Param buffer, bool &shouldStore);
     void GetDisplayPort(bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort);
     void ContentDocumentChanged();
     bool IsContentDocumentDisplayed();
 
     bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical,
                                    mozilla::ParentLayerPoint& aScrollOffset, mozilla::CSSToParentLayerScale& aZoom);
 
     void SetLayerClient(widget::GeckoLayerClient::Param jobj);
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -1173,17 +1173,17 @@ auto PrefsHelper::OnPrefChange(mozilla::
 }
 
 const char ThumbnailHelper::name[] =
         "org/mozilla/gecko/ThumbnailHelper";
 
 constexpr char ThumbnailHelper::SendThumbnail_t::name[];
 constexpr char ThumbnailHelper::SendThumbnail_t::signature[];
 
-auto ThumbnailHelper::SendThumbnail(mozilla::jni::ByteBuffer::Param a0, int32_t a1, bool a2, bool a3) -> void
+auto ThumbnailHelper::SendThumbnail(mozilla::jni::Object::Param a0, int32_t a1, bool a2, bool a3) -> void
 {
     return mozilla::jni::Method<SendThumbnail_t>::Call(ThumbnailHelper::Context(), nullptr, a0, a1, a2, a3);
 }
 
 const char Distribution::name[] =
         "org/mozilla/gecko/distribution/Distribution";
 
 constexpr char Distribution::GetDistributionDirectories_t::name[];
@@ -1426,17 +1426,17 @@ auto LayerRenderer::Frame::EndDrawing() 
 }
 
 const char LayerView::name[] =
         "org/mozilla/gecko/gfx/LayerView";
 
 constexpr char LayerView::updateZoomedView_t::name[];
 constexpr char LayerView::updateZoomedView_t::signature[];
 
-auto LayerView::updateZoomedView(mozilla::jni::ByteBuffer::Param a0) -> void
+auto LayerView::updateZoomedView(mozilla::jni::Object::Param a0) -> void
 {
     return mozilla::jni::Method<updateZoomedView_t>::Call(LayerView::Context(), nullptr, a0);
 }
 
 const char NativePanZoomController::name[] =
         "org/mozilla/gecko/gfx/NativePanZoomController";
 
 constexpr char NativePanZoomController::AdjustScrollForSurfaceShift_t::name[];
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -2950,29 +2950,29 @@ public:
 
     explicit ThumbnailHelper(const Context& ctx) : ObjectBase<ThumbnailHelper, jobject>(ctx) {}
 
     struct SendThumbnail_t {
         typedef ThumbnailHelper Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<
-                mozilla::jni::ByteBuffer::Param,
+                mozilla::jni::Object::Param,
                 int32_t,
                 bool,
                 bool> Args;
         static constexpr char name[] = "notifyThumbnail";
         static constexpr char signature[] =
                 "(Ljava/nio/ByteBuffer;IZZ)V";
         static const bool isStatic = true;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
     };
 
-    static auto SendThumbnail(mozilla::jni::ByteBuffer::Param, int32_t, bool, bool) -> void;
+    static auto SendThumbnail(mozilla::jni::Object::Param, int32_t, bool, bool) -> void;
 
     static const bool isMultithreaded = false;
 
 };
 
 class Distribution : public mozilla::jni::ObjectBase<Distribution, jobject>
 {
 public:
@@ -3611,26 +3611,26 @@ public:
 
     explicit LayerView(const Context& ctx) : ObjectBase<LayerView, jobject>(ctx) {}
 
     struct updateZoomedView_t {
         typedef LayerView Owner;
         typedef void ReturnType;
         typedef void SetterType;
         typedef mozilla::jni::Args<
-                mozilla::jni::ByteBuffer::Param> Args;
+                mozilla::jni::Object::Param> Args;
         static constexpr char name[] = "updateZoomedView";
         static constexpr char signature[] =
                 "(Ljava/nio/ByteBuffer;)V";
         static const bool isStatic = true;
         static const mozilla::jni::ExceptionMode exceptionMode =
                 mozilla::jni::ExceptionMode::ABORT;
     };
 
-    static auto updateZoomedView(mozilla::jni::ByteBuffer::Param) -> void;
+    static auto updateZoomedView(mozilla::jni::Object::Param) -> void;
 
     static const bool isMultithreaded = true;
 
 };
 
 class NativePanZoomController : public mozilla::jni::ObjectBase<NativePanZoomController, jobject>
 {
 public:
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -82,17 +82,17 @@ NS_IMPL_ISUPPORTS_INHERITED(nsAppShell, 
 
 class ThumbnailRunnable : public Runnable {
 public:
     ThumbnailRunnable(nsIAndroidBrowserApp* aBrowserApp, int aTabId,
                        const nsTArray<nsIntPoint>& aPoints, RefCountedJavaObject* aBuffer):
         mBrowserApp(aBrowserApp), mPoints(aPoints), mTabId(aTabId), mBuffer(aBuffer) {}
 
     virtual nsresult Run() {
-        const auto& buffer = jni::ByteBuffer::Ref::From(mBuffer->GetObject());
+        const auto& buffer = jni::Object::Ref::From(mBuffer->GetObject());
         nsCOMPtr<mozIDOMWindowProxy> domWindow;
         nsCOMPtr<nsIBrowserTab> tab;
         mBrowserApp->GetBrowserTab(mTabId, getter_AddRefs(tab));
         if (!tab) {
             widget::ThumbnailHelper::SendThumbnail(buffer, mTabId, false, false);
             return NS_ERROR_FAILURE;
         }
 
@@ -709,17 +709,17 @@ nsAppShell::LegacyGeckoEvent::Run()
 
     case AndroidGeckoEvent::ZOOMEDVIEW: {
         if (!nsAppShell::Get()->mBrowserApp)
             break;
         int32_t tabId = curEvent->MetaState();
         const nsTArray<nsIntPoint>& points = curEvent->Points();
         float scaleFactor = (float) curEvent->X();
         RefPtr<RefCountedJavaObject> javaBuffer = curEvent->ByteBuffer();
-        const auto& mBuffer = jni::ByteBuffer::Ref::From(javaBuffer->GetObject());
+        const auto& mBuffer = jni::Object::Ref::From(javaBuffer->GetObject());
 
         nsCOMPtr<mozIDOMWindowProxy> domWindow;
         nsCOMPtr<nsIBrowserTab> tab;
         nsAppShell::Get()->mBrowserApp->GetBrowserTab(tabId, getter_AddRefs(tab));
         if (!tab) {
             NS_ERROR("Can't find tab!");
             break;
         }