NativeDelegateMethodCache.h 665 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include "il2cpp-api-types.h"
  3. #include "il2cpp-vm-support.h"
  4. #include "os/Mutex.h"
  5. #include <map>
  6. namespace il2cpp
  7. {
  8. namespace utils
  9. {
  10. typedef std::map<Il2CppMethodPointer, const VmMethod*> NativeDelegateMap;
  11. class NativeDelegateMethodCache
  12. {
  13. public:
  14. static const VmMethod* GetNativeDelegate(Il2CppMethodPointer nativeFunctionPointer);
  15. static void AddNativeDelegate(Il2CppMethodPointer nativeFunctionPointer, const VmMethod* managedMethodInfo);
  16. private:
  17. static il2cpp::os::FastMutex m_CacheMutex;
  18. static NativeDelegateMap m_NativeDelegateMethods;
  19. };
  20. } // namespace utils
  21. } // namespace il2cpp