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

Unified Diff: Source/bindings/scripts/unstable/v8_attributes.py

Issue 24867002: Add static attributes to IDL compiler (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised, fix Perl Created 7 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
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e354e61418e9d2e2a9c292a5da75e17ca41de452 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,37 @@ def generate_attributes_common(interface):
}
-def generate_attribute_and_includes(attribute):
+def generate_attribute_and_includes(interface, attribute):
idl_type = attribute.data_type
+ this_getter_name = getter_name(interface, attribute)
+ cpp_value = '%s()' % this_getter_name
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),
haraken 2013/09/27 00:33:31 This is unused. If we have getter_name, setter_nam
Nils Barth (inactive) 2013/09/27 01:09:33 Good catch, removed! (Also some cleanup to v8_util
'cpp_type': v8_types.cpp_type(idl_type),
'is_keep_alive_for_gc': this_is_keep_alive_for_gc,
+ 'cpp_value': cpp_value,
+ 'is_static': attribute.is_static,
+ 'name': attribute.name,
'v8_type': v8_types.v8_type(idl_type),
haraken 2013/09/27 00:33:31 Reorder these keys. For example: conditional_strin
Nils Barth (inactive) 2013/09/27 01:09:33 Fixed by alphabetizing - is this ok? (General styl
}
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_name(interface, attribute):
haraken 2013/09/27 00:33:31 getter_name => cpp_getter_name ?
Nils Barth (inactive) 2013/09/27 01:09:33 That's a bit redundant: getter/setter is clearly C
+ getter_base_name = uncapitalize(attribute.name)
haraken 2013/09/27 00:33:31 getter_base_name => getter_method_name ?
Nils Barth (inactive) 2013/09/27 01:09:33 Good point, done!
+ if attribute.is_static:
+ return '%s::%s' % (interface.name, getter_base_name)
+ return 'imp->%s' % getter_base_name
+
+
def is_keep_alive_for_gc(attribute):
idl_type = attribute.data_type
extended_attributes = attribute.extended_attributes
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698