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

Side by Side Diff: Source/bindings/scripts/unstable/v8_interface.py

Issue 68733006: IDL compiler: Refactor attribute configuration from Python CG to Jinja template (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 template_contents.update({ 76 template_contents.update({
77 'constants': [generate_constant(constant) for constant in interface.cons tants], 77 'constants': [generate_constant(constant) for constant in interface.cons tants],
78 'do_not_check_constants': 'DoNotCheckConstants' in interface.extended_at tributes, 78 'do_not_check_constants': 'DoNotCheckConstants' in interface.extended_at tributes,
79 }) 79 })
80 80
81 attributes = [v8_attributes.generate_attribute(interface, attribute) 81 attributes = [v8_attributes.generate_attribute(interface, attribute)
82 for attribute in interface.attributes] 82 for attribute in interface.attributes]
83 template_contents.update({ 83 template_contents.update({
84 'attributes': attributes, 84 'attributes': attributes,
85 'has_constructor_attributes': any(attribute['is_constructor'] for attrib ute in attributes), 85 'has_constructor_attributes': any(attribute['constructor_type'] for attr ibute in attributes),
86 'has_per_context_enabled_attributes': any(attribute['per_context_enabled _function_name'] for attribute in attributes), 86 'has_per_context_enabled_attributes': any(attribute['per_context_enabled _function_name'] for attribute in attributes),
87 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib ute in attributes), 87 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib ute in attributes),
88 'has_runtime_enabled_attributes': any(attribute['runtime_enabled_functio n_name'] for attribute in attributes), 88 'has_runtime_enabled_attributes': any(attribute['runtime_enabled_functio n_name'] for attribute in attributes),
89 }) 89 })
90 90
91 methods = [v8_methods.generate_method(interface, method) 91 methods = [v8_methods.generate_method(interface, method)
92 for method in interface.operations] 92 for method in interface.operations]
93 generate_overloads(methods) 93 generate_overloads(methods)
94 template_contents.update({ 94 template_contents.update({
95 'has_per_context_enabled_methods': any(method['per_context_enabled_funct ion_name'] for method in methods), 95 'has_per_context_enabled_methods': any(method['per_context_enabled_funct ion_name'] for method in methods),
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 '%s->IsString()' % cpp_value, 218 '%s->IsString()' % cpp_value,
219 '%s->IsObject()' % cpp_value]) 219 '%s->IsObject()' % cpp_value])
220 if v8_types.array_or_sequence_type(idl_type): 220 if v8_types.array_or_sequence_type(idl_type):
221 return '%s->IsArray()' % cpp_value 221 return '%s->IsArray()' % cpp_value
222 if v8_types.is_wrapper_type(idl_type): 222 if v8_types.is_wrapper_type(idl_type):
223 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value) 223 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value)
224 if argument['is_nullable']: 224 if argument['is_nullable']:
225 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) 225 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check])
226 return type_check 226 return type_check
227 return None 227 return None
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_attributes.py ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698