OLD | NEW |
---|---|
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # coding=utf-8 | 2 # coding=utf-8 |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 def interface_context(interface): | 75 def interface_context(interface): |
76 includes.clear() | 76 includes.clear() |
77 includes.update(INTERFACE_CPP_INCLUDES) | 77 includes.update(INTERFACE_CPP_INCLUDES) |
78 header_includes = set(INTERFACE_H_INCLUDES) | 78 header_includes = set(INTERFACE_H_INCLUDES) |
79 | 79 |
80 parent_interface = interface.parent | 80 parent_interface = interface.parent |
81 if parent_interface: | 81 if parent_interface: |
82 header_includes.update(v8_types.includes_for_interface(parent_interface) ) | 82 header_includes.update(v8_types.includes_for_interface(parent_interface) ) |
83 extended_attributes = interface.extended_attributes | 83 extended_attributes = interface.extended_attributes |
84 | 84 |
85 is_array_type = IdlType(interface.name).is_array_buffer_or_view | |
haraken
2014/10/16 05:41:41
is_array_type => is_array_buffer_or_view (or simpl
Yuki
2014/10/16 14:21:50
Done.
| |
86 is_typed_array_type = IdlType(interface.name).is_typed_array | |
87 if is_array_type: | |
88 includes.add('bindings/core/v8/V8ArrayBuffer.h') | |
89 if interface.name == 'ArrayBufferView': | |
90 includes.update(( | |
91 'bindings/core/v8/V8Int8Array.h', | |
92 'bindings/core/v8/V8Int16Array.h', | |
93 'bindings/core/v8/V8Int32Array.h', | |
94 'bindings/core/v8/V8Uint8Array.h', | |
95 'bindings/core/v8/V8Uint8ClampedArray.h', | |
96 'bindings/core/v8/V8Uint16Array.h', | |
97 'bindings/core/v8/V8Uint32Array.h', | |
98 'bindings/core/v8/V8Float32Array.h', | |
99 'bindings/core/v8/V8Float64Array.h', | |
100 'bindings/core/v8/V8DataView.h')) | |
101 | |
85 # [ActiveDOMObject] | 102 # [ActiveDOMObject] |
86 is_active_dom_object = 'ActiveDOMObject' in extended_attributes | 103 is_active_dom_object = 'ActiveDOMObject' in extended_attributes |
87 | 104 |
88 # [CheckSecurity] | 105 # [CheckSecurity] |
89 is_check_security = 'CheckSecurity' in extended_attributes | 106 is_check_security = 'CheckSecurity' in extended_attributes |
90 if is_check_security: | 107 if is_check_security: |
91 includes.add('bindings/core/v8/BindingSecurity.h') | 108 includes.add('bindings/core/v8/BindingSecurity.h') |
92 | 109 |
93 # [DependentLifetime] | 110 # [DependentLifetime] |
94 is_dependent_lifetime = 'DependentLifetime' in extended_attributes | 111 is_dependent_lifetime = 'DependentLifetime' in extended_attributes |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 'has_access_check_callbacks': (is_check_security and | 167 'has_access_check_callbacks': (is_check_security and |
151 interface.name != 'Window' and | 168 interface.name != 'Window' and |
152 interface.name != 'EventTarget'), | 169 interface.name != 'EventTarget'), |
153 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] | 170 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] |
154 'has_custom_to_v8': has_extended_attribute_value(interface, 'Custom', 'T oV8'), # [Custom=ToV8] | 171 'has_custom_to_v8': has_extended_attribute_value(interface, 'Custom', 'T oV8'), # [Custom=ToV8] |
155 'has_custom_wrap': has_extended_attribute_value(interface, 'Custom', 'Wr ap'), # [Custom=Wrap] | 172 'has_custom_wrap': has_extended_attribute_value(interface, 'Custom', 'Wr ap'), # [Custom=Wrap] |
156 'has_visit_dom_wrapper': has_visit_dom_wrapper, | 173 'has_visit_dom_wrapper': has_visit_dom_wrapper, |
157 'header_includes': header_includes, | 174 'header_includes': header_includes, |
158 'interface_name': interface.name, | 175 'interface_name': interface.name, |
159 'is_active_dom_object': is_active_dom_object, | 176 'is_active_dom_object': is_active_dom_object, |
177 'is_array_type': is_array_type, | |
haraken
2014/10/16 05:41:41
is_array_type => is_array_buffer
Yuki
2014/10/16 14:21:50
Done.
| |
160 'is_check_security': is_check_security, | 178 'is_check_security': is_check_security, |
161 'is_dependent_lifetime': is_dependent_lifetime, | 179 'is_dependent_lifetime': is_dependent_lifetime, |
162 'is_event_target': inherits_interface(interface.name, 'EventTarget'), | 180 'is_event_target': inherits_interface(interface.name, 'EventTarget'), |
163 'is_exception': interface.is_exception, | 181 'is_exception': interface.is_exception, |
164 'is_node': inherits_interface(interface.name, 'Node'), | 182 'is_node': inherits_interface(interface.name, 'Node'), |
165 'is_script_wrappable': is_script_wrappable, | 183 'is_script_wrappable': is_script_wrappable, |
184 'is_typed_array_type': is_typed_array_type, | |
185 'is_v8object': not is_array_type, # The object is wrapped with v8::Obje ct. | |
haraken
2014/10/16 05:41:41
Hmm, I'd prefer not introducing is_v8object, given
Yuki
2014/10/16 14:21:50
Done.
| |
166 'iterator_method': iterator_method, | 186 'iterator_method': iterator_method, |
167 'lifetime': 'Dependent' | 187 'lifetime': 'Dependent' |
168 if (has_visit_dom_wrapper or | 188 if (has_visit_dom_wrapper or |
169 is_active_dom_object or | 189 is_active_dom_object or |
170 is_dependent_lifetime) | 190 is_dependent_lifetime) |
171 else 'Independent', | 191 else 'Independent', |
172 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs] | 192 'measure_as': v8_utilities.measure_as(interface), # [MeasureAs] |
173 'parent_interface': parent_interface, | 193 'parent_interface': parent_interface, |
174 'pass_cpp_type': cpp_template_type( | 194 'pass_cpp_type': cpp_template_type( |
175 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), | 195 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), |
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1133 deleter = next( | 1153 deleter = next( |
1134 method | 1154 method |
1135 for method in interface.operations | 1155 for method in interface.operations |
1136 if ('deleter' in method.specials and | 1156 if ('deleter' in method.specials and |
1137 len(method.arguments) == 1 and | 1157 len(method.arguments) == 1 and |
1138 str(method.arguments[0].idl_type) == 'DOMString')) | 1158 str(method.arguments[0].idl_type) == 'DOMString')) |
1139 except StopIteration: | 1159 except StopIteration: |
1140 return None | 1160 return None |
1141 | 1161 |
1142 return property_deleter(deleter) | 1162 return property_deleter(deleter) |
OLD | NEW |