private unsafe static cef_base_scoped_t *Allocate(int size) { cef_base_scoped_t *instance = (cef_base_scoped_t *)CefStructure.Allocate(size); instance->del = (void *)Marshal.GetFunctionPointerForDelegate(fnDel); return(instance); }
/// <summary> /// Initializes a new instance of <see cref="CefBaseScoped"/> using /// the pointer to scaped CEF struct. /// </summary> /// <param name="instance">The pointer to a scoped CEF struct.</param> /// <exception cref="NullReferenceException"><paramref name="instance"/> is null.</exception> public CefBaseScoped(cef_base_scoped_t *instance) { if (instance == null) { throw new ArgumentNullException(nameof(instance)); } _instance = instance; }
#pragma warning restore CS1591 private unsafe static void DelImpl(cef_base_scoped_t *self) { CefBaseScoped instance; lock (Scope) { Scope.TryGetValue((IntPtr)self, out instance); } ((IDisposable)instance)?.Dispose(); }
private protected unsafe static cef_base_scoped_t *Allocate(int size) { cef_base_scoped_t *instance = (cef_base_scoped_t *)CefStructure.Allocate(size); #if NET_LESS_5_0 instance->del = (void *)Marshal.GetFunctionPointerForDelegate(fnDel); #else instance->del = (delegate * unmanaged[Stdcall] < cef_base_scoped_t *, void >) & DelImpl; #endif return(instance); }
/// <summary> /// Initializes a new instance of <see cref="CefBaseScoped{T}"/> using /// the specified pointer to a specified CEF struct. /// </summary> /// <param name="instance">The pointer to a specified CEF struct.</param> public unsafe CefBaseScoped(cef_base_scoped_t *instance) : base(instance) { }
internal unsafe CefBaseScopedImpl(cef_base_scoped_t *instance) : base(instance) { }