예제 #1
0
파일: CefV8Value.cs 프로젝트: CefNet/CefNet
 /// <summary>
 /// Create a new <see cref="CefV8Value"/> object of type ArrayBuffer which wraps the
 /// provided <paramref name="buffer"/> of size <paramref name="length"/> bytes.<para/>
 /// This function should only be called from within the scope of a
 /// <see cref="CefRenderProcessHandler"/>, <see cref="CefV8Handler"/> or
 /// <see cref="CefV8Accessor"/> callback, or in combination with calling
 /// <see cref="CefV8Context.Enter"/> and <see cref="CefV8Context.Exit"/>
 /// on a stored <see cref="CefV8Context"/> reference.
 /// </summary>
 /// <param name="buffer">
 /// The ArrayBuffer is externalized, meaning that it does not own <paramref name="buffer"/>.
 /// </param>
 /// <param name="callback">
 /// The caller is responsible for freeing <paramref name="buffer"/> when requested via
 /// a call to <see cref="CefV8ArrayBufferReleaseCallback.ReleaseBuffer"/>.
 /// </param>
 /// <param name="length">The size of buffer in bytes.</param>
 /// <returns>Returns a new <see cref="CefV8Value"/> object of type ArrayBuffer.</returns>
 public static CefV8Value CreateArrayBuffer(void *buffer, int length, CefV8ArrayBufferReleaseCallback callback)
 {
     if (buffer == null)
     {
         throw new ArgumentNullException(nameof(buffer));
     }
     if (length < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(length));
     }
     return(new CefV8Value(CefNativeApi.cef_v8value_create_array_buffer(buffer, unchecked ((UIntPtr)length), callback.GetNativeInstance())));
 }
예제 #2
0
 /// <summary>
 /// Returns the ReleaseCallback object associated with the ArrayBuffer or NULL
 /// if the ArrayBuffer was not created with CreateArrayBuffer.
 /// </summary>
 public unsafe virtual CefV8ArrayBufferReleaseCallback GetArrayBufferReleaseCallback()
 {
     return(SafeCall(CefV8ArrayBufferReleaseCallback.Wrap(CefV8ArrayBufferReleaseCallback.Create, NativeInstance->GetArrayBufferReleaseCallback())));
 }