Commit 0f53ed4f authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

bind-gen: Implement attribute / operation callback (1 of N)

This patch is exploring how we can implement V8 callback
functions in the new bindings generator.

Attempts to implement the following utilities:
- make_v8_to_blink_value
- bind_blink_api_arguments
- bind_blink_api_call
- bind_return_value
- bind_v8_set_return_value

Bug: 839389
Change-Id: Ie949eca6119806611125fc4e8265601a6888e52b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1880904Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710333}
parent 67bcad56
......@@ -29,6 +29,7 @@ class CodeGenerationContext(object):
# attribute name: default value
cls._context_attrs = {
# Top-level definition
"callback_function": None,
"callback_interface": None,
"dictionary": None,
"interface": None,
......@@ -132,6 +133,10 @@ class CodeGenerationContext(object):
return (self.callback_interface or self.dictionary or self.interface
or self.namespace)
@property
def function_like(self):
return (self.callback_function or self.constructor or self.operation)
@property
def is_return_by_argument(self):
if self.return_type is None:
......@@ -164,6 +169,8 @@ class CodeGenerationContext(object):
def return_type(self):
if self.attribute_get:
return self.attribute.idl_type
if self.callback_function:
return self.callback_function.return_type
if self.operation:
return self.operation.return_type
return None
......
......@@ -12,7 +12,7 @@
};
namespace TestNamespace {
readonly attribute Promise<boolean> attr1;
readonly attribute DOMString attr2;
void op1();
[RaisesException] readonly attribute Promise<boolean> attr1;
readonly attribute TestInterfaceConstructor attr2;
void op1(long x, boolean y, TestInterfaceConstructor z);
};
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