[not part of build] Major cleanup, removal of unnecessary methods, correct implementation of nsIPlugin/nsIJVMPlugin interfaces.

This commit is contained in:
beard%netscape.com 2001-10-18 07:34:20 +00:00
Родитель dba735d27b
Коммит 25558b53e7
2 изменённых файлов: 8 добавлений и 112 удалений

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

@ -345,11 +345,6 @@ NS_METHOD MRJPlugin::GetValue(nsPluginVariable variable, void *value)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_METHOD MRJPlugin::SetValue(nsPluginVariable variable, void *value)
{
return NS_ERROR_FAILURE;
}
MRJSession* MRJPlugin::getSession()
{
StartupJVM();
@ -372,36 +367,9 @@ NS_METHOD MRJPlugin::StartupJVM()
// start a session with MRJ.
mSession = new MRJSession();
#if 0
// Apply the initialization args.
if (initArgs != NULL && initArgs->version >= nsJVMInitArgs_Version) {
const char* classPathAdditions = initArgs->classpathAdditions;
if (classPathAdditions != NULL) {
// what format will this be in? UNIX paths, separated by ':' characters.
char* paths = new char[1 + strlen(classPathAdditions)];
if (paths != NULL) {
strcpy(paths, classPathAdditions);
char* path = strtok(paths, ":");
while (path != NULL) {
static char urlPrefix[] = { "file://" };
char* fileURL = new char[sizeof(urlPrefix) + strlen(path)];
if (fileURL != NULL) {
strcat(strcpy(fileURL, urlPrefix), path);
mSession->addURLToClassPath(fileURL);
delete[] fileURL;
}
path = strtok(NULL, ":");
}
delete[] paths;
}
}
}
#endif
// Add "MRJPlugin.jar" to the class path.
FSSpec jarFileSpec = { thePluginSpec.vRefNum, thePluginSpec.parID, "\pMRJPlugin.jar" };
mSession->addToClassPath(jarFileSpec);
mSession->open();
if (mSession->getStatus() != noErr) {
@ -426,19 +394,6 @@ NS_METHOD MRJPlugin::StartupJVM()
return NS_OK;
}
NS_METHOD MRJPlugin::ShutdownJVM(PRBool fullShutdown)
{
if (fullShutdown) {
nsresult rv = ShutdownLiveConnectSupport();
if (mSession != NULL) {
delete mSession;
mSession = NULL;
}
}
return NS_OK;
}
NS_METHOD MRJPlugin::AddToClassPath(const char* dirPath)
{
if (mSession != NULL) {
@ -463,44 +418,6 @@ NS_METHOD MRJPlugin::GetJavaWrapper(JNIEnv* env, jint jsobj, jobject *jobj)
return NS_OK;
}
NS_METHOD MRJPlugin::UnwrapJavaWrapper(JNIEnv* jenv, jobject jobj, jint* obj)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_METHOD MRJPlugin::GetJavaVM(JavaVM* *result)
{
*result = NULL;
if (StartupJVM() == NS_OK) {
*result = mSession->getJavaVM();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
nsrefcnt MRJPlugin::GetJNIEnv(JNIEnv* *result)
{
JNIEnv* env = NULL;
if (StartupJVM() == NS_OK) {
#if 1
env = mSession->getCurrentEnv();
#else
JDK1_1AttachArgs args;
JavaVM* vm = mSession->getJavaVM();
jint result = vm->AttachCurrentThread(&env, &args);
if (result != 0)
env = NULL;
#endif
}
*result = env;
return 1;
}
nsrefcnt MRJPlugin::ReleaseJNIEnv(JNIEnv* env)
{
return 0;
}
NS_METHOD MRJPlugin::CreateSecureEnv(JNIEnv* proxyEnv, nsISecureEnv* *outSecureEnv)
{
*outSecureEnv = NULL;
@ -513,6 +430,11 @@ NS_METHOD MRJPlugin::CreateSecureEnv(JNIEnv* proxyEnv, nsISecureEnv* *outSecureE
return rv;
}
NS_METHOD MRJPlugin::UnwrapJavaWrapper(JNIEnv* jenv, jobject jobj, jint* obj)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_METHOD MRJPlugin::SpendTime(PRUint32 timeMillis)
{
nsresult result = NS_OK;

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

@ -157,10 +157,6 @@ public:
NS_IMETHOD
GetValue(nsPluginVariable variable, void *value);
// (Corresponds to NPP_SetValue.)
NS_IMETHOD
SetValue(nsPluginVariable variable, void *value);
// JVM Plugin Methods.
// This method us used to start the Java virtual machine.
@ -171,13 +167,6 @@ public:
NS_IMETHOD
StartupJVM(void);
// This method us used to stop the Java virtual machine.
// It tears down any global state necessary to host Java programs.
// The fullShutdown flag specifies whether the browser is quitting
// (PR_TRUE) or simply whether the JVM is being shut down (PR_FALSE).
NS_IMETHOD
ShutdownJVM(PRBool fullShutdown);
// Causes the JVM to append a new directory to its classpath.
// If the JVM doesn't support this operation, an error is returned.
NS_IMETHOD
@ -198,21 +187,6 @@ public:
NS_IMETHOD
GetJavaWrapper(JNIEnv* env, jint jsobj, jobject *jobj);
NS_IMETHOD
GetJavaVM(JavaVM* *result);
// nsIJNIPlugin Methods.
// Find or create a JNIEnv for the current thread.
// Returns NULL if an error occurs.
NS_IMETHOD_(nsrefcnt)
GetJNIEnv(JNIEnv* *result);
// This method must be called when the caller is done using the JNIEnv.
// This decrements a refcount associated with it may free it.
NS_IMETHOD_(nsrefcnt)
ReleaseJNIEnv(JNIEnv* env);
/**
* This creates a new secure communication channel with Java. The second parameter,
* nativeEnv, if non-NULL, will be the actual thread for Java communication.
@ -230,6 +204,9 @@ public:
NS_IMETHOD
SpendTime(PRUint32 timeMillis);
NS_IMETHOD
UnwrapJavaWrapper(JNIEnv* jenv, jobject jobj, jint* obj);
/**
* The Run method gives time to the JVM periodically. This makes SpendTIme() obsolete.
*/
@ -247,9 +224,6 @@ public:
Boolean inPluginThread();
NS_IMETHOD
UnwrapJavaWrapper(JNIEnv* jenv, jobject jobj, jint* obj);
private:
nsIJVMManager* mManager;
nsIThreadManager* mThreadManager;