| 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), | 170 'origin_trial_name': v8_utilities.origin_trial_name(interface), |
| 171 'cpp_class': cpp_class_name, | 171 'cpp_class': cpp_class_name, |
| 172 'cpp_class_or_partial': cpp_class_name_or_partial, | 172 'cpp_class_or_partial': cpp_class_name_or_partial, |
| 173 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target
else 'NotInheritFromEventTarget', | 173 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target
else 'NotInheritFromEventTarget', |
| 174 'gc_type': this_gc_type, | 174 'gc_type': this_gc_type, |
| 175 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 | 175 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 |
| 176 'has_access_check_callbacks': (is_check_security and | 176 'has_access_check_callbacks': (is_check_security and |
| 177 interface.name != 'Window' and | 177 interface.name != 'Window' and |
| 178 interface.name != 'EventTarget'), | 178 interface.name != 'EventTarget'), |
| 179 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter
face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] | 179 '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, | 180 'has_partial_interface': len(interface.partial_interfaces) > 0, |
| (...skipping 77 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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], [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] | 620 'origin_trial_enabled': v8_utilities.origin_trial_enabled_function(const
ant), # [OriginTrialEnabled] |
| 621 'api_experiment_enabled_per_interface': v8_utilities.api_experiment_enab
led_function(interface), # [APIExperimentEnabled] | 621 'origin_trial_enabled_per_interface': v8_utilities.origin_trial_enabled_
function(interface), # [OriginTrialEnabled] |
| 622 'api_experiment_name': extended_attributes.get('APIExperimentEnabled'),
# [APIExperimentEnabled] | 622 'origin_trial_name': extended_attributes.get('OriginTrialEnabled'), # [
OriginTrialEnabled] |
| 623 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), | 623 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), |
| 624 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] | 624 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] |
| 625 'idl_type': constant.idl_type.name, | 625 '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] | 626 '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] | 627 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA
s] |
| 628 'name': constant.name, | 628 'name': constant.name, |
| 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), |
| 632 'value': constant.value, | 632 'value': constant.value, |
| 633 } | 633 } |
| 634 | 634 |
| 635 | 635 |
| 636 ################################################################################ | 636 ################################################################################ |
| (...skipping 762 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 |