|
1 | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
2 | 2 | // Licensed under the MIT license. |
3 | 3 |
|
| 4 | +using System; |
| 5 | + |
4 | 6 | namespace Microsoft.ClearScript.JavaScript |
5 | 7 | { |
6 | 8 | /// <summary> |
@@ -39,5 +41,29 @@ public interface IArrayBuffer |
39 | 41 | /// <param name="offset">The offset within the <c>ArrayBuffer</c> at which to store the first copied byte.</param> |
40 | 42 | /// <returns>The number of bytes copied.</returns> |
41 | 43 | ulong WriteBytes(byte[] source, ulong sourceIndex, ulong count, ulong offset); |
| 44 | + |
| 45 | + /// <summary> |
| 46 | + /// Invokes a delegate that returns no value, giving it direct access to the <c>ArrayBuffer</c>'s contents. |
| 47 | + /// </summary> |
| 48 | + /// <param name="action">The delegate to invoke.</param> |
| 49 | + /// <remarks> |
| 50 | + /// This method invokes the specified delegate, passing in the memory address of the |
| 51 | + /// <c>ArrayBuffer</c>'s contents. This memory address is valid only while the delegate is |
| 52 | + /// executing. The delegate must not access memory outside the <c>ArrayBuffer</c>'s range. |
| 53 | + /// </remarks> |
| 54 | + void InvokeWithDirectAccess(Action<IntPtr> action); |
| 55 | + |
| 56 | + /// <summary> |
| 57 | + /// Invokes a delegate that returns a value, giving it direct access to the <c>ArrayBuffer</c>'s contents. |
| 58 | + /// </summary> |
| 59 | + /// <typeparam name="T">The delegate's return type.</typeparam> |
| 60 | + /// <param name="func">The delegate to invoke.</param> |
| 61 | + /// <returns>The delegate's return value.</returns> |
| 62 | + /// <remarks> |
| 63 | + /// This method invokes the specified delegate, passing in the memory address of the |
| 64 | + /// <c>ArrayBuffer</c>'s contents. This memory address is valid only while the delegate is |
| 65 | + /// executing. The delegate must not access memory outside the <c>ArrayBuffer</c>'s range. |
| 66 | + /// </remarks> |
| 67 | + T InvokeWithDirectAccess<T>(Func<IntPtr, T> func); |
42 | 68 | } |
43 | 69 | } |
0 commit comments