MCPcopy Create free account
hub / github.com/anjo76/angelscript / EnumReferences

Method EnumReferences

sdk/add_on/scriptgrid/scriptgrid.cpp:728–758  ·  view source on GitHub ↗

GC behaviour

Source from the content-addressed store, hash-verified

726
727// GC behaviour
728void CScriptGrid::EnumReferences(asIScriptEngine *engine)
729{
730 if( buffer == 0 ) return;
731
732 // If the grid is holding handles, then we need to notify the GC of them
733 if (subTypeId & asTYPEID_MASK_OBJECT)
734 {
735 asUINT numElements = buffer->width * buffer->height;
736 void **d = (void**)buffer->data;
737 asITypeInfo *subType = engine->GetTypeInfoById(subTypeId);
738 if ((subType->GetFlags() & asOBJ_REF))
739 {
740 // For reference types we need to notify the GC of each instance
741 for (asUINT n = 0; n < numElements; n++)
742 {
743 if (d[n])
744 engine->GCEnumCallback(d[n]);
745 }
746 }
747 else if ((subType->GetFlags() & asOBJ_VALUE) && (subType->GetFlags() & asOBJ_GC))
748 {
749 // For value types we need to forward the enum callback
750 // to the object so it can decide what to do
751 for (asUINT n = 0; n < numElements; n++)
752 {
753 if (d[n])
754 engine->ForwardGCEnumReferences(d[n], subType);
755 }
756 }
757 }
758}
759
760// GC behaviour
761void CScriptGrid::ReleaseAllHandles(asIScriptEngine*)

Callers

nothing calls this directly

Calls 4

GetTypeInfoByIdMethod · 0.80
GetFlagsMethod · 0.80
GCEnumCallbackMethod · 0.45

Tested by

no test coverage detected