GC behaviour
| 726 | |
| 727 | // GC behaviour |
| 728 | void 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 |
| 761 | void CScriptGrid::ReleaseAllHandles(asIScriptEngine*) |
nothing calls this directly
no test coverage detected