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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 uncapitalize, extended_attribute_value_as_list, is_unf
orgeable, | 43 uncapitalize, extended_attribute_value_as_list, is_unf
orgeable, |
44 is_legacy_interface_type_checking) | 44 is_legacy_interface_type_checking) |
45 | 45 |
46 | 46 |
47 def attribute_context(interface, attribute): | 47 def attribute_context(interface, attribute): |
48 idl_type = attribute.idl_type | 48 idl_type = attribute.idl_type |
49 base_idl_type = idl_type.base_type | 49 base_idl_type = idl_type.base_type |
50 extended_attributes = attribute.extended_attributes | 50 extended_attributes = attribute.extended_attributes |
51 | 51 |
52 idl_type.add_includes_for_type(extended_attributes) | 52 idl_type.add_includes_for_type(extended_attributes) |
53 if idl_type.enum_values: | 53 if idl_type.enum_values or v8_utilities.api_experiment_name(attribute): |
54 includes.add('core/inspector/ConsoleMessage.h') | 54 includes.add('core/inspector/ConsoleMessage.h') |
55 | 55 |
56 # [CheckSecurity] | 56 # [CheckSecurity] |
57 is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes | 57 is_do_not_check_security = 'DoNotCheckSecurity' in extended_attributes |
58 is_check_security_for_receiver = ( | 58 is_check_security_for_receiver = ( |
59 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and | 59 has_extended_attribute_value(interface, 'CheckSecurity', 'Receiver') and |
60 not is_do_not_check_security) | 60 not is_do_not_check_security) |
61 is_check_security_for_return_value = ( | 61 is_check_security_for_return_value = ( |
62 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue')) | 62 has_extended_attribute_value(attribute, 'CheckSecurity', 'ReturnValue')) |
63 if is_check_security_for_receiver or is_check_security_for_return_value: | 63 if is_check_security_for_receiver or is_check_security_for_return_value: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 102 'argument_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
103 'cached_attribute_validation_method': cached_attribute_validation_method
, | 103 'cached_attribute_validation_method': cached_attribute_validation_method
, |
104 'conditional_string': v8_utilities.conditional_string(attribute), | 104 'conditional_string': v8_utilities.conditional_string(attribute), |
105 'constructor_type': constructor_type, | 105 'constructor_type': constructor_type, |
106 'cpp_name': cpp_name(attribute), | 106 'cpp_name': cpp_name(attribute), |
107 'cpp_type': idl_type.cpp_type, | 107 'cpp_type': idl_type.cpp_type, |
108 'cpp_type_initializer': idl_type.cpp_type_initializer, | 108 'cpp_type_initializer': idl_type.cpp_type_initializer, |
109 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] | 109 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] |
110 'enum_type': idl_type.enum_type, | 110 'enum_type': idl_type.enum_type, |
111 'enum_values': idl_type.enum_values, | 111 'enum_values': idl_type.enum_values, |
| 112 'api_experiment_name': v8_utilities.api_experiment_name(attribute), # [
APIExperimentEnabled] |
112 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] | 113 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] |
113 'has_custom_getter': has_custom_getter(attribute), | 114 'has_custom_getter': has_custom_getter(attribute), |
114 'has_custom_setter': has_custom_setter(attribute), | 115 'has_custom_setter': has_custom_setter(attribute), |
115 'has_setter': has_setter(attribute), | 116 'has_setter': has_setter(attribute), |
116 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType | 117 'idl_type': str(idl_type), # need trailing [] on array for Dictionary::
ConversionContext::setConversionType |
117 'is_call_with_execution_context': has_extended_attribute_value(attribute
, 'CallWith', 'ExecutionContext'), | 118 'is_call_with_execution_context': has_extended_attribute_value(attribute
, 'CallWith', 'ExecutionContext'), |
118 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca
llWith', 'ScriptState'), | 119 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca
llWith', 'ScriptState'), |
119 'is_check_security_for_receiver': is_check_security_for_receiver, | 120 'is_check_security_for_receiver': is_check_security_for_receiver, |
120 'is_check_security_for_return_value': is_check_security_for_return_value
, | 121 'is_check_security_for_return_value': is_check_security_for_return_value
, |
121 'is_custom_element_callbacks': is_custom_element_callbacks, | 122 'is_custom_element_callbacks': is_custom_element_callbacks, |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 # FIXME: replace this with a [ConstructorAttribute] extended attribute | 499 # FIXME: replace this with a [ConstructorAttribute] extended attribute |
499 lambda self: strip_suffix(self.base_type, 'Constructor')) | 500 lambda self: strip_suffix(self.base_type, 'Constructor')) |
500 | 501 |
501 | 502 |
502 def is_constructor_attribute(attribute): | 503 def is_constructor_attribute(attribute): |
503 # FIXME: replace this with [ConstructorAttribute] extended attribute | 504 # FIXME: replace this with [ConstructorAttribute] extended attribute |
504 return attribute.idl_type.name.endswith('Constructor') | 505 return attribute.idl_type.name.endswith('Constructor') |
505 | 506 |
506 | 507 |
507 def update_constructor_attribute_context(interface, attribute, context): | 508 def update_constructor_attribute_context(interface, attribute, context): |
508 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 509 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] or context['api_experiment_name'] |
509 # When the attribute name is the same as the interface name, do not generate | 510 # When the attribute name is the same as the interface name, do not generate |
510 # callback functions for each attribute and use | 511 # callback functions for each attribute and use |
511 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate | 512 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate |
512 # a callback function in order to hard-code the attribute name. | 513 # a callback function in order to hard-code the attribute name. |
513 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] | 514 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] |
OLD | NEW |