Chromium Code Reviews| 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 c54ebabaf3add88df155fb68fb14faa8f619072a..65a35facaa83c1323a5e825d6d7641f54b1161e2 100644 |
| --- a/Source/bindings/scripts/unstable/v8_attributes.py |
| +++ b/Source/bindings/scripts/unstable/v8_attributes.py |
| @@ -42,7 +42,7 @@ from v8_utilities import cpp_method_name, generate_conditional_string, uncapital |
| def generate_attributes(interface): |
| def generate_attribute(attribute): |
| - attribute_contents, attribute_includes = generate_attribute_and_includes(attribute) |
| + attribute_contents, attribute_includes = generate_attribute_and_includes(interface, attribute) |
| includes.update(attribute_includes) |
| return attribute_contents |
| @@ -62,27 +62,42 @@ def generate_attributes_common(interface): |
| } |
| -def generate_attribute_and_includes(attribute): |
| +def generate_attribute_and_includes(interface, attribute): |
| idl_type = attribute.data_type |
| + cpp_value = getter_expression(interface, attribute) |
|
haraken
2013/09/26 22:48:30
Shall we have getter_expression return the getter
Nils Barth (inactive)
2013/09/27 00:26:14
I've refactored & renamed getter_expression to get
|
| this_is_keep_alive_for_gc = is_keep_alive_for_gc(attribute) |
| contents = { |
| - 'name': attribute.name, |
| 'conditional_string': generate_conditional_string(attribute), |
| 'cpp_method_name': cpp_method_name(attribute), |
| 'cpp_type': v8_types.cpp_type(idl_type), |
| 'is_keep_alive_for_gc': this_is_keep_alive_for_gc, |
| + 'cpp_value': cpp_value, |
| + 'is_normal': not attribute.is_static, |
| + 'is_static': attribute.is_static, |
| + 'name': attribute.name, |
| 'v8_type': v8_types.v8_type(idl_type), |
| } |
| if this_is_keep_alive_for_gc: |
| includes = v8_types.includes_for_type(idl_type) |
| includes.add('bindings/v8/V8HiddenPropertyName.h') |
| else: |
| - cpp_value = 'imp->%s()' % uncapitalize(attribute.name) |
| return_v8_value_statement, includes = v8_types.v8_set_return_value(idl_type, cpp_value, callback_info='info', isolate='info.GetIsolate()', extended_attributes=attribute.extended_attributes, script_wrappable='imp') |
| contents['return_v8_value_statement'] = return_v8_value_statement |
| return contents, includes |
| +def getter_expression(interface, attribute): |
| + getter_base_name = uncapitalize(attribute.name) |
| + getter_name = scoped_name(interface, attribute, getter_base_name) |
|
haraken
2013/09/26 22:48:30
I'd inline scoped_name here. (At least the name "s
Nils Barth (inactive)
2013/09/27 00:26:14
Done.
We'll want to factor it out when we add sett
|
| + return '%s()' % getter_name |
| + |
| + |
| +def scoped_name(interface, attribute, function_base_name): |
| + if attribute.is_static: |
| + return '%s::%s' % (interface.name, function_base_name) |
| + return 'imp->%s' % function_base_name |
| + |
| + |
| def is_keep_alive_for_gc(attribute): |
| idl_type = attribute.data_type |
| extended_attributes = attribute.extended_attributes |