Commit ab4bb3db authored by bashi's avatar bashi Committed by Commit bot

bindings: Don't wrap nullable callback functions in Nullable<T>

The code generator wrongly uses `Nullable<Callback*>` when nullable
callback functions are used like below:

callback C = void();
interface I { void f(C? callback); }

Since C++ impl of callback functions are garbage collected types,
we can just use `Callback*`.

BUG=675859

Review-Url: https://codereview.chromium.org/2588303002
Cr-Commit-Position: refs/heads/master@{#439816}
parent efa99c73
...@@ -965,10 +965,14 @@ def cpp_type_has_null_value(idl_type): ...@@ -965,10 +965,14 @@ def cpp_type_has_null_value(idl_type):
# a null pointer. # a null pointer.
# - Union types, as thier container classes can represent null value. # - Union types, as thier container classes can represent null value.
# - 'Object' and 'any' type. We use ScriptValue for object type. # - 'Object' and 'any' type. We use ScriptValue for object type.
return (idl_type.is_string_type or idl_type.is_interface_type or return (idl_type.is_string_type
idl_type.is_enum or idl_type.is_union_type or idl_type.is_enum
or idl_type.base_type == 'object' or idl_type.base_type == 'any' or idl_type.is_interface_type
or idl_type.is_custom_callback_function or idl_type.is_callback_interface) or idl_type.is_callback_interface
or idl_type.is_callback_function
or idl_type.is_custom_callback_function
or idl_type.is_union_type
or idl_type.base_type == 'object' or idl_type.base_type == 'any')
IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value) IdlTypeBase.cpp_type_has_null_value = property(cpp_type_has_null_value)
......
...@@ -249,7 +249,7 @@ static void voidMethodNullableCallbackFunctionInArgMethod(const v8::FunctionCall ...@@ -249,7 +249,7 @@ static void voidMethodNullableCallbackFunctionInArgMethod(const v8::FunctionCall
return; return;
} }
Nullable<VoidCallbackFunction*> voidCallbackFunctionArg; VoidCallbackFunction* voidCallbackFunctionArg;
if (!info[0]->IsFunction() && !info[0]->IsNull()) { if (!info[0]->IsFunction() && !info[0]->IsNull()) {
V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodNullableCallbackFunctionInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function.")); V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodNullableCallbackFunctionInArg", "TestCallbackFunctions", "The callback provided as parameter 1 is not a function."));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment