0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-21 15:04:33 -05:00

feat: WasmAsyncResolvePromiseCallback (#1029)

This commit is contained in:
Bartek Iwańczuk 2022-07-13 07:51:10 +02:00 committed by GitHub
parent d8480fc7ef
commit 2193d827b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

View file

@ -246,6 +246,11 @@ void v8__Isolate__SetPromiseRejectCallback(v8::Isolate* isolate,
isolate->SetPromiseRejectCallback(callback);
}
void v8__Isolate__SetWasmAsyncResolvePromiseCallback(
v8::Isolate* isolate, v8::WasmAsyncResolvePromiseCallback callback) {
isolate->SetWasmAsyncResolvePromiseCallback(callback);
}
void v8__Isolate__SetCaptureStackTraceForUncaughtExceptions(
v8::Isolate* isolate, bool capture, int frame_limit) {
isolate->SetCaptureStackTraceForUncaughtExceptions(capture, frame_limit);

View file

@ -1,3 +1,4 @@
use crate::PromiseResolver;
// Copyright 2019-2021 the Deno authors. All rights reserved. MIT license.
use crate::function::FunctionCallbackInfo;
use crate::handle::FinalizerMap;
@ -92,6 +93,20 @@ pub type PromiseHook =
pub type PromiseRejectCallback = extern "C" fn(PromiseRejectMessage);
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(C)]
pub enum WasmAsyncSuccess {
Success,
Fail,
}
pub type WasmAsyncResolvePromiseCallback = extern "C" fn(
*const Isolate,
Local<Context>,
Local<PromiseResolver>,
Local<Value>,
WasmAsyncSuccess,
);
/// HostInitializeImportMetaObjectCallback is called the first time import.meta
/// is accessed for a module. Subsequent access will reuse the same value.
///
@ -233,6 +248,10 @@ extern "C" {
isolate: *mut Isolate,
callback: PromiseRejectCallback,
);
fn v8__Isolate__SetWasmAsyncResolvePromiseCallback(
isolate: *mut Isolate,
callback: WasmAsyncResolvePromiseCallback,
);
fn v8__Isolate__SetHostInitializeImportMetaObjectCallback(
isolate: *mut Isolate,
callback: HostInitializeImportMetaObjectCallback,
@ -619,6 +638,14 @@ impl Isolate {
) {
unsafe { v8__Isolate__SetPromiseRejectCallback(self, callback) }
}
pub fn set_wasm_async_resolve_promise_callback(
&mut self,
callback: WasmAsyncResolvePromiseCallback,
) {
unsafe { v8__Isolate__SetWasmAsyncResolvePromiseCallback(self, callback) }
}
/// This specifies the callback called by the upcoming importa.meta
/// language feature to retrieve host-defined meta data for a module.
pub fn set_host_initialize_import_meta_object_callback(