* Transfers an ArrayBuffer, TypedArray, or DataView to a worker thread. * @param {boolean} hasError - Whether an error occurred during transfer. * @param {ArrayBuffer[] | TypedArray | DataView} source - The data to transfer. * @returns {ArrayBuffer[]|undefined}
(hasError, source)
| 86 | * @returns {ArrayBuffer[]|undefined} |
| 87 | */ |
| 88 | function transferArrayBuffer(hasError, source) { |
| 89 | if (hasError || source == null) { return; } |
| 90 | let arrayBuffer; |
| 91 | if (isArrayBuffer(source)) { |
| 92 | arrayBuffer = source; |
| 93 | } else if (isTypedArray(source)) { |
| 94 | arrayBuffer = TypedArrayPrototypeGetBuffer(source); |
| 95 | } else if (isDataView(source)) { |
| 96 | arrayBuffer = DataViewPrototypeGetBuffer(source); |
| 97 | } |
| 98 | if (arrayBuffer && !isMarkedAsUntransferable(arrayBuffer)) { |
| 99 | return [arrayBuffer]; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Wraps a message with a status and body, and serializes the body if necessary. |
no test coverage detected
searching dependent graphs…