This change-bundle fixes memory allocation in streams. Next step is to

make a final pass to make sure we are not leaking memory.  After that, I
want to clean up the build system, and the samples.

M build.xml

- Call make export in mozilla directory

- Fix clean target

M mozilla/Makefile.in

- Added export target
M classes/org/mozilla/pluglet/PlugletLoader.java

- avoid ambiguity by casting

+	    CodeSource codesource = new CodeSource(url,(java.security.cert.Certificate []) null);

M examples/MediaPlayer/JMPlayer.java

- remove debug printfs

M mozilla/npAPInsIInputStreamShim.cpp
M mozilla/npAPInsIInputStreamShim.h

- remove debug printfs

- fix buffer allocation, refactor into its own method.

- Use NPN_Mem* methods for memory allocation.

- isolate lock access to private methods.  Avoids locking when we
  already own the lock, which would cause an assertion.

M mozilla/nppluglet.cpp

- in dtor, check for null mScriptablePeer ivar before accessing it.

M mozilla/nsScriptablePeer.cpp

- whitespace

M src/Pluglet.cpp

- get the plugletEngine from do_GetService().

M src/PlugletEngine.cpp
M src/PlugletFactory.cpp
M src/PlugletLoader.cpp

- remove debug printfs

M test/test.java

- added test finalize.


build.xml classes/org/mozilla/pluglet/PlugletLoader.java examples/MediaPlayer/JMPlayer.java mozilla/Makefile.in mozilla/npAPInsIInputStreamShim.cpp mozilla/npAPInsIInputStreamShim.h mozilla/nppluglet.cpp mozilla/nsScriptablePeer.cpp src/Pluglet.cpp src/PlugletEngine.cpp src/PlugletFactory.cpp src/PlugletLoader.cpp test/test.java


git-svn-id: svn://10.0.0.236/trunk@214609 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
2006-11-02 18:55:50 +00:00
parent c966cb3fa5
commit fbd0e42fb9
13 changed files with 168 additions and 131 deletions

View File

@@ -74,14 +74,20 @@ Pluglet::~Pluglet() {
Registry::Remove(jthis);
JNIEnv *jniEnv = nsnull;
nsresult rv;
rv = plugletEngine->GetJNIEnv(&jniEnv);
if (NS_FAILED(rv)) {
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
("Pluglet::~Pluglet: plugletEngine->GetJNIEnv failed\n"));
return;
plugletEngine = do_GetService(PLUGLETENGINE_ContractID, &rv);
if (plugletEngine) {
rv = plugletEngine->GetJNIEnv(&jniEnv);
if (NS_FAILED(rv)) {
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
("Pluglet::~Pluglet: plugletEngine->GetJNIEnv failed\n"));
return;
}
jniEnv->DeleteGlobalRef(jthis);
if (jniEnv->ExceptionOccurred()) {
jniEnv->ExceptionDescribe();
}
}
jniEnv->DeleteGlobalRef(jthis);
peer = nsnull;
}

View File

@@ -369,8 +369,6 @@ iPlugletEngine::GetInstance(void ** result)
NS_GET_IID(iPlugletEngine),
(void **) &result);
printf("debug: edburns: plugletEngine instance rv: %d\n", rv);
printf("debug: edburns: plugletEngine instance result: %p\n", *result);
if (NS_FAILED(rv)) {
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
("Pluglet::PlugletFactory: Cannot access iPlugletEngine service\n"));

View File

@@ -164,13 +164,11 @@ PlugletFactory::PlugletFactory(const char *mimeDescription, const char *path) :
nsresult rv = NS_ERROR_FAILURE;
plugletEngine = do_GetService(PLUGLETENGINE_ContractID, &rv);
printf("debug: edburns: PlugletFactory ctor: rv: %d\n", rv);
if (NS_FAILED(rv)) {
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
("Pluglet::PlugletFactory: Cannot access iPlugletEngine service\n"));
return;
}
printf("debug: edburns: PlugletFactory ctor: this: %p\n", this);
}
PlugletFactory::~PlugletFactory(void) {

View File

@@ -55,9 +55,6 @@ NS_EXPORT void PlugletLoader::Initialize(void) {
nsCOMPtr<iPlugletEngine> plugletEngine =
do_GetService(PLUGLETENGINE_ContractID, &rv);
printf("debug: edburns: plugletEngine: %p", plugletEngine.get());
if (NS_FAILED(rv)) {
return;
}
@@ -144,7 +141,6 @@ char * PlugletLoader::GetMIMEDescription(const char * path) {
const char* str = env->GetStringUTFChars(mimeDescription,nsnull);
printf("debug: edburns: mime description: %s\n", str);
char *res = nsnull;
if(str) {
res = new char[strlen(str)+1];