Bug 792496 - Remove ScreenshotHandler delegation stubs from GeckoAppShell. r=cpeterson

This commit is contained in:
Kartikaya Gupta 2012-09-19 17:15:55 -04:00
Родитель 97fc8f26e1
Коммит 3a28614e21
6 изменённых файлов: 22 добавлений и 28 удалений

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

@ -1198,7 +1198,7 @@ abstract public class GeckoApp
getAndProcessThumbnailForTab(tab);
if (Tabs.getInstance().isSelectedTab(tab)) {
GeckoAppShell.sendEventToGecko(GeckoEvent.createStartPaintListentingEvent(tab.getId()));
GeckoAppShell.screenshotWholePage(tab);
ScreenshotHandler.screenshotWholePage(tab);
}
}

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

@ -592,14 +592,6 @@ public class GeckoAppShell
mInputConnection.notifyIMEChange(text, start, end, newEnd);
}
// Called by AndroidBridge using JNI
public static void notifyScreenShot(final ByteBuffer data, final int tabId,
final int left, final int top,
final int right, final int bottom,
final int bufferWidth, final int bufferHeight, final int token) {
ScreenshotHandler.notifyScreenShot(data, tabId, left, top, right, bottom, bufferWidth, bufferHeight, token);
}
private static CountDownLatch sGeckoPendingAcks = null;
// Block the current thread until the Gecko event loop is caught up
@ -2266,15 +2258,6 @@ public class GeckoAppShell
}
}
public static void screenshotWholePage(Tab tab) {
ScreenshotHandler.screenshotWholePage(tab);
}
// Called by AndroidBridge using JNI
public static void notifyPaintedRect(float top, float left, float bottom, float right) {
ScreenshotHandler.notifyPaintedRect(top, left, bottom, right);
}
public static void notifyWakeLockChanged(String topic, String state) {
GeckoApp.mAppContext.notifyWakeLockChanged(topic, state);
}

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

@ -23,7 +23,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
class ScreenshotHandler implements Runnable {
public final class ScreenshotHandler implements Runnable {
public static final int SCREENSHOT_THUMBNAIL = 0;
public static final int SCREENSHOT_CHECKERBOARD = 1;
@ -138,6 +138,7 @@ class ScreenshotHandler implements Runnable {
return Math.max(Math.min(max, val), min);
}
// Called from native code by JNI
public static void notifyPaintedRect(float top, float left, float bottom, float right) {
if (sDisableScreenshot) {
return;
@ -264,6 +265,7 @@ class ScreenshotHandler implements Runnable {
}
}
// Called from native code by JNI
public static void notifyScreenShot(final ByteBuffer data, final int tabId,
final int left, final int top,
final int right, final int bottom,

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

@ -7,6 +7,7 @@ package org.mozilla.gecko.gfx;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.ScreenshotHandler;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.ZoomConstraints;
@ -428,7 +429,7 @@ public class GeckoLayerClient
DisplayPortCalculator.resetPageState();
mDrawTimingQueue.reset();
mView.getRenderer().resetCheckerboard();
GeckoAppShell.screenshotWholePage(Tabs.getInstance().getSelectedTab());
ScreenshotHandler.screenshotWholePage(Tabs.getInstance().getSelectedTab());
}
/** This function is invoked by Gecko via JNI; be careful when modifying signature.

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

@ -101,7 +101,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
jNotifyIME = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIME", "(II)V");
jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V");
jNotifyIMEChange = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEChange", "(Ljava/lang/String;III)V");
jNotifyScreenShot = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyScreenShot", "(Ljava/nio/ByteBuffer;IIIIIIII)V");
jAcknowledgeEventSync = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "acknowledgeEventSync", "()V");
jEnableLocation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableLocation", "(Z)V");
@ -151,7 +150,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
jEnableBatteryNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableBatteryNotifications", "()V");
jDisableBatteryNotifications = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "disableBatteryNotifications", "()V");
jGetCurrentBatteryInformation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getCurrentBatteryInformation", "()[D");
jNotifyPaintedRect = jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyPaintedRect", "(FFFF)V");
jHandleGeckoMessage = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "handleGeckoMessage", "(Ljava/lang/String;)Ljava/lang/String;");
jCheckUriVisited = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "checkUriVisited", "(Ljava/lang/String;)V");
@ -176,6 +174,10 @@ AndroidBridge::Init(JNIEnv *jEnv,
jLockScreenOrientation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "lockScreenOrientation", "(I)V");
jUnlockScreenOrientation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "unlockScreenOrientation", "()V");
jScreenshotHandlerClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("org/mozilla/gecko/ScreenshotHandler"));
jNotifyScreenShot = jEnv->GetStaticMethodID(jScreenshotHandlerClass, "notifyScreenShot", "(Ljava/nio/ByteBuffer;IIIIIIII)V");
jNotifyPaintedRect = jEnv->GetStaticMethodID(jScreenshotHandlerClass, "notifyPaintedRect", "(FFFF)V");
jEGLContextClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGLContext"));
jEGL10Class = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGL10"));
jEGLSurfaceImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLSurfaceImpl"));
@ -2523,8 +2525,11 @@ nsresult AndroidBridge::TakeScreenshot(nsIDOMWindow *window, int32_t srcX, int32
context->Scale(scale * dstW / srcW, scale * dstH / srcH);
rv = presShell->RenderDocument(r, renderDocFlags, bgColor, context);
NS_ENSURE_SUCCESS(rv, rv);
env->CallStaticVoidMethod(AndroidBridge::Bridge()->mGeckoAppShellClass, AndroidBridge::Bridge()->jNotifyScreenShot,
buffer, tabId, dstX, dstY, dstX + dstW, dstY + dstH, bufW, bufH, token);
env->CallStaticVoidMethod(AndroidBridge::Bridge()->jScreenshotHandlerClass,
AndroidBridge::Bridge()->jNotifyScreenShot,
buffer, tabId,
dstX, dstY, dstX + dstW, dstY + dstH,
bufW, bufH, token);
return NS_OK;
}
@ -2536,7 +2541,9 @@ AndroidBridge::NotifyPaintedRect(float top, float left, float bottom, float righ
return;
AutoLocalJNIFrame jniFrame(env, 0);
env->CallStaticVoidMethod(AndroidBridge::Bridge()->mGeckoAppShellClass, AndroidBridge::Bridge()->jNotifyPaintedRect, top, left, bottom, right);
env->CallStaticVoidMethod(AndroidBridge::Bridge()->jScreenshotHandlerClass,
AndroidBridge::Bridge()->jNotifyPaintedRect,
top, left, bottom, right);
}
extern "C" {

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

@ -402,7 +402,6 @@ protected:
jmethodID jNotifyIME;
jmethodID jNotifyIMEEnabled;
jmethodID jNotifyIMEChange;
jmethodID jNotifyScreenShot;
jmethodID jAcknowledgeEventSync;
jmethodID jEnableLocation;
jmethodID jEnableLocationHighAccuracy;
@ -463,8 +462,6 @@ protected:
jmethodID jHideSurface;
jmethodID jDestroySurface;
jmethodID jNotifyPaintedRect;
jmethodID jNumberOfMessages;
jmethodID jSendMessage;
jmethodID jSaveSentMessage;
@ -488,6 +485,10 @@ protected:
jmethodID jRegisterSurfaceTextureFrameListener;
jmethodID jUnregisterSurfaceTextureFrameListener;
jclass jScreenshotHandlerClass;
jmethodID jNotifyScreenShot;
jmethodID jNotifyPaintedRect;
// for GfxInfo (gfx feature detection and blacklisting)
jmethodID jGetGfxInfoData;