bug 715507 - GlobalHistory is accessing Gecko on the wrong thread r=dougt,kats

This commit is contained in:
Brad Lassey
2012-01-05 16:14:23 -08:00
parent f6e045884e
commit 27689d1dc7
6 changed files with 21 additions and 16 deletions

View File

@@ -132,7 +132,9 @@ public class GeckoAppShell
public static native void loadLibs(String apkName, boolean shouldExtract);
public static native void onChangeNetworkLinkStatus(String status);
public static native void reportJavaCrash(String stack);
public static native void notifyUriVisited(String uri);
public static void notifyUriVisited(String uri) {
sendEventToGecko(new GeckoEvent(GeckoEvent.VISTITED, uri));
}
public static native void processNextNativeEvent();

View File

@@ -1,4 +1,4 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; -*-
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -80,6 +80,7 @@ public class GeckoEvent {
public static final int BROADCAST = 19;
public static final int VIEWPORT = 20;
public static final int TILE_SIZE = 21;
public static final int VISTITED = 22;
public static final int IME_COMPOSITION_END = 0;
public static final int IME_COMPOSITION_BEGIN = 1;
@@ -257,4 +258,8 @@ public class GeckoEvent {
mCharacters = uri;
}
public GeckoEvent(int type, String data) {
mType = type;
mCharacters = data;
}
}

View File

@@ -296,7 +296,6 @@ SHELL_WRAPPER1(onChangeNetworkLinkStatus, jstring)
SHELL_WRAPPER1(reportJavaCrash, jstring)
SHELL_WRAPPER0(executeNextRunnable)
SHELL_WRAPPER1(cameraCallbackBridge, jbyteArray)
SHELL_WRAPPER1(notifyUriVisited, jstring)
SHELL_WRAPPER3(notifyBatteryChange, jdouble, jboolean, jdouble);
SHELL_WRAPPER3(notifySmsReceived, jstring, jstring, jlong);
SHELL_WRAPPER0(bindWidgetTexture);
@@ -703,7 +702,6 @@ loadLibs(const char *apkName)
GETFUNC(reportJavaCrash);
GETFUNC(executeNextRunnable);
GETFUNC(cameraCallbackBridge);
GETFUNC(notifyUriVisited);
GETFUNC(notifyBatteryChange);
GETFUNC(notifySmsReceived);
GETFUNC(bindWidgetTexture);

View File

@@ -54,10 +54,6 @@
#include "mozilla/Services.h"
#include "nsINetworkLinkService.h"
#ifdef MOZ_ANDROID_HISTORY
#include "nsAndroidHistory.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#include "nsExceptionHandler.h"
@@ -214,14 +210,6 @@ Java_org_mozilla_gecko_GeckoAppShell_executeNextRunnable(JNIEnv *, jclass)
__android_log_print(ANDROID_LOG_INFO, "GeckoJNI", "leaving %s", __PRETTY_FUNCTION__);
}
NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_notifyUriVisited(JNIEnv *jenv, jclass, jstring uri)
{
#ifdef MOZ_ANDROID_HISTORY
nsAndroidHistory::NotifyURIVisited(nsJNIString(uri, jenv));
#endif
}
NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_notifyBatteryChange(JNIEnv* jenv, jclass,
jdouble aLevel,

View File

@@ -533,6 +533,7 @@ public:
BROADCAST = 19,
VIEWPORT = 20,
TILE_SIZE = 21,
VISITED = 22,
dummy_java_enum_list_end
};

View File

@@ -55,6 +55,10 @@
#include <pthread.h>
#include <wchar.h>
#ifdef MOZ_ANDROID_HISTORY
#include "nsAndroidHistory.h"
#endif
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG
#include "prlog.h"
@@ -445,6 +449,13 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
break;
}
case AndroidGeckoEvent::VISITED: {
#ifdef MOZ_ANDROID_HISTORY
nsAndroidHistory::NotifyURIVisited(nsString(curEvent->Characters()));
#endif
break;
}
default:
nsWindow::OnGlobalAndroidEvent(curEvent);
}