зеркало из https://github.com/mozilla/gecko-dev.git
Store the key in the hash entry struct so that it works better with stub hash functions. Not part of default build.
Original committer: pedemont%us.ibm.com Original revision: 1.5 Original date: 2004/09/30 23:20:34
This commit is contained in:
Родитель
d581a4943b
Коммит
b0d3f3940b
|
@ -108,6 +108,9 @@ jclass exceptionClass = nsnull;
|
|||
class JavaXPCOMBindingEntry : public PLDHashEntryHdr
|
||||
{
|
||||
public:
|
||||
// mKey will either be a Java hash of the Java object, or the address of
|
||||
// the XPCOM object, depending on which hash table this entry is used in.
|
||||
const void* mKey;
|
||||
jobject mJavaObject;
|
||||
void* mXPCOMInstance;
|
||||
};
|
||||
|
@ -123,6 +126,7 @@ InitJAVAtoXPCOMBindingEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
|
|||
NS_CONST_CAST(JavaXPCOMBindingEntry *,
|
||||
NS_STATIC_CAST(const JavaXPCOMBindingEntry *, entry));
|
||||
|
||||
e->mKey = key;
|
||||
e->mJavaObject = NS_CONST_CAST(jobject,
|
||||
NS_STATIC_CAST(const __jobject*, key));
|
||||
e->mXPCOMInstance = nsnull;
|
||||
|
@ -138,6 +142,7 @@ InitXPCOMtoJAVABindingEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
|
|||
NS_CONST_CAST(JavaXPCOMBindingEntry *,
|
||||
NS_STATIC_CAST(const JavaXPCOMBindingEntry *, entry));
|
||||
|
||||
e->mKey = key;
|
||||
e->mXPCOMInstance = NS_CONST_CAST(void*, key);
|
||||
e->mJavaObject = nsnull;
|
||||
|
||||
|
@ -147,6 +152,9 @@ InitXPCOMtoJAVABindingEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
|
|||
void
|
||||
AddJavaXPCOMBinding(JNIEnv* env, jobject aJavaObject, void* aXPCOMObject)
|
||||
{
|
||||
// We use a Java hash of the Java object as a key since the JVM can return
|
||||
// different "addresses" for the same Java object, but the hash code (the
|
||||
// result of calling |hashCode()| on the Java object) will always be the same.
|
||||
jint hash = env->CallIntMethod(aJavaObject, hashCodeMID);
|
||||
|
||||
JavaXPCOMBindingEntry *entry =
|
||||
|
|
Загрузка…
Ссылка в новой задаче