Index: Source/bindings/scripts/unstable/v8_attributes.py |
diff --git a/Source/bindings/scripts/unstable/v8_attributes.py b/Source/bindings/scripts/unstable/v8_attributes.py |
index dad1622f805ea577fde8d0316d8d263b8a46b6e1..4b96945a18937838ede6a512706e9e209db172d0 100644 |
--- a/Source/bindings/scripts/unstable/v8_attributes.py |
+++ b/Source/bindings/scripts/unstable/v8_attributes.py |
@@ -57,6 +57,7 @@ def generate_attributes_common(interface, attributes): |
v8_class_name = v8_utilities.v8_class_name(interface) |
return { |
'has_per_context_enabled_attributes': any(attribute['per_context_enabled_function_name'] for attribute in attributes), |
+ 'has_constructor_attributes': any(attribute['is_constructor'] for attribute in attributes), |
'has_replaceable_attributes': any(attribute['is_replaceable'] for attribute in attributes), |
'has_runtime_enabled_attributes': any(attribute['runtime_enabled_function_name'] for attribute in attributes), |
'installed_attributes': '%sAttributes' % v8_class_name if attributes else '0', |
@@ -87,6 +88,7 @@ def generate_attribute_and_includes(interface, attribute): |
'has_custom_getter': has_custom_getter, |
'has_custom_setter': has_custom_setter, |
'idl_type': idl_type, |
+ 'is_constructor': is_constructor(attribute), |
'is_getter_raises_exception': has_extended_attribute(attribute, ('GetterRaisesException', 'RaisesException')), |
'is_keep_alive_for_gc': is_keep_alive_for_gc(attribute), |
'is_nullable': attribute.is_nullable, |
@@ -102,7 +104,11 @@ def generate_attribute_and_includes(interface, attribute): |
'v8_type': v8_types.v8_type(idl_type), |
'runtime_enabled_function_name': v8_utilities.runtime_enabled_function_name(attribute), # [RuntimeEnabled] |
'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended_attributes else [''], # [PerWorldBindings] |
+ 'wrapper_type_info': wrapper_type_info(attribute), |
} |
+ if is_constructor(attribute): |
+ includes.update(v8_types.includes_for_type(idl_type)) |
+ return contents, includes |
if not has_custom_getter: |
generate_getter(interface, attribute, contents, includes) |
if not (attribute.is_read_only or has_custom_setter): |
@@ -111,6 +117,8 @@ def generate_attribute_and_includes(interface, attribute): |
return contents, includes |
+# Getter |
+ |
def generate_getter(interface, attribute, contents, includes): |
idl_type = attribute.data_type |
includes.update(v8_types.includes_for_type(idl_type)) |
@@ -225,6 +233,8 @@ def is_keep_alive_for_gc(attribute): |
idl_type.startswith('HTML')))) |
+# Setter |
+ |
def generate_setter(interface, attribute, contents, includes): |
idl_type = attribute.data_type |
extended_attributes = attribute.extended_attributes |
@@ -308,18 +318,24 @@ def scoped_name(interface, attribute, base_name): |
return 'imp->%s' % base_name |
+# Attribute configuration |
+ |
def getter_callback_name(interface, attribute): |
+ if attribute.data_type.endswith('Constructor'): |
haraken
2013/10/24 09:13:54
Not related to this CL, data_type => idl_type ?
Nils Barth (inactive)
2013/10/24 09:41:51
I was planning on doing that at some point; will d
|
+ return '{0}V8Internal::{0}ConstructorGetter'.format(cpp_name(interface)) |
return '%sV8Internal::%sAttributeGetterCallback' % (cpp_name(interface), attribute.name) |
+# [Replaceable] |
def setter_callback_name(interface, attribute): |
if (attribute.is_read_only and |
'Replaceable' not in attribute.extended_attributes): |
# FIXME: support [PutForwards] |
return '0' |
cpp_class_name = cpp_name(interface) |
- if ('Replaceable' in attribute.extended_attributes and |
- not has_extended_attribute(attribute, ('Custom', 'CustomSetter'))): |
+ if (('Replaceable' in attribute.extended_attributes and |
+ not has_extended_attribute(attribute, ('Custom', 'CustomSetter'))) or |
+ attribute.data_type.endswith('Constructor')): |
# Non-custom replaceable attributes have a single interface-level |
# setter callback (rather than individual attribute-level callbacks), |
# but custom replaceable attributes have individual callbacks, as usual. |
@@ -327,6 +343,26 @@ def setter_callback_name(interface, attribute): |
return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribute.name) |
+# [PerWorldBindings] |
+def getter_callback_name_for_main_world(interface, attribute): |
+ if 'PerWorldBindings' not in attribute.extended_attributes: |
+ return '0' |
+ return '%sV8Internal::%sAttributeGetterCallbackForMainWorld' % (cpp_name(interface), attribute.name) |
+ |
+ |
+def setter_callback_name_for_main_world(interface, attribute): |
+ if ('PerWorldBindings' not in attribute.extended_attributes or |
+ attribute.is_read_only): |
+ return '0' |
+ return '%sV8Internal::%sAttributeSetterCallbackForMainWorld' % (cpp_name(interface), attribute.name) |
+ |
+ |
+def wrapper_type_info(attribute): |
+ if not is_constructor(attribute): |
+ return '0' |
+ return '&V8%s::info' % v8_types.constructor_type(attribute.data_type) |
+ |
+ |
# [DoNotCheckSecurity], [DoNotCheckSecurityOnGetter], [DoNotCheckSecurityOnSetter], [Unforgeable] |
def access_control_list(attribute): |
extended_attributes = attribute.extended_attributes |
@@ -348,22 +384,13 @@ def access_control_list(attribute): |
def property_attributes(attribute): |
extended_attributes = attribute.extended_attributes |
property_attributes_list = [] |
- if 'NotEnumerable' in extended_attributes: |
+ if ('NotEnumerable' in extended_attributes or |
+ is_constructor(attribute)): |
property_attributes_list.append('v8::DontEnum') |
if 'Unforgeable' in extended_attributes: |
property_attributes_list.append('v8::DontDelete') |
return property_attributes_list or ['v8::None'] |
-# [PerWorldBindings] |
-def getter_callback_name_for_main_world(interface, attribute): |
- if 'PerWorldBindings' not in attribute.extended_attributes: |
- return '0' |
- return '%sV8Internal::%sAttributeGetterCallbackForMainWorld' % (cpp_name(interface), attribute.name) |
- |
- |
-def setter_callback_name_for_main_world(interface, attribute): |
- if ('PerWorldBindings' not in attribute.extended_attributes or |
- attribute.is_read_only): |
- return '0' |
- return '%sV8Internal::%sAttributeSetterCallbackForMainWorld' % (cpp_name(interface), attribute.name) |
+def is_constructor(attribute): |
haraken
2013/10/24 09:13:54
is_constructor => is_constructor_attribute
Nils Barth (inactive)
2013/10/24 09:41:51
Done.
|
+ return attribute.data_type.endswith('Constructor') |