Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1008)

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_callback_function.py

Issue 2367543004: Extended implementation to use interface as arguments (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/scripts/v8_callback_function.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_callback_function.py b/third_party/WebKit/Source/bindings/scripts/v8_callback_function.py
index 4900abac48256e8271b05a03698b66df6eac8176..ff0a7100c0f72f381d280a1b08a2d34b443c3e71 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_callback_function.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_callback_function.py
@@ -27,9 +27,17 @@ def callback_function_context(callback_function):
includes.update(CALLBACK_FUNCTION_CPP_INCLUDES)
idl_type = callback_function.idl_type
idl_type_str = str(idl_type)
+ cpp_includes = set(CALLBACK_FUNCTION_CPP_INCLUDES)
peria 2016/09/23 02:50:05 you can use |includes| instead of this?
lkawai 2016/09/23 05:35:44 Done.
+ forward_declarations = []
+ for argument in callback_function.arguments:
+ for argument_type in list(argument.idl_type.idl_types()):
+ if argument_type.is_interface_type:
bashi 2016/09/23 02:16:05 why simply do following won't work? if argument.i
lkawai 2016/09/23 02:43:42 As I defined callback function using array of inte
peria 2016/09/23 02:50:05 I recommend to make a utility function which takes
bashi 2016/09/23 02:57:56 Hmm, I'm not sure why you need to use IdlArrayType
lkawai 2016/09/23 05:35:44 Acknowledged.
lkawai 2016/09/23 05:35:44 Done.
lkawai 2016/09/23 05:35:45 Done.
+ forward_declarations.append('%s' % argument_type.name)
peria 2016/09/23 02:50:05 do we need "'%s' %"?
lkawai 2016/09/23 05:35:44 Done.
+ cpp_includes.update(argument.idl_type.includes_for_type(callback_function.extended_attributes))
bashi 2016/09/23 02:16:05 Could you use idl_type.add_includes_for_type inste
lkawai 2016/09/23 02:43:42 Done.
peria 2016/09/23 02:50:05 Not related to this CL, but I feel the name idl_ty
bashi 2016/09/23 03:04:05 Yeah, I totally agree we should avoid using global
lkawai 2016/09/23 05:35:44 Acknowledged.
context = {
'cpp_class': callback_function.name,
- 'cpp_includes': sorted(CALLBACK_FUNCTION_CPP_INCLUDES),
+ 'cpp_includes': sorted(cpp_includes),
bashi 2016/09/23 02:16:05 cpp_includes -> includes
lkawai 2016/09/23 02:43:42 Done.
+ 'forward_declarations': forward_declarations,
'header_includes': sorted(CALLBACK_FUNCTION_H_INCLUDES),
'idl_type': idl_type_str,
'return_cpp_type': (idl_type.cpp_type + '&') if idl_type.cpp_type != 'void' else None,

Powered by Google App Engine
This is Rietveld 408576698