| OLD | NEW |
| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 attributes = [v8_attributes.generate_attribute(interface, attribute) | 80 attributes = [v8_attributes.generate_attribute(interface, attribute) |
| 81 for attribute in interface.attributes] | 81 for attribute in interface.attributes] |
| 82 template_contents.update({ | 82 template_contents.update({ |
| 83 'attributes': attributes, | 83 'attributes': attributes, |
| 84 'has_constructor_attributes': any(attribute['is_constructor'] for attrib
ute in attributes), | 84 'has_constructor_attributes': any(attribute['is_constructor'] for attrib
ute in attributes), |
| 85 'has_per_context_enabled_attributes': any(attribute['per_context_enabled
_function_name'] for attribute in attributes), | 85 'has_per_context_enabled_attributes': any(attribute['per_context_enabled
_function_name'] for attribute in attributes), |
| 86 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib
ute in attributes), | 86 'has_replaceable_attributes': any(attribute['is_replaceable'] for attrib
ute in attributes), |
| 87 'has_runtime_enabled_attributes': any(attribute['runtime_enabled_functio
n_name'] for attribute in attributes), | 87 'has_runtime_enabled_attributes': any(attribute['runtime_enabled_functio
n_name'] for attribute in attributes), |
| 88 }) | 88 }) |
| 89 | 89 |
| 90 template_contents['methods'] = [v8_methods.generate_method(interface, method
) | 90 methods = [v8_methods.generate_method(interface, method) |
| 91 for method in interface.operations] | 91 for method in interface.operations] |
| 92 template_contents.update({ |
| 93 'has_non_per_context_enabled_methods': any(not method['per_context_enabl
ed_function_name'] for method in methods), |
| 94 'has_per_context_enabled_methods': any(method['per_context_enabled_funct
ion_name'] for method in methods), |
| 95 'methods': methods, |
| 96 }) |
| 92 | 97 |
| 93 return template_contents | 98 return template_contents |
| 94 | 99 |
| 95 | 100 |
| 96 # [DeprecateAs], [Reflect], [RuntimeEnabled] | 101 # [DeprecateAs], [Reflect], [RuntimeEnabled] |
| 97 def generate_constant(constant): | 102 def generate_constant(constant): |
| 98 # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted | 103 # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted |
| 99 # in C++. | 104 # in C++. |
| 100 if constant.idl_type == 'DOMString': | 105 if constant.idl_type == 'DOMString': |
| 101 value = '"%s"' % constant.value | 106 value = '"%s"' % constant.value |
| 102 else: | 107 else: |
| 103 value = constant.value | 108 value = constant.value |
| 104 | 109 |
| 105 constant_parameter = { | 110 constant_parameter = { |
| 106 'name': constant.name, | 111 'name': constant.name, |
| 107 # FIXME: use 'reflected_name' as correct 'name' | 112 # FIXME: use 'reflected_name' as correct 'name' |
| 108 'reflected_name': constant.extended_attributes.get('Reflect', constant.n
ame), | 113 'reflected_name': constant.extended_attributes.get('Reflect', constant.n
ame), |
| 109 'runtime_enabled_function_name': runtime_enabled_function_name(constant)
, | 114 'runtime_enabled_function_name': runtime_enabled_function_name(constant)
, |
| 110 'value': value, | 115 'value': value, |
| 111 } | 116 } |
| 112 return constant_parameter | 117 return constant_parameter |
| OLD | NEW |