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

Side by Side Diff: Source/bindings/templates/interface.cpp

Issue 499293003: IDL: Avoid generating empty ConstantConfiguration arrays (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/tests/idls/TestInterface2.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 ('%sV8Internal::%sConstructorGetterCallback' % 10 ('%sV8Internal::%sConstructorGetterCallback' %
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %} 1072 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %}
1073 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = { 1073 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = {
1074 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}, 1074 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}},
1075 }; 1075 };
1076 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); 1076 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate);
1077 {%- endmacro %} 1077 {%- endmacro %}
1078 1078
1079 1079
1080 {######################################} 1080 {######################################}
1081 {% macro install_constants() %} 1081 {% macro install_constants() %}
1082 {% if has_constant_configuration %}
1082 {# Normal (always enabled) constants #} 1083 {# Normal (always enabled) constants #}
1083 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] = { 1084 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] = {
1084 {% for constant in constants if not constant.runtime_enabled_function %} 1085 {% for constant in constants if not constant.runtime_enabled_function %}
1085 {% if constant.idl_type in ('Double', 'Float') %} 1086 {% if constant.idl_type in ('Double', 'Float') %}
1086 {% set value = '0, %s, 0' % constant.value %} 1087 {% set value = '0, %s, 0' % constant.value %}
1087 {% elif constant.idl_type == 'String' %} 1088 {% elif constant.idl_type == 'String' %}
1088 {% set value = '0, 0, %s' % constant.value %} 1089 {% set value = '0, 0, %s' % constant.value %}
1089 {% else %} 1090 {% else %}
1090 {# 'Short', 'Long' etc. #} 1091 {# 'Short', 'Long' etc. #}
1091 {% set value = '%s, 0, 0' % constant.value %} 1092 {% set value = '%s, 0, 0' % constant.value %}
1092 {% endif %} 1093 {% endif %}
1093 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant. idl_type}}}, 1094 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant. idl_type}}},
1094 {% endfor %} 1095 {% endfor %}
1095 }; 1096 };
1096 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, {{v8_c lass}}Constants, WTF_ARRAY_LENGTH({{v8_class}}Constants), isolate); 1097 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, {{v8_c lass}}Constants, WTF_ARRAY_LENGTH({{v8_class}}Constants), isolate);
1098 {% endif %}
1097 {# Runtime-enabled constants #} 1099 {# Runtime-enabled constants #}
1098 {% for constant in constants if constant.runtime_enabled_function %} 1100 {% for constant in constants if constant.runtime_enabled_function %}
1099 if ({{constant.runtime_enabled_function}}()) { 1101 if ({{constant.runtime_enabled_function}}()) {
1100 {% if constant.idl_type in ('Double', 'Float') %} 1102 {% if constant.idl_type in ('Double', 'Float') %}
1101 {% set value = '0, %s, 0' % constant.value %} 1103 {% set value = '0, %s, 0' % constant.value %}
1102 {% elif constant.idl_type == 'String' %} 1104 {% elif constant.idl_type == 'String' %}
1103 {% set value = '0, 0, %s' % constant.value %} 1105 {% set value = '0, 0, %s' % constant.value %}
1104 {% else %} 1106 {% else %}
1105 {# 'Short', 'Long' etc. #} 1107 {# 'Short', 'Long' etc. #}
1106 {% set value = '%s, 0, 0' % constant.value %} 1108 {% set value = '%s, 0, 0' % constant.value %}
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 {% endif %} 1367 {% endif %}
1366 } 1368 }
1367 1369
1368 template<> 1370 template<>
1369 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1371 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1370 { 1372 {
1371 return toV8(impl, creationContext, isolate); 1373 return toV8(impl, creationContext, isolate);
1372 } 1374 }
1373 1375
1374 {% endblock %} 1376 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/tests/idls/TestInterface2.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698