internal static CefV8ArrayBufferReleaseCallback FromNativeOrNull(cef_v8array_buffer_release_callback_t *ptr) { CefV8ArrayBufferReleaseCallback value = null; bool found; lock (_roots) { found = _roots.TryGetValue((IntPtr)ptr, out value); } return(found ? value : null); }
/// <summary> /// Create a new CefV8Value object of type ArrayBuffer which wraps the provided /// |buffer| of size |length| bytes. The ArrayBuffer is externalized, meaning /// that it does not own |buffer|. The caller is responsible for freeing /// |buffer| when requested via a call to CefV8ArrayBufferReleaseCallback:: /// ReleaseBuffer. This method should only be called from within the scope of a /// CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in /// combination with calling Enter() and Exit() on a stored CefV8Context /// reference. /// </summary> public static CefV8Value CreateArrayBuffer(IntPtr buffer, ulong length, CefV8ArrayBufferReleaseCallback releaseCallback) { if (releaseCallback == null) { throw new ArgumentNullException(nameof(releaseCallback)); } var n_value = cef_v8value_t.create_array_buffer( (void *)buffer, checked ((UIntPtr)length), releaseCallback.ToNative() ); return(CefV8Value.FromNative(n_value)); }
/// <summary> /// ARRAY BUFFER METHODS - These methods are only available on ArrayBuffers. /// Returns the ReleaseCallback object associated with the ArrayBuffer or NULL /// if the ArrayBuffer was not created with CreateArrayBuffer. /// </summary> public CefV8ArrayBufferReleaseCallback GetArrayBufferReleaseCallback() { var n_releaseCallback = cef_v8value_t.get_array_buffer_release_callback(_self); return(CefV8ArrayBufferReleaseCallback.FromNativeOrNull(n_releaseCallback)); }