зеркало из https://github.com/mozilla/pjs.git
Implement IID for nsJavaXPTCStub. Return associated Java object if returning nsJavaXPTCStub.
Original committer: pedemont%us.ibm.com Original revision: 1.10 Original date: 2004/10/18 17:04:29
This commit is contained in:
Родитель
dd070f084a
Коммит
45c744033d
|
@ -257,18 +257,34 @@ GetMatchingXPCOMObject(JNIEnv* env, jobject aJavaObject)
|
|||
jobject
|
||||
GetMatchingJavaObject(JNIEnv* env, void* aXPCOMObject)
|
||||
{
|
||||
jobject java_obj = nsnull;
|
||||
nsISupports* xpcom_obj = NS_STATIC_CAST(nsISupports*, aXPCOMObject);
|
||||
|
||||
nsJavaXPTCStub* stub = nsnull;
|
||||
xpcom_obj->QueryInterface(NS_GET_IID(nsJavaXPTCStub), (void**) &stub);
|
||||
if (stub) {
|
||||
java_obj = stub->GetJavaObject();
|
||||
NS_ASSERTION(java_obj != nsnull, "nsJavaXPTCStub w/o matching Java object");
|
||||
NS_RELEASE(stub);
|
||||
}
|
||||
|
||||
if (java_obj == nsnull) {
|
||||
JavaXPCOMBindingEntry *entry =
|
||||
NS_STATIC_CAST(JavaXPCOMBindingEntry*,
|
||||
PL_DHashTableOperate(gXPCOMtoJAVABindings, aXPCOMObject,
|
||||
PL_DHASH_LOOKUP));
|
||||
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
|
||||
LOG("< Get Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x)\n",
|
||||
env->CallIntMethod(entry->mJavaObject, hashCodeMID), (int) aXPCOMObject);
|
||||
return entry->mJavaObject;
|
||||
java_obj = entry->mJavaObject;
|
||||
}
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
if (java_obj) {
|
||||
LOG("< Get Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x)\n",
|
||||
env->CallIntMethod(java_obj, hashCodeMID), (int) aXPCOMObject);
|
||||
}
|
||||
|
||||
return java_obj;
|
||||
}
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче