Split GeckoEmbed.java into two files, so GeckoEmbed just contains embedding functions. Better name for library. Use JAVA_HOME for location of Java includes. Not part of default build.

Original committer: pedemont%us.ibm.com
Original revision: 1.5
Original date: 2004/10/01 16:19:03
This commit is contained in:
pedemont%us.ibm.com 2006-09-27 15:09:39 +00:00
parent 9f80187767
commit 0a08313724

View File

@ -45,13 +45,14 @@
#include "nsIInputStream.h"
#include "nsEnumeratorUtils.h"
#define XPCOM_NATIVE(func) Java_org_mozilla_xpcom_GeckoEmbed_##func
#define GECKO_NATIVE(func) Java_org_mozilla_xpcom_GeckoEmbed_##func
#define XPCOM_NATIVE(func) Java_org_mozilla_xpcom_XPCOM_##func
PRBool gEmbeddingInitialized = PR_FALSE;
extern "C" JNIEXPORT void JNICALL
XPCOM_NATIVE(NS_1InitEmbedding) (JNIEnv* env, jclass, jobject aMozBinDirectory,
GECKO_NATIVE(NS_1InitEmbedding) (JNIEnv* env, jclass, jobject aMozBinDirectory,
jobject aAppFileLocProvider)
{
if (!InitializeJavaGlobals(env)) {
@ -94,7 +95,7 @@ XPCOM_NATIVE(NS_1InitEmbedding) (JNIEnv* env, jclass, jobject aMozBinDirectory,
}
extern "C" JNIEXPORT void JNICALL
XPCOM_NATIVE(NS_1TermEmbedding) (JNIEnv *env, jclass)
GECKO_NATIVE(NS_1TermEmbedding) (JNIEnv *env, jclass)
{
FreeJavaGlobals(env);
@ -111,7 +112,7 @@ XPCOM_NATIVE(NS_1TermEmbedding) (JNIEnv *env, jclass)
* NULL and just create it lazily.
*/
extern "C" JNIEXPORT jobject JNICALL
XPCOM_NATIVE(NS_1NewLocalFile) (JNIEnv *env, jclass, jstring aPath,
GECKO_NATIVE(NS_1NewLocalFile) (JNIEnv *env, jclass, jstring aPath,
jboolean aFollowLinks)
{
if (!InitializeJavaGlobals(env)) {
@ -161,7 +162,69 @@ XPCOM_NATIVE(NS_1NewLocalFile) (JNIEnv *env, jclass, jstring aPath,
}
extern "C" JNIEXPORT jobject JNICALL
XPCOM_NATIVE(NS_1NewSingletonEnumerator) (JNIEnv *env, jclass, jobject aSingleton)
GECKO_NATIVE(NS_1GetComponentManager) (JNIEnv *env, jclass)
{
jobject java_stub = nsnull;
// Call XPCOM method
nsCOMPtr<nsIComponentManager> cm;
nsresult rv = NS_GetComponentManager(getter_AddRefs(cm));
if (NS_SUCCEEDED(rv)) {
// wrap xpcom instance
JavaXPCOMInstance* inst;
inst = CreateJavaXPCOMInstance(cm, &NS_GET_IID(nsIComponentManager));
if (inst) {
// create java stub
java_stub = CreateJavaWrapper(env, "nsIComponentManager");
if (java_stub) {
// Associate XPCOM object w/ Java stub
AddJavaXPCOMBinding(env, java_stub, inst);
}
}
}
if (java_stub == nsnull)
ThrowXPCOMException(env, 0);
return java_stub;
}
extern "C" JNIEXPORT jobject JNICALL
GECKO_NATIVE(NS_1GetServiceManager) (JNIEnv *env, jclass)
{
jobject java_stub = nsnull;
// Call XPCOM method
nsCOMPtr<nsIServiceManager> sm;
nsresult rv = NS_GetServiceManager(getter_AddRefs(sm));
if (NS_SUCCEEDED(rv)) {
// wrap xpcom instance
JavaXPCOMInstance* inst;
inst = CreateJavaXPCOMInstance(sm, &NS_GET_IID(nsIServiceManager));
if (inst) {
// create java stub
java_stub = CreateJavaWrapper(env, "nsIServiceManager");
if (java_stub) {
// Associate XPCOM object w/ Java stub
AddJavaXPCOMBinding(env, java_stub, inst);
}
}
}
if (java_stub == nsnull)
ThrowXPCOMException(env, 0);
return java_stub;
}
extern "C" JNIEXPORT jobject JNICALL
GECKO_NATIVE(NS_1NewSingletonEnumerator) (JNIEnv *env, jclass, jobject aSingleton)
{
void* inst = GetMatchingXPCOMObject(env, aSingleton);
if (inst == nsnull) {
@ -218,68 +281,6 @@ XPCOM_NATIVE(NS_1NewSingletonEnumerator) (JNIEnv *env, jclass, jobject aSingleto
return java_stub;
}
extern "C" JNIEXPORT jobject JNICALL
XPCOM_NATIVE(NS_1GetComponentManager) (JNIEnv *env, jclass)
{
jobject java_stub = nsnull;
// Call XPCOM method
nsCOMPtr<nsIComponentManager> cm;
nsresult rv = NS_GetComponentManager(getter_AddRefs(cm));
if (NS_SUCCEEDED(rv)) {
// wrap xpcom instance
JavaXPCOMInstance* inst;
inst = CreateJavaXPCOMInstance(cm, &NS_GET_IID(nsIComponentManager));
if (inst) {
// create java stub
java_stub = CreateJavaWrapper(env, "nsIComponentManager");
if (java_stub) {
// Associate XPCOM object w/ Java stub
AddJavaXPCOMBinding(env, java_stub, inst);
}
}
}
if (java_stub == nsnull)
ThrowXPCOMException(env, 0);
return java_stub;
}
extern "C" JNIEXPORT jobject JNICALL
XPCOM_NATIVE(NS_1GetServiceManager) (JNIEnv *env, jclass)
{
jobject java_stub = nsnull;
// Call XPCOM method
nsCOMPtr<nsIServiceManager> sm;
nsresult rv = NS_GetServiceManager(getter_AddRefs(sm));
if (NS_SUCCEEDED(rv)) {
// wrap xpcom instance
JavaXPCOMInstance* inst;
inst = CreateJavaXPCOMInstance(sm, &NS_GET_IID(nsIServiceManager));
if (inst) {
// create java stub
java_stub = CreateJavaWrapper(env, "nsIServiceManager");
if (java_stub) {
// Associate XPCOM object w/ Java stub
AddJavaXPCOMBinding(env, java_stub, inst);
}
}
}
if (java_stub == nsnull)
ThrowXPCOMException(env, 0);
return java_stub;
}
// JNI wrapper for calling an nsWriteSegmentFun function
extern "C" JNIEXPORT jint JNICALL
XPCOM_NATIVE(nsWriteSegmentFun) (JNIEnv *env, jclass that, jint aWriterFunc,