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

Unified Diff: Source/bindings/scripts/v8_interface.py

Issue 1004503004: IDL: Add support for serializer definitions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@V8ObjectBuilder
Patch Set: Created 5 years, 9 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: Source/bindings/scripts/v8_interface.py
diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py
index 6e4f37812c3fede093a6b387f19839620cd78a2e..40fc74272a659062fea4661d44e806f63679b5de 100644
--- a/Source/bindings/scripts/v8_interface.py
+++ b/Source/bindings/scripts/v8_interface.py
@@ -467,19 +467,39 @@ def interface_context(interface):
# FIXME: maplike<> and setlike<> should also imply the presence of a
# 'size' attribute.
+ # Serializer
+ if interface.serializer:
+ serializer = interface.serializer
+ serializer_ext_attrs = serializer.extended_attributes.copy()
+ if serializer.operation:
+ return_type = serializer.operation.idl_type
+ implemented_as = serializer.operation.name
+ else:
+ return_type = IdlType('any')
+ implemented_as = None
+ if 'CallWith' not in serializer_ext_attrs:
haraken 2015/03/26 01:39:20 What if the serializer has [CallWith] but the [Cal
Jens Widell 2015/03/26 05:34:10 We could call that a bug in the IDL; it needs a Sc
haraken 2015/03/26 05:36:02 Makes sense.
+ serializer_ext_attrs['CallWith'] = 'ScriptState'
+ methods.append(generated_method(
+ return_type=return_type,
+ name='toJSON',
+ extended_attributes=serializer_ext_attrs,
+ implemented_as=implemented_as))
+
# Stringifier
if interface.stringifier:
stringifier = interface.stringifier
stringifier_ext_attrs = stringifier.extended_attributes.copy()
if stringifier.attribute:
- stringifier_ext_attrs['ImplementedAs'] = stringifier.attribute.name
+ implemented_as = stringifier.attribute.name
elif stringifier.operation:
- stringifier_ext_attrs['ImplementedAs'] = stringifier.operation.name
+ implemented_as = stringifier.operation.name
+ else:
+ implemented_as = 'toString'
methods.append(generated_method(
return_type=IdlType('DOMString'),
name='toString',
extended_attributes=stringifier_ext_attrs,
- implemented_as='toString'))
+ implemented_as=implemented_as))
conditionally_enabled_methods = []
custom_registration_methods = []

Powered by Google App Engine
This is Rietveld 408576698