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 28 matching lines...) Expand all Loading... |
39 import idl_definitions | 39 import idl_definitions |
40 from idl_definitions import IdlOperation, IdlArgument | 40 from idl_definitions import IdlOperation, IdlArgument |
41 import idl_types | 41 import idl_types |
42 from idl_types import IdlType, inherits_interface | 42 from idl_types import IdlType, inherits_interface |
43 import v8_attributes | 43 import v8_attributes |
44 from v8_globals import includes | 44 from v8_globals import includes |
45 import v8_methods | 45 import v8_methods |
46 import v8_types | 46 import v8_types |
47 from v8_types import cpp_ptr_type, cpp_template_type | 47 from v8_types import cpp_ptr_type, cpp_template_type |
48 import v8_utilities | 48 import v8_utilities |
49 from v8_utilities import (api_experiment_enabled_function, cpp_name_or_partial,
capitalize, cpp_name, gc_type, | 49 from v8_utilities import (origin_trial_enabled_function, cpp_name_or_partial, ca
pitalize, cpp_name, gc_type, |
50 has_extended_attribute_value, runtime_enabled_function
_name, | 50 has_extended_attribute_value, runtime_enabled_function
_name, |
51 extended_attribute_value_as_list, is_legacy_interface_
type_checking) | 51 extended_attribute_value_as_list, is_legacy_interface_
type_checking) |
52 | 52 |
53 | 53 |
54 INTERFACE_H_INCLUDES = frozenset([ | 54 INTERFACE_H_INCLUDES = frozenset([ |
55 'bindings/core/v8/ScriptWrappable.h', | 55 'bindings/core/v8/ScriptWrappable.h', |
56 'bindings/core/v8/ToV8.h', | 56 'bindings/core/v8/ToV8.h', |
57 'bindings/core/v8/V8Binding.h', | 57 'bindings/core/v8/V8Binding.h', |
58 'bindings/core/v8/V8DOMWrapper.h', | 58 'bindings/core/v8/V8DOMWrapper.h', |
59 'bindings/core/v8/WrapperTypeInfo.h', | 59 'bindings/core/v8/WrapperTypeInfo.h', |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 this_gc_type = gc_type(interface) | 156 this_gc_type = gc_type(interface) |
157 | 157 |
158 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod
e') else 'ObjectClassId') | 158 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod
e') else 'ObjectClassId') |
159 | 159 |
160 v8_class_name = v8_utilities.v8_class_name(interface) | 160 v8_class_name = v8_utilities.v8_class_name(interface) |
161 cpp_class_name = cpp_name(interface) | 161 cpp_class_name = cpp_name(interface) |
162 cpp_class_name_or_partial = cpp_name_or_partial(interface) | 162 cpp_class_name_or_partial = cpp_name_or_partial(interface) |
163 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) | 163 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) |
164 | 164 |
165 if 'APIExperimentEnabled' in extended_attributes: | 165 if 'OriginTrialEnabled' in extended_attributes: |
166 includes.add('core/inspector/ConsoleMessage.h') | 166 includes.add('core/inspector/ConsoleMessage.h') |
167 includes.add('core/origin_trials/OriginTrials.h') | 167 includes.add('core/origin_trials/OriginTrials.h') |
168 | 168 |
169 context = { | 169 context = { |
170 'api_experiment_name': v8_utilities.api_experiment_name(interface), | |
171 'cpp_class': cpp_class_name, | 170 'cpp_class': cpp_class_name, |
172 'cpp_class_or_partial': cpp_class_name_or_partial, | 171 'cpp_class_or_partial': cpp_class_name_or_partial, |
173 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target
else 'NotInheritFromEventTarget', | 172 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target
else 'NotInheritFromEventTarget', |
174 'gc_type': this_gc_type, | 173 'gc_type': this_gc_type, |
175 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 | 174 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 |
176 'has_access_check_callbacks': (is_check_security and | 175 'has_access_check_callbacks': (is_check_security and |
177 interface.name != 'Window' and | 176 interface.name != 'Window' and |
178 interface.name != 'EventTarget'), | 177 interface.name != 'EventTarget'), |
179 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter
face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] | 178 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter
face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] |
180 'has_partial_interface': len(interface.partial_interfaces) > 0, | 179 'has_partial_interface': len(interface.partial_interfaces) > 0, |
181 'has_visit_dom_wrapper': has_visit_dom_wrapper, | 180 'has_visit_dom_wrapper': has_visit_dom_wrapper, |
182 'header_includes': header_includes, | 181 'header_includes': header_includes, |
183 'interface_name': interface.name, | 182 'interface_name': interface.name, |
184 'is_active_dom_object': is_active_dom_object, | 183 'is_active_dom_object': is_active_dom_object, |
185 'is_array_buffer_or_view': is_array_buffer_or_view, | 184 'is_array_buffer_or_view': is_array_buffer_or_view, |
186 'is_check_security': is_check_security, | 185 'is_check_security': is_check_security, |
187 'is_event_target': is_event_target, | 186 'is_event_target': is_event_target, |
188 'is_exception': interface.is_exception, | 187 'is_exception': interface.is_exception, |
189 'is_global': is_global, | 188 'is_global': is_global, |
190 'is_node': inherits_interface(interface.name, 'Node'), | 189 'is_node': inherits_interface(interface.name, 'Node'), |
191 'is_partial': interface.is_partial, | 190 'is_partial': interface.is_partial, |
192 'is_typed_array_type': is_typed_array_type, | 191 'is_typed_array_type': is_typed_array_type, |
193 'lifetime': 'Dependent' | 192 'lifetime': 'Dependent' |
194 if (has_visit_dom_wrapper or | 193 if (has_visit_dom_wrapper or |
195 is_active_dom_object or | 194 is_active_dom_object or |
196 is_dependent_lifetime) | 195 is_dependent_lifetime) |
197 else 'Independent', | 196 else 'Independent', |
198 'measure_as': v8_utilities.measure_as(interface, None), # [MeasureAs] | 197 'measure_as': v8_utilities.measure_as(interface, None), # [MeasureAs] |
| 198 'origin_trial_name': v8_utilities.origin_trial_name(interface), |
199 'parent_interface': parent_interface, | 199 'parent_interface': parent_interface, |
200 'pass_cpp_type': cpp_template_type( | 200 'pass_cpp_type': cpp_template_type( |
201 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), | 201 cpp_ptr_type('PassRefPtr', 'RawPtr', this_gc_type), |
202 cpp_name(interface)), | 202 cpp_name(interface)), |
203 'runtime_enabled_function': runtime_enabled_function_name(interface), #
[RuntimeEnabled] | 203 'runtime_enabled_function': runtime_enabled_function_name(interface), #
[RuntimeEnabled] |
204 'set_wrapper_reference_from': set_wrapper_reference_from, | 204 'set_wrapper_reference_from': set_wrapper_reference_from, |
205 'set_wrapper_reference_to': set_wrapper_reference_to, | 205 'set_wrapper_reference_to': set_wrapper_reference_to, |
206 'v8_class': v8_class_name, | 206 'v8_class': v8_class_name, |
207 'v8_class_or_partial': v8_class_name_or_partial, | 207 'v8_class_or_partial': v8_class_name_or_partial, |
208 'wrapper_class_id': wrapper_class_id, | 208 'wrapper_class_id': wrapper_class_id, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 'unscopeables': sorted(unscopeables), | 258 'unscopeables': sorted(unscopeables), |
259 }) | 259 }) |
260 | 260 |
261 constants = [constant_context(constant, interface) for constant in interface
.constants] | 261 constants = [constant_context(constant, interface) for constant in interface
.constants] |
262 | 262 |
263 special_getter_constants = [] | 263 special_getter_constants = [] |
264 runtime_enabled_constants = dict() | 264 runtime_enabled_constants = dict() |
265 constant_configuration_constants = [] | 265 constant_configuration_constants = [] |
266 | 266 |
267 for constant in constants: | 267 for constant in constants: |
268 if constant['measure_as'] or constant['deprecate_as'] or constant['api_e
xperiment_name']: | 268 if constant['measure_as'] or constant['deprecate_as'] or constant['origi
n_trial_name']: |
269 special_getter_constants.append(constant) | 269 special_getter_constants.append(constant) |
270 continue | 270 continue |
271 runtime_enabled_function = constant['runtime_enabled_function'] | 271 runtime_enabled_function = constant['runtime_enabled_function'] |
272 if runtime_enabled_function: | 272 if runtime_enabled_function: |
273 if runtime_enabled_function not in runtime_enabled_constants: | 273 if runtime_enabled_function not in runtime_enabled_constants: |
274 runtime_enabled_constants[runtime_enabled_function] = [] | 274 runtime_enabled_constants[runtime_enabled_function] = [] |
275 runtime_enabled_constants[runtime_enabled_function].append(constant) | 275 runtime_enabled_constants[runtime_enabled_function].append(constant) |
276 continue | 276 continue |
277 constant_configuration_constants.append(constant) | 277 constant_configuration_constants.append(constant) |
278 | 278 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 'named_property_setter': property_setter(interface.named_property_setter
, interface), | 601 'named_property_setter': property_setter(interface.named_property_setter
, interface), |
602 'named_property_deleter': property_deleter(interface.named_property_dele
ter), | 602 'named_property_deleter': property_deleter(interface.named_property_dele
ter), |
603 }) | 603 }) |
604 context.update({ | 604 context.update({ |
605 'has_named_properties_object': is_global and context['named_property_get
ter'], | 605 'has_named_properties_object': is_global and context['named_property_get
ter'], |
606 }) | 606 }) |
607 | 607 |
608 return context | 608 return context |
609 | 609 |
610 | 610 |
611 # [DeprecateAs], [Reflect], [RuntimeEnabled] | 611 # [DeprecateAs], [OriginTrialEnabled], [Reflect], [RuntimeEnabled] |
612 def constant_context(constant, interface): | 612 def constant_context(constant, interface): |
613 extended_attributes = constant.extended_attributes | 613 extended_attributes = constant.extended_attributes |
614 | 614 |
615 if 'APIExperimentEnabled' in extended_attributes: | 615 if 'OriginTrialEnabled' in extended_attributes: |
616 includes.add('core/inspector/ConsoleMessage.h') | 616 includes.add('core/inspector/ConsoleMessage.h') |
617 includes.add('core/origin_trials/OriginTrials.h') | 617 includes.add('core/origin_trials/OriginTrials.h') |
618 | 618 |
619 return { | 619 return { |
620 'api_experiment_enabled': v8_utilities.api_experiment_enabled_function(c
onstant), # [APIExperimentEnabled] | |
621 'api_experiment_enabled_per_interface': v8_utilities.api_experiment_enab
led_function(interface), # [APIExperimentEnabled] | |
622 'api_experiment_name': extended_attributes.get('APIExperimentEnabled'),
# [APIExperimentEnabled] | |
623 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), | 620 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), |
624 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] | 621 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] |
625 'idl_type': constant.idl_type.name, | 622 'idl_type': constant.idl_type.name, |
626 'is_api_experiment_enabled': v8_utilities.api_experiment_enabled_functio
n(constant) or v8_utilities.api_experiment_enabled_function(interface), # [APIE
xperimentEnabled] | 623 'is_origin_trial_enabled': v8_utilities.origin_trial_enabled_function(co
nstant) or v8_utilities.origin_trial_enabled_function(interface), # [OriginTria
lEnabled] |
627 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA
s] | 624 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA
s] |
628 'name': constant.name, | 625 'name': constant.name, |
| 626 'origin_trial_enabled': v8_utilities.origin_trial_enabled_function(const
ant), # [OriginTrialEnabled] |
| 627 'origin_trial_enabled_per_interface': v8_utilities.origin_trial_enabled_
function(interface), # [OriginTrialEnabled] |
| 628 'origin_trial_name': extended_attributes.get('OriginTrialEnabled'), # [
OriginTrialEnabled] |
629 # FIXME: use 'reflected_name' as correct 'name' | 629 # FIXME: use 'reflected_name' as correct 'name' |
630 'reflected_name': extended_attributes.get('Reflect', constant.name), | 630 'reflected_name': extended_attributes.get('Reflect', constant.name), |
631 'runtime_enabled_function': runtime_enabled_function_name(constant), | 631 'runtime_enabled_function': runtime_enabled_function_name(constant), #
[RuntimeEnabled] |
632 'value': constant.value, | 632 'value': constant.value, |
633 } | 633 } |
634 | 634 |
635 | 635 |
636 ################################################################################ | 636 ################################################################################ |
637 # Overloads | 637 # Overloads |
638 ################################################################################ | 638 ################################################################################ |
639 | 639 |
640 def compute_method_overloads_context(interface, methods): | 640 def compute_method_overloads_context(interface, methods): |
641 # Regular methods | 641 # Regular methods |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 | 1399 |
1400 extended_attributes = deleter.extended_attributes | 1400 extended_attributes = deleter.extended_attributes |
1401 idl_type = deleter.idl_type | 1401 idl_type = deleter.idl_type |
1402 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') | 1402 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') |
1403 return { | 1403 return { |
1404 'is_call_with_script_state': is_call_with_script_state, | 1404 'is_call_with_script_state': is_call_with_script_state, |
1405 'is_custom': 'Custom' in extended_attributes, | 1405 'is_custom': 'Custom' in extended_attributes, |
1406 'is_raises_exception': 'RaisesException' in extended_attributes, | 1406 'is_raises_exception': 'RaisesException' in extended_attributes, |
1407 'name': cpp_name(deleter), | 1407 'name': cpp_name(deleter), |
1408 } | 1408 } |
OLD | NEW |