GCHandle.h 947 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <stdint.h>
  3. struct Il2CppObject;
  4. namespace il2cpp
  5. {
  6. namespace gc
  7. {
  8. enum GCHandleType
  9. {
  10. HANDLE_WEAK,
  11. HANDLE_WEAK_TRACK,
  12. HANDLE_NORMAL,
  13. HANDLE_PINNED
  14. };
  15. class LIBIL2CPP_CODEGEN_API GCHandle
  16. {
  17. public:
  18. // external
  19. static uint32_t New(Il2CppObject *obj, bool pinned);
  20. static uint32_t NewWeakref(Il2CppObject *obj, bool track_resurrection);
  21. static Il2CppObject* GetTarget(uint32_t gchandle);
  22. static GCHandleType GetHandleType(uint32_t gcHandle);
  23. static void Free(uint32_t gchandle);
  24. public:
  25. //internal
  26. static int32_t GetTargetHandle(Il2CppObject * obj, int32_t handle, int32_t type);
  27. typedef void(*WalkGCHandleTargetsCallback)(Il2CppObject* obj, void* context);
  28. static void WalkStrongGCHandleTargets(WalkGCHandleTargetsCallback callback, void* context);
  29. };
  30. } /* gc */
  31. } /* il2cpp */