mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for native creation and resolution of Promises (fixes issue #3305)
This commit is contained in:
committed by
Marshall Greenblatt
parent
60ee4a34aa
commit
fa643b269e
@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=46a80d60441e386e6a8999ecb5fd338f3f6b4319$
|
||||
// $hash=5dd413b62070b7d80292faf8396d3b795dd4035e$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
|
||||
@ -178,6 +178,16 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_function(
|
||||
return CefV8ValueCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_v8value_t* cef_v8value_create_promise() {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefV8Value> _retval = CefV8Value::CreatePromise();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefV8ValueCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
@ -364,6 +374,20 @@ int CEF_CALLBACK v8value_is_function(struct _cef_v8value_t* self) {
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_is_promise(struct _cef_v8value_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefV8ValueCppToC::Get(self)->IsPromise();
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_is_same(struct _cef_v8value_t* self,
|
||||
struct _cef_v8value_t* that) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
@ -974,6 +998,43 @@ v8value_execute_function_with_context(struct _cef_v8value_t* self,
|
||||
return CefV8ValueCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_resolve_promise(struct _cef_v8value_t* self,
|
||||
struct _cef_v8value_t* arg) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Unverified params: arg
|
||||
|
||||
// Execute
|
||||
bool _retval = CefV8ValueCppToC::Get(self)->ResolvePromise(
|
||||
CefV8ValueCppToC::Unwrap(arg));
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_reject_promise(struct _cef_v8value_t* self,
|
||||
const cef_string_t* errorMsg) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: errorMsg; type: string_byref_const
|
||||
DCHECK(errorMsg);
|
||||
if (!errorMsg)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval =
|
||||
CefV8ValueCppToC::Get(self)->RejectPromise(CefString(errorMsg));
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
@ -992,6 +1053,7 @@ CefV8ValueCppToC::CefV8ValueCppToC() {
|
||||
GetStruct()->is_array = v8value_is_array;
|
||||
GetStruct()->is_array_buffer = v8value_is_array_buffer;
|
||||
GetStruct()->is_function = v8value_is_function;
|
||||
GetStruct()->is_promise = v8value_is_promise;
|
||||
GetStruct()->is_same = v8value_is_same;
|
||||
GetStruct()->get_bool_value = v8value_get_bool_value;
|
||||
GetStruct()->get_int_value = v8value_get_int_value;
|
||||
@ -1030,6 +1092,8 @@ CefV8ValueCppToC::CefV8ValueCppToC() {
|
||||
GetStruct()->execute_function = v8value_execute_function;
|
||||
GetStruct()->execute_function_with_context =
|
||||
v8value_execute_function_with_context;
|
||||
GetStruct()->resolve_promise = v8value_resolve_promise;
|
||||
GetStruct()->reject_promise = v8value_reject_promise;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
Reference in New Issue
Block a user