Added NS_NewArray function. Used by testcase. Not part of default build.

This commit is contained in:
pedemont%us.ibm.com 2004-10-01 22:59:12 +00:00
Родитель 006bb3fd05
Коммит 032c5f79ed
2 изменённых файлов: 34 добавлений и 0 удалений

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

@ -44,5 +44,7 @@ public final class GeckoEmbed {
public static native nsILocalFile NS_NewLocalFile(String aPath, boolean followLinks);
public static native nsIComponentManager NS_GetComponentManager();
public static native nsIServiceManager NS_GetServiceManager();
public static native nsISimpleEnumerator NS_NewSingletonEnumerator(nsISupports aSingleton);
public static native nsIMutableArray NS_NewArray();
}

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

@ -44,6 +44,7 @@
#include "nsIInterfaceInfoManager.h"
#include "nsIInputStream.h"
#include "nsEnumeratorUtils.h"
#include "nsArray.h"
#define GECKO_NATIVE(func) Java_org_mozilla_xpcom_GeckoEmbed_##func
#define XPCOM_NATIVE(func) Java_org_mozilla_xpcom_XPCOM_##func
@ -281,6 +282,37 @@ GECKO_NATIVE(NS_1NewSingletonEnumerator) (JNIEnv *env, jclass, jobject aSingleto
return java_stub;
}
extern "C" JNIEXPORT jobject JNICALL
GECKO_NATIVE(NS_1NewArray) (JNIEnv *env, jclass)
{
jobject java_stub = nsnull;
// Call XPCOM method
nsCOMPtr<nsIMutableArray> array;
nsresult rv = NS_NewArray(getter_AddRefs(array));
if (NS_SUCCEEDED(rv)) {
// wrap xpcom instance
JavaXPCOMInstance* inst;
inst = CreateJavaXPCOMInstance(array, &NS_GET_IID(nsIMutableArray));
if (inst) {
// create java stub
java_stub = CreateJavaWrapper(env, "nsIMutableArray");
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,