mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 13:22:07 +00:00
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
@@ -95,10 +95,12 @@ ExceptionOr<size_t> CryptoAlgorithm::getKeyLength(const CryptoAlgorithmParameter
|
||||
template<typename ResultCallbackType, typename OperationType>
|
||||
static void dispatchAlgorithmOperation(WorkQueue& workQueue, ScriptExecutionContext& context, ResultCallbackType&& callback, CryptoAlgorithm::ExceptionCallback&& exceptionCallback, OperationType&& operation)
|
||||
{
|
||||
context.refEventLoop();
|
||||
workQueue.dispatch(
|
||||
[operation = WTFMove(operation), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback), contextIdentifier = context.identifier()]() mutable {
|
||||
auto result = operation();
|
||||
ScriptExecutionContext::postTaskTo(contextIdentifier, [result = crossThreadCopy(WTFMove(result)), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback)](auto&) mutable {
|
||||
ScriptExecutionContext::postTaskTo(contextIdentifier, [result = crossThreadCopy(WTFMove(result)), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback)](auto& context) mutable {
|
||||
context.unrefEventLoop();
|
||||
if (result.hasException()) {
|
||||
exceptionCallback(result.releaseException().code());
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user