void SetInfo(Type* type, ValueLocation* location) { if (type != NULL) type->AcquireReference(); if (location != NULL) location->AcquireReference(); if (this->type != NULL) this->type->ReleaseReference(); if (this->location != NULL) this->location->ReleaseReference(); this->type = type; this->location = location; }
status_t TeamDebugInfo::GetType(GlobalTypeCache* cache, const BString& name, const TypeLookupConstraints& constraints, Type*& _type) { // maybe the type is already cached AutoLocker<GlobalTypeCache> cacheLocker(cache); Type* type = cache->GetType(name, constraints); if (type != NULL) { type->AcquireReference(); _type = type; return B_OK; } cacheLocker.Unlock(); // Clone the image list and get references to the images, so we can iterate // through them without locking. AutoLocker<BLocker> locker(fLock); ImageList images; for (int32 i = 0; ImageDebugInfo* imageDebugInfo = fImages.ItemAt(i); i++) { if (images.AddItem(imageDebugInfo)) imageDebugInfo->AcquireReference(); } locker.Unlock(); // get the type status_t error = B_ENTRY_NOT_FOUND; for (int32 i = 0; ImageDebugInfo* imageDebugInfo = images.ItemAt(i); i++) { error = imageDebugInfo->GetType(cache, name, constraints, type); if (error == B_OK) { _type = type; break; } } // release the references for (int32 i = 0; ImageDebugInfo* imageDebugInfo = images.ItemAt(i); i++) imageDebugInfo->ReleaseReference(); return error; }
TypeEntry(Type* type) : type(type) { type->AcquireReference(); }