Lines Matching refs:entry
61 ObjectRegistryEntry* entry = nullptr; in InternalAdd() local
62 if (ContainsLocked(soa.Self(), obj_h.Get(), identity_hash_code, &entry)) { in InternalAdd()
64 ++entry->reference_count; in InternalAdd()
66 entry = new ObjectRegistryEntry; in InternalAdd()
67 entry->jni_reference_type = JNIWeakGlobalRefType; in InternalAdd()
68 entry->jni_reference = nullptr; in InternalAdd()
69 entry->reference_count = 0; in InternalAdd()
70 entry->id = 0; in InternalAdd()
71 entry->identity_hash_code = identity_hash_code; in InternalAdd()
72 object_to_entry_.insert(std::make_pair(identity_hash_code, entry)); in InternalAdd()
79 entry->jni_reference_type = JNIWeakGlobalRefType; in InternalAdd()
80 entry->jni_reference = env->NewWeakGlobalRef(local_reference); in InternalAdd()
81 entry->reference_count = 1; in InternalAdd()
82 entry->id = next_id_++; in InternalAdd()
84 id_to_entry_.Put(entry->id, entry); in InternalAdd()
88 return entry->id; in InternalAdd()
96 ObjectRegistryEntry* entry = it->second; in ContainsLocked() local
97 if (o == self->DecodeJObject(entry->jni_reference)) { in ContainsLocked()
99 *out_entry = entry; in ContainsLocked()
114 const ObjectRegistryEntry* entry = pair.second; in Clear() local
115 if (entry->jni_reference_type == JNIWeakGlobalRefType) { in Clear()
116 env->DeleteWeakGlobalRef(entry->jni_reference); in Clear()
118 env->DeleteGlobalRef(entry->jni_reference); in Clear()
120 delete entry; in Clear()
134 ObjectRegistryEntry& entry = *it->second; in InternalGet() local
135 return self->DecodeJObject(entry.jni_reference); in InternalGet()
146 ObjectRegistryEntry& entry = *it->second; in GetJObject() local
147 return entry.jni_reference; in GetJObject()
166 void ObjectRegistry::Demote(ObjectRegistryEntry& entry) { in Demote() argument
167 if (entry.jni_reference_type == JNIGlobalRefType) { in Demote()
170 jobject global = entry.jni_reference; in Demote()
171 entry.jni_reference = env->NewWeakGlobalRef(entry.jni_reference); in Demote()
172 entry.jni_reference_type = JNIWeakGlobalRefType; in Demote()
177 void ObjectRegistry::Promote(ObjectRegistryEntry& entry) { in Promote() argument
178 if (entry.jni_reference_type == JNIWeakGlobalRefType) { in Promote()
181 jobject weak = entry.jni_reference; in Promote()
182 entry.jni_reference = env->NewGlobalRef(entry.jni_reference); in Promote()
183 entry.jni_reference_type = JNIGlobalRefType; in Promote()
193 ObjectRegistryEntry& entry = *it->second; in IsCollected() local
194 if (entry.jni_reference_type == JNIWeakGlobalRefType) { in IsCollected()
196 return env->IsSameObject(entry.jni_reference, NULL); // Has the jweak been collected? in IsCollected()
209 ObjectRegistryEntry* entry = it->second; in DisposeObject() local
210 entry->reference_count -= reference_count; in DisposeObject()
211 if (entry->reference_count <= 0) { in DisposeObject()
215 int32_t hash_code = entry->identity_hash_code; in DisposeObject()
218 if (entry == it->second) { in DisposeObject()
223 if (entry->jni_reference_type == JNIWeakGlobalRefType) { in DisposeObject()
224 env->DeleteWeakGlobalRef(entry->jni_reference); in DisposeObject()
226 env->DeleteGlobalRef(entry->jni_reference); in DisposeObject()
229 delete entry; in DisposeObject()