static unsafe void _sendPlatformMessageCallback(IntPtr callbackHandle, byte *data, int dataLength) { GCHandle handle = (GCHandle)callbackHandle; var callback = (PlatformMessageResponseCallback)handle.Target; handle.Free(); if (!Isolate.checkExists()) { return; } byte[] bytes = null; if (data != null && dataLength != 0) { bytes = new byte[dataLength]; Marshal.Copy((IntPtr)data, bytes, 0, dataLength); } try { callback(bytes); } catch (Exception ex) { Debug.LogException(ex); } }
protected void _setPtr(IntPtr ptr) { D.assert(ptr != IntPtr.Zero); _ptr = ptr; _isolate = Isolate.current; _isolate.addNativeWrapper(this); }
static void Mono_shutdown(IntPtr isolate) { try { Isolate.shutdown(isolate); } catch (Exception ex) { Debug.LogException(ex); } }
static void _toImageCallback(IntPtr callbackHandle, IntPtr result) { GCHandle handle = (GCHandle)callbackHandle; var callback = (_Callback <Image>)handle.Target; handle.Free(); if (!Isolate.checkExists()) { return; } try { callback(result == IntPtr.Zero ? null : new Image(result)); } catch (Exception ex) { Debug.LogException(ex); } }
public static IDisposable getScope(Isolate isolate) { D.assert(isolate != null && isolate.isValid); return(new _IsolateDisposable(isolate._ptr)); }