Chromium Code Reviews| Index: Source/bindings/scripts/v8_attributes.py |
| diff --git a/Source/bindings/scripts/v8_attributes.py b/Source/bindings/scripts/v8_attributes.py |
| index 8e3baff3c820a7a4f3d162c5947cb757d1e325bd..7c6ac9f0248a9bdea1d676b77d4cdcfb7dd26e2d 100644 |
| --- a/Source/bindings/scripts/v8_attributes.py |
| +++ b/Source/bindings/scripts/v8_attributes.py |
| @@ -59,18 +59,19 @@ def attribute_context(interface, attribute): |
| is_reflect = 'Reflect' in extended_attributes |
| if is_custom_element_callbacks or is_reflect: |
| includes.add('core/dom/custom/CustomElementProcessingStack.h') |
| - # [PerWorldBindings] |
| - if 'PerWorldBindings' in extended_attributes: |
| - assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface.name, attribute.name) |
| + # [ExposeJSAccessors] |
| + is_expose_js_accessors = 'ExposeJSAccessors' in extended_attributes |
| # [ImplementedInPrivateScript] |
| is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_attributes |
| if is_implemented_in_private_script: |
| includes.add('bindings/core/v8/PrivateScriptRunner.h') |
| includes.add('core/frame/LocalFrame.h') |
| includes.add('platform/ScriptForbiddenScope.h') |
| - |
| # [OnlyExposedToPrivateScript] |
| is_only_exposed_to_private_script = 'OnlyExposedToPrivateScript' in extended_attributes |
| + # [PerWorldBindings] |
| + if 'PerWorldBindings' in extended_attributes: |
| + assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes, '[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface.name, attribute.name) |
| if (base_idl_type == 'EventHandler' and |
| interface.name in ['Window', 'WorkerGlobalScope'] and |
| @@ -101,7 +102,7 @@ def attribute_context(interface, attribute): |
| 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(attribute, 'CallWith', 'ScriptState'), |
| 'is_check_security_for_node': is_check_security_for_node, |
| 'is_custom_element_callbacks': is_custom_element_callbacks, |
| - 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, |
| + 'is_expose_js_accessors': is_expose_js_accessors, |
| 'is_getter_raises_exception': # [RaisesException] |
| 'RaisesException' in extended_attributes and |
| extended_attributes['RaisesException'] in (None, 'Getter'), |
| @@ -134,7 +135,7 @@ def attribute_context(interface, attribute): |
| 'reflect_missing': extended_attributes.get('ReflectMissing'), |
| 'reflect_only': extended_attribute_value_as_list(attribute, 'ReflectOnly'), |
| 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(attribute), # [RuntimeEnabled] |
| - 'setter_callback': setter_callback_name(interface, attribute), |
| + 'setter_callback': setter_callback_name(interface, attribute, is_expose_js_accessors), |
| 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script), |
| 'world_suffixes': ['', 'ForMainWorld'] |
| if 'PerWorldBindings' in extended_attributes |
| @@ -427,18 +428,20 @@ def scoped_content_attribute_name(interface, attribute): |
| # Attribute configuration |
| ################################################################################ |
| -# [Replaceable] |
| -def setter_callback_name(interface, attribute): |
| +# [PutForwards], [Replaceable] |
| +def setter_callback_name(interface, attribute, is_expose_js_accessors): |
| cpp_class_name = cpp_name(interface) |
| cpp_class_name_or_partial = cpp_name_or_partial(interface) |
| extended_attributes = attribute.extended_attributes |
| - if (('Replaceable' in extended_attributes and |
| - 'PutForwards' not in extended_attributes) or |
| - is_constructor_attribute(attribute)): |
| + if (not is_expose_js_accessors and |
| + ('Replaceable' in extended_attributes or |
|
haraken
2015/02/23 14:48:52
Why can we remove "'PutForwards' not in extended_a
Yuki
2015/02/23 15:18:42
[Replaceable] and [PutForwards] conflict each othe
haraken
2015/02/23 17:34:00
Sounds like a good idea.
|
| + is_constructor_attribute(attribute))): |
| return '%sV8Internal::%sForceSetAttributeOnThisCallback' % ( |
|
haraken
2015/02/23 14:48:52
Help me understand: What's a difference between a
Yuki
2015/02/23 15:18:42
Basically we have the same implementation for "rep
haraken
2015/02/23 17:33:59
Ah, now I understand what this CL is doing :)
It
Yuki
2015/02/25 14:19:29
Done.
|
| cpp_class_name_or_partial, cpp_class_name) |
| - if attribute.is_read_only and 'PutForwards' not in extended_attributes: |
| + if (attribute.is_read_only and |
| + 'PutForwards' not in extended_attributes and |
| + 'Replaceable' not in extended_attributes): |
|
haraken
2015/02/23 14:48:52
Fix indentation.
Yuki
2015/02/23 15:18:42
We need this indentation. Otherwise, I got a lint
|
| return '0' |
| return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name_or_partial, attribute.name) |