Bug 1286663 - Update existing code using ByteBuffer; r=me

This commit is contained in:
Jim Chen 2016-07-21 13:49:04 -04:00
Родитель fe52fe774b
Коммит 6cd5749e48
6 изменённых файлов: 16 добавлений и 16 удалений

Просмотреть файл

@ -174,7 +174,7 @@ public:
{
JNIEnv* const env = jni::GetEnvForThread();
jni::Object::LocalRef buffer(env);
jni::ByteBuffer::LocalRef buffer(env);
NS_ENSURE_SUCCESS_VOID(aFormat->GetByteBuffer(NS_LITERAL_STRING("csd-0"),
&buffer));

Просмотреть файл

@ -1768,7 +1768,7 @@ GetScaleFactor(nsPresContext* aPresContext) {
}
nsresult
AndroidBridge::CaptureZoomedView(mozIDOMWindowProxy *window, nsIntRect zoomedViewRect, Object::Param buffer,
AndroidBridge::CaptureZoomedView(mozIDOMWindowProxy *window, nsIntRect zoomedViewRect, ByteBuffer::Param buffer,
float zoomFactor) {
nsresult rv;
@ -1814,7 +1814,7 @@ AndroidBridge::CaptureZoomedView(mozIDOMWindowProxy *window, nsIntRect zoomedVie
gfxImageFormat iFormat = gfx::SurfaceFormatToImageFormat(format);
uint32_t stride = gfxASurface::FormatStrideForWidth(iFormat, zoomedViewRect.width);
uint8_t* data = static_cast<uint8_t*> (env->GetDirectBufferAddress(buffer.Get()));
uint8_t* data = static_cast<uint8_t*>(buffer->Address());
if (!data) {
return NS_ERROR_FAILURE;
}
@ -1844,7 +1844,7 @@ AndroidBridge::CaptureZoomedView(mozIDOMWindowProxy *window, nsIntRect zoomedVie
return NS_OK;
}
nsresult AndroidBridge::CaptureThumbnail(mozIDOMWindowProxy *window, int32_t bufW, int32_t bufH, int32_t tabId, Object::Param buffer, bool &shouldStore)
nsresult AndroidBridge::CaptureThumbnail(mozIDOMWindowProxy *window, int32_t bufW, int32_t bufH, int32_t tabId, ByteBuffer::Param buffer, bool &shouldStore)
{
nsresult rv;
float scale = 1.0;
@ -1917,7 +1917,7 @@ nsresult AndroidBridge::CaptureThumbnail(mozIDOMWindowProxy *window, int32_t buf
bool is24bit = (GetScreenDepth() == 24);
uint32_t stride = bufW * (is24bit ? 4 : 2);
uint8_t* data = static_cast<uint8_t*>(env->GetDirectBufferAddress(buffer.Get()));
uint8_t* data = static_cast<uint8_t*>(buffer->Address());
if (!data)
return NS_ERROR_FAILURE;
@ -2219,7 +2219,7 @@ uint32_t AndroidBridge::InputStreamAvailable(Object::Param obj) {
nsresult AndroidBridge::InputStreamRead(Object::Param obj, char *aBuf, uint32_t aCount, uint32_t *aRead) {
JNIEnv* const env = GetEnvForThread();
auto arr = Object::LocalRef::Adopt(env, env->NewDirectByteBuffer(aBuf, aCount));
auto arr = ByteBuffer::New(aBuf, aCount);
jint read = env->CallIntMethod(obj.Get(), sBridge->jByteBufferRead, arr.Get());
if (env->ExceptionCheck()) {

Просмотреть файл

@ -147,8 +147,8 @@ public:
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::Object::Param buffer, float zoomFactor);
nsresult CaptureThumbnail(mozIDOMWindowProxy *window, int32_t bufW, int32_t bufH, int32_t tabId, jni::Object::Param buffer, bool &shouldStore);
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);
void GetDisplayPort(bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort);
void ContentDocumentChanged();
bool IsContentDocumentDisplayed();

Просмотреть файл

@ -1178,7 +1178,7 @@ const char ThumbnailHelper::name[] =
constexpr char ThumbnailHelper::SendThumbnail_t::name[];
constexpr char ThumbnailHelper::SendThumbnail_t::signature[];
auto ThumbnailHelper::SendThumbnail(mozilla::jni::Object::Param a0, int32_t a1, bool a2, bool a3) -> void
auto ThumbnailHelper::SendThumbnail(mozilla::jni::ByteBuffer::Param a0, int32_t a1, bool a2, bool a3) -> void
{
return mozilla::jni::Method<SendThumbnail_t>::Call(ThumbnailHelper::Context(), nullptr, a0, a1, a2, a3);
}
@ -1431,7 +1431,7 @@ const char LayerView::name[] =
constexpr char LayerView::updateZoomedView_t::name[];
constexpr char LayerView::updateZoomedView_t::signature[];
auto LayerView::updateZoomedView(mozilla::jni::Object::Param a0) -> void
auto LayerView::updateZoomedView(mozilla::jni::ByteBuffer::Param a0) -> void
{
return mozilla::jni::Method<updateZoomedView_t>::Call(LayerView::Context(), nullptr, a0);
}

Просмотреть файл

@ -2955,7 +2955,7 @@ public:
typedef void ReturnType;
typedef void SetterType;
typedef mozilla::jni::Args<
mozilla::jni::Object::Param,
mozilla::jni::ByteBuffer::Param,
int32_t,
bool,
bool> Args;
@ -2967,7 +2967,7 @@ public:
mozilla::jni::ExceptionMode::ABORT;
};
static auto SendThumbnail(mozilla::jni::Object::Param, int32_t, bool, bool) -> void;
static auto SendThumbnail(mozilla::jni::ByteBuffer::Param, int32_t, bool, bool) -> void;
static const bool isMultithreaded = false;
@ -3616,7 +3616,7 @@ public:
typedef void ReturnType;
typedef void SetterType;
typedef mozilla::jni::Args<
mozilla::jni::Object::Param> Args;
mozilla::jni::ByteBuffer::Param> Args;
static constexpr char name[] = "updateZoomedView";
static constexpr char signature[] =
"(Ljava/nio/ByteBuffer;)V";
@ -3625,7 +3625,7 @@ public:
mozilla::jni::ExceptionMode::ABORT;
};
static auto updateZoomedView(mozilla::jni::Object::Param) -> void;
static auto updateZoomedView(mozilla::jni::ByteBuffer::Param) -> void;
static const bool isMultithreaded = true;

Просмотреть файл

@ -87,7 +87,7 @@ public:
mBrowserApp(aBrowserApp), mPoints(aPoints), mTabId(aTabId), mBuffer(aBuffer) {}
virtual nsresult Run() {
const auto& buffer = jni::Object::Ref::From(mBuffer->GetObject());
const auto& buffer = jni::ByteBuffer::Ref::From(mBuffer->GetObject());
nsCOMPtr<mozIDOMWindowProxy> domWindow;
nsCOMPtr<nsIBrowserTab> tab;
mBrowserApp->GetBrowserTab(mTabId, getter_AddRefs(tab));
@ -714,7 +714,7 @@ nsAppShell::LegacyGeckoEvent::Run()
const nsTArray<nsIntPoint>& points = curEvent->Points();
float scaleFactor = (float) curEvent->X();
RefPtr<RefCountedJavaObject> javaBuffer = curEvent->ByteBuffer();
const auto& mBuffer = jni::Object::Ref::From(javaBuffer->GetObject());
const auto& mBuffer = jni::ByteBuffer::Ref::From(javaBuffer->GetObject());
nsCOMPtr<mozIDOMWindowProxy> domWindow;
nsCOMPtr<nsIBrowserTab> tab;