Chromium Code Reviews| 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 (cpp_name_or_partial, capitalize, conditional_string, c pp_name, gc_type, | 49 from v8_utilities import (api_experiment_enabled_function, cpp_name_or_partial, capitalize, conditional_string, 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', |
| 60 'platform/heap/Handle.h', | 60 'platform/heap/Handle.h', |
| 61 ]) | 61 ]) |
| 62 INTERFACE_CPP_INCLUDES = frozenset([ | 62 INTERFACE_CPP_INCLUDES = frozenset([ |
| 63 'bindings/core/v8/ExceptionState.h', | 63 'bindings/core/v8/ExceptionState.h', |
| 64 'bindings/core/v8/V8DOMConfiguration.h', | 64 'bindings/core/v8/V8DOMConfiguration.h', |
| 65 'bindings/core/v8/V8ObjectConstructor.h', | 65 'bindings/core/v8/V8ObjectConstructor.h', |
| 66 'core/dom/ContextFeatures.h', | 66 'core/dom/ContextFeatures.h', |
| 67 'core/dom/Document.h', | 67 'core/dom/Document.h', |
| 68 'core/experiments/ExperimentalFeatures.h', | |
| 69 'core/inspector/ConsoleMessage.h', | |
| 68 'platform/RuntimeEnabledFeatures.h', | 70 'platform/RuntimeEnabledFeatures.h', |
| 69 'platform/TraceEvent.h', | 71 'platform/TraceEvent.h', |
| 70 'wtf/GetPtr.h', | 72 'wtf/GetPtr.h', |
| 71 'wtf/RefPtr.h', | 73 'wtf/RefPtr.h', |
| 72 ]) | 74 ]) |
| 73 | 75 |
| 74 | 76 |
| 75 def interface_context(interface): | 77 def interface_context(interface): |
| 76 includes.clear() | 78 includes.clear() |
| 77 includes.update(INTERFACE_CPP_INCLUDES) | 79 includes.update(INTERFACE_CPP_INCLUDES) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 this_gc_type = gc_type(interface) | 158 this_gc_type = gc_type(interface) |
| 157 | 159 |
| 158 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod e') else 'ObjectClassId') | 160 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod e') else 'ObjectClassId') |
| 159 | 161 |
| 160 v8_class_name = v8_utilities.v8_class_name(interface) | 162 v8_class_name = v8_utilities.v8_class_name(interface) |
| 161 cpp_class_name = cpp_name(interface) | 163 cpp_class_name = cpp_name(interface) |
| 162 cpp_class_name_or_partial = cpp_name_or_partial(interface) | 164 cpp_class_name_or_partial = cpp_name_or_partial(interface) |
| 163 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) | 165 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) |
| 164 | 166 |
| 165 context = { | 167 context = { |
| 168 'api_experiment_name': v8_utilities.api_experiment_name(interface), | |
| 166 'conditional_string': conditional_string(interface), # [Conditional] | 169 'conditional_string': conditional_string(interface), # [Conditional] |
| 167 'cpp_class': cpp_class_name, | 170 'cpp_class': cpp_class_name, |
| 168 'cpp_class_or_partial': cpp_class_name_or_partial, | 171 'cpp_class_or_partial': cpp_class_name_or_partial, |
| 169 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target else 'NotInheritFromEventTarget', | 172 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target else 'NotInheritFromEventTarget', |
| 170 'gc_type': this_gc_type, | 173 'gc_type': this_gc_type, |
| 171 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 | 174 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 |
| 172 'has_access_check_callbacks': (is_check_security and | 175 'has_access_check_callbacks': (is_check_security and |
| 173 interface.name != 'Window' and | 176 interface.name != 'Window' and |
| 174 interface.name != 'EventTarget'), | 177 interface.name != 'EventTarget'), |
| 175 '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] |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 'unscopeables': sorted(unscopeables), | 257 'unscopeables': sorted(unscopeables), |
| 255 }) | 258 }) |
| 256 | 259 |
| 257 constants = [constant_context(constant, interface) for constant in interface .constants] | 260 constants = [constant_context(constant, interface) for constant in interface .constants] |
| 258 | 261 |
| 259 special_getter_constants = [] | 262 special_getter_constants = [] |
| 260 runtime_enabled_constants = dict() | 263 runtime_enabled_constants = dict() |
| 261 constant_configuration_constants = [] | 264 constant_configuration_constants = [] |
| 262 | 265 |
| 263 for constant in constants: | 266 for constant in constants: |
| 264 if constant['measure_as'] or constant['deprecate_as']: | 267 if constant['measure_as'] or constant['deprecate_as'] or constant['api_e xperiment_name']: |
| 265 special_getter_constants.append(constant) | 268 special_getter_constants.append(constant) |
| 266 continue | 269 continue |
| 267 runtime_enabled_function = constant['runtime_enabled_function'] | 270 runtime_enabled_function = constant['runtime_enabled_function'] |
| 268 if runtime_enabled_function: | 271 if runtime_enabled_function: |
| 269 if runtime_enabled_function not in runtime_enabled_constants: | 272 if runtime_enabled_function not in runtime_enabled_constants: |
| 270 runtime_enabled_constants[runtime_enabled_function] = [] | 273 runtime_enabled_constants[runtime_enabled_function] = [] |
| 271 runtime_enabled_constants[runtime_enabled_function].append(constant) | 274 runtime_enabled_constants[runtime_enabled_function].append(constant) |
| 272 continue | 275 continue |
| 273 constant_configuration_constants.append(constant) | 276 constant_configuration_constants.append(constant) |
| 274 | 277 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 600 'has_named_properties_object': is_global and context['named_property_get ter'], | 603 'has_named_properties_object': is_global and context['named_property_get ter'], |
| 601 }) | 604 }) |
| 602 | 605 |
| 603 return context | 606 return context |
| 604 | 607 |
| 605 | 608 |
| 606 # [DeprecateAs], [Reflect], [RuntimeEnabled] | 609 # [DeprecateAs], [Reflect], [RuntimeEnabled] |
| 607 def constant_context(constant, interface): | 610 def constant_context(constant, interface): |
| 608 extended_attributes = constant.extended_attributes | 611 extended_attributes = constant.extended_attributes |
| 609 return { | 612 return { |
| 613 'api_experiment_name': extended_attributes.get('APIExperimentEnabled'), # [APIExperimentEnabled] | |
| 614 'api_experiment_inherited_enabled': v8_utilities.api_experiment_enabled_ function(interface), # [APIExperimentEnabled] | |
|
haraken
2015/12/30 00:25:32
api_experiment_inherited_enabled => api_experiment
Daniel Nishi
2015/12/30 22:05:50
Done.
| |
| 615 'api_experiment_enabled': v8_utilities.api_experiment_enabled_function(c onstant), # [APIExperimentEnabled] | |
| 610 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), | 616 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), |
| 611 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] | 617 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] |
| 612 'idl_type': constant.idl_type.name, | 618 'idl_type': constant.idl_type.name, |
| 613 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA s] | 619 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA s] |
| 614 'name': constant.name, | 620 'name': constant.name, |
| 615 # FIXME: use 'reflected_name' as correct 'name' | 621 # FIXME: use 'reflected_name' as correct 'name' |
| 616 'reflected_name': extended_attributes.get('Reflect', constant.name), | 622 'reflected_name': extended_attributes.get('Reflect', constant.name), |
| 617 'runtime_enabled_function': runtime_enabled_function_name(constant), | 623 'runtime_enabled_function': runtime_enabled_function_name(constant), |
| 618 'value': constant.value, | 624 'value': constant.value, |
| 619 } | 625 } |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1385 | 1391 |
| 1386 extended_attributes = deleter.extended_attributes | 1392 extended_attributes = deleter.extended_attributes |
| 1387 idl_type = deleter.idl_type | 1393 idl_type = deleter.idl_type |
| 1388 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') | 1394 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') |
| 1389 return { | 1395 return { |
| 1390 'is_call_with_script_state': is_call_with_script_state, | 1396 'is_call_with_script_state': is_call_with_script_state, |
| 1391 'is_custom': 'Custom' in extended_attributes, | 1397 'is_custom': 'Custom' in extended_attributes, |
| 1392 'is_raises_exception': 'RaisesException' in extended_attributes, | 1398 'is_raises_exception': 'RaisesException' in extended_attributes, |
| 1393 'name': cpp_name(deleter), | 1399 'name': cpp_name(deleter), |
| 1394 } | 1400 } |
| OLD | NEW |