Bug 366617 - Crash when running JavaXPCOM in IBM JVM; Bug 335696 - Provide helper method for embedding in AWT/Swing. a=jay. XULRunner only. Not part of default build.
git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@218602 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -50,6 +50,10 @@
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsILocalFile.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include "jawt.h"
|
||||
#endif
|
||||
|
||||
// profile support
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
@@ -74,7 +78,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
extern "C" NS_EXPORT void
|
||||
extern "C" NS_EXPORT void JNICALL
|
||||
MOZILLA_NATIVE(initialize) (JNIEnv* env, jobject)
|
||||
{
|
||||
if (!InitializeJavaGlobals(env)) {
|
||||
@@ -116,7 +120,7 @@ InitEmbedding_Impl(JNIEnv* env, jobject aLibXULDirectory,
|
||||
return XRE_InitEmbedding(libXULDir, appDir, provider, nsnull, 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT void
|
||||
extern "C" NS_EXPORT void JNICALL
|
||||
GRE_NATIVE(initEmbedding) (JNIEnv* env, jobject, jobject aLibXULDirectory,
|
||||
jobject aAppDirectory, jobject aAppDirProvider)
|
||||
{
|
||||
@@ -129,7 +133,7 @@ GRE_NATIVE(initEmbedding) (JNIEnv* env, jobject, jobject aLibXULDirectory,
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT void
|
||||
extern "C" NS_EXPORT void JNICALL
|
||||
GRE_NATIVE(termEmbedding) (JNIEnv *env, jobject)
|
||||
{
|
||||
if (profileNotified) {
|
||||
@@ -170,7 +174,7 @@ GRE_NATIVE(termEmbedding) (JNIEnv *env, jobject)
|
||||
XRE_TermEmbedding();
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT jobject
|
||||
extern "C" NS_EXPORT jobject JNICALL
|
||||
GRE_NATIVE(lockProfileDirectory) (JNIEnv* env, jobject, jobject aDirectory)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
@@ -203,7 +207,7 @@ GRE_NATIVE(lockProfileDirectory) (JNIEnv* env, jobject, jobject aDirectory)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT void
|
||||
extern "C" NS_EXPORT void JNICALL
|
||||
GRE_NATIVE(notifyProfile) (JNIEnv *env, jobject)
|
||||
{
|
||||
if (!profileNotified) {
|
||||
@@ -261,7 +265,7 @@ InitXPCOM_Impl(JNIEnv* env, jobject aMozBinDirectory,
|
||||
nsnull, aResult);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT jobject
|
||||
extern "C" NS_EXPORT jobject JNICALL
|
||||
XPCOM_NATIVE(initXPCOM) (JNIEnv* env, jobject, jobject aMozBinDirectory,
|
||||
jobject aAppFileLocProvider)
|
||||
{
|
||||
@@ -276,7 +280,7 @@ XPCOM_NATIVE(initXPCOM) (JNIEnv* env, jobject, jobject aMozBinDirectory,
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT void
|
||||
extern "C" NS_EXPORT void JNICALL
|
||||
XPCOM_NATIVE(shutdownXPCOM) (JNIEnv *env, jobject, jobject aServMgr)
|
||||
{
|
||||
nsresult rv;
|
||||
@@ -300,7 +304,7 @@ XPCOM_NATIVE(shutdownXPCOM) (JNIEnv *env, jobject, jobject aServMgr)
|
||||
ThrowException(env, rv, "NS_ShutdownXPCOM failed");
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT jobject
|
||||
extern "C" NS_EXPORT jobject JNICALL
|
||||
XPCOM_NATIVE(newLocalFile) (JNIEnv *env, jobject, jstring aPath,
|
||||
jboolean aFollowLinks)
|
||||
{
|
||||
@@ -331,7 +335,7 @@ XPCOM_NATIVE(newLocalFile) (JNIEnv *env, jobject, jstring aPath,
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT jobject
|
||||
extern "C" NS_EXPORT jobject JNICALL
|
||||
XPCOM_NATIVE(getComponentManager) (JNIEnv *env, jobject)
|
||||
{
|
||||
// Call XPCOM method
|
||||
@@ -350,7 +354,7 @@ XPCOM_NATIVE(getComponentManager) (JNIEnv *env, jobject)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT jobject
|
||||
extern "C" NS_EXPORT jobject JNICALL
|
||||
XPCOM_NATIVE(getComponentRegistrar) (JNIEnv *env, jobject)
|
||||
{
|
||||
// Call XPCOM method
|
||||
@@ -369,7 +373,7 @@ XPCOM_NATIVE(getComponentRegistrar) (JNIEnv *env, jobject)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT jobject
|
||||
extern "C" NS_EXPORT jobject JNICALL
|
||||
XPCOM_NATIVE(getServiceManager) (JNIEnv *env, jobject)
|
||||
{
|
||||
// Call XPCOM method
|
||||
@@ -388,3 +392,41 @@ XPCOM_NATIVE(getServiceManager) (JNIEnv *env, jobject)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
extern PRUint64 GetPlatformHandle(JAWT_DrawingSurfaceInfo* dsi);
|
||||
#endif
|
||||
|
||||
extern "C" NS_EXPORT jlong JNICALL
|
||||
MOZILLA_NATIVE(getNativeHandleFromAWT) (JNIEnv* env, jobject clazz,
|
||||
jobject widget)
|
||||
{
|
||||
PRUint64 handle = 0;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
JAWT awt;
|
||||
awt.version = JAWT_VERSION_1_4;
|
||||
jboolean result = JAWT_GetAWT(env, &awt);
|
||||
if (result == JNI_FALSE)
|
||||
return 0;
|
||||
|
||||
JAWT_DrawingSurface* ds = awt.GetDrawingSurface(env, widget);
|
||||
if (ds != nsnull) {
|
||||
jint lock = ds->Lock(ds);
|
||||
if (!(lock & JAWT_LOCK_ERROR)) {
|
||||
JAWT_DrawingSurfaceInfo* dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||
if (dsi) {
|
||||
handle = GetPlatformHandle(dsi);
|
||||
ds->FreeDrawingSurfaceInfo(dsi);
|
||||
}
|
||||
|
||||
ds->Unlock(ds);
|
||||
}
|
||||
|
||||
awt.FreeDrawingSurface(ds);
|
||||
}
|
||||
#else
|
||||
NS_WARNING("getNativeHandleFromAWT JNI method not implemented");
|
||||
#endif
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user