| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/Experiments.h', |
| 68 'platform/RuntimeEnabledFeatures.h', | 69 'platform/RuntimeEnabledFeatures.h', |
| 69 'platform/TraceEvent.h', | 70 'platform/TraceEvent.h', |
| 70 'wtf/GetPtr.h', | 71 'wtf/GetPtr.h', |
| 71 'wtf/RefPtr.h', | 72 'wtf/RefPtr.h', |
| 72 ]) | 73 ]) |
| 73 | 74 |
| 74 | 75 |
| 75 def interface_context(interface): | 76 def interface_context(interface): |
| 76 includes.clear() | 77 includes.clear() |
| 77 includes.update(INTERFACE_CPP_INCLUDES) | 78 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) | 157 this_gc_type = gc_type(interface) |
| 157 | 158 |
| 158 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod
e') else 'ObjectClassId') | 159 wrapper_class_id = ('NodeClassId' if inherits_interface(interface.name, 'Nod
e') else 'ObjectClassId') |
| 159 | 160 |
| 160 v8_class_name = v8_utilities.v8_class_name(interface) | 161 v8_class_name = v8_utilities.v8_class_name(interface) |
| 161 cpp_class_name = cpp_name(interface) | 162 cpp_class_name = cpp_name(interface) |
| 162 cpp_class_name_or_partial = cpp_name_or_partial(interface) | 163 cpp_class_name_or_partial = cpp_name_or_partial(interface) |
| 163 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) | 164 v8_class_name_or_partial = v8_utilities.v8_class_name_or_partial(interface) |
| 164 | 165 |
| 165 context = { | 166 context = { |
| 167 'api_experiment_name': v8_utilities.api_experiment_name(interface), |
| 166 'conditional_string': conditional_string(interface), # [Conditional] | 168 'conditional_string': conditional_string(interface), # [Conditional] |
| 167 'cpp_class': cpp_class_name, | 169 'cpp_class': cpp_class_name, |
| 168 'cpp_class_or_partial': cpp_class_name_or_partial, | 170 'cpp_class_or_partial': cpp_class_name_or_partial, |
| 169 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target
else 'NotInheritFromEventTarget', | 171 'event_target_inheritance': 'InheritFromEventTarget' if is_event_target
else 'NotInheritFromEventTarget', |
| 170 'gc_type': this_gc_type, | 172 'gc_type': this_gc_type, |
| 171 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 | 173 # FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699 |
| 172 'has_access_check_callbacks': (is_check_security and | 174 'has_access_check_callbacks': (is_check_security and |
| 173 interface.name != 'Window' and | 175 interface.name != 'Window' and |
| 174 interface.name != 'EventTarget'), | 176 interface.name != 'EventTarget'), |
| 175 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter
face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] | 177 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter
face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 includes.add('bindings/core/v8/V8ObjectConstructor.h') | 234 includes.add('bindings/core/v8/V8ObjectConstructor.h') |
| 233 includes.add('core/frame/LocalDOMWindow.h') | 235 includes.add('core/frame/LocalDOMWindow.h') |
| 234 elif 'Measure' in extended_attributes or 'MeasureAs' in extended_attributes: | 236 elif 'Measure' in extended_attributes or 'MeasureAs' in extended_attributes: |
| 235 raise Exception('[Measure] or [MeasureAs] specified for interface withou
t a constructor: ' | 237 raise Exception('[Measure] or [MeasureAs] specified for interface withou
t a constructor: ' |
| 236 '%s' % interface.name) | 238 '%s' % interface.name) |
| 237 | 239 |
| 238 # [Unscopeable] attributes and methods | 240 # [Unscopeable] attributes and methods |
| 239 unscopeables = [] | 241 unscopeables = [] |
| 240 for attribute in interface.attributes: | 242 for attribute in interface.attributes: |
| 241 if 'Unscopeable' in attribute.extended_attributes: | 243 if 'Unscopeable' in attribute.extended_attributes: |
| 242 unscopeables.append((attribute.name, v8_utilities.runtime_enabled_fu
nction_name(attribute))) | 244 unscopeables.append((attribute.name, v8_utilities.runtime_enabled_fu
nction_name(attribute), v8_utilities.api_experiment_name(attribute))) |
| 243 for method in interface.operations: | 245 for method in interface.operations: |
| 244 if 'Unscopeable' in method.extended_attributes: | 246 if 'Unscopeable' in method.extended_attributes: |
| 245 unscopeables.append((method.name, v8_utilities.runtime_enabled_funct
ion_name(method))) | 247 unscopeables.append((method.name, v8_utilities.runtime_enabled_funct
ion_name(method), v8_utilities.api_experiment_name(method))) |
| 246 | 248 |
| 247 context.update({ | 249 context.update({ |
| 248 'constructors': constructors, | 250 'constructors': constructors, |
| 249 'has_custom_constructor': bool(custom_constructors), | 251 'has_custom_constructor': bool(custom_constructors), |
| 250 'interface_length': | 252 'interface_length': |
| 251 interface_length(interface, constructors + custom_constructors), | 253 interface_length(interface, constructors + custom_constructors), |
| 252 'is_constructor_raises_exception': extended_attributes.get('RaisesExcept
ion') == 'Constructor', # [RaisesException=Constructor] | 254 'is_constructor_raises_exception': extended_attributes.get('RaisesExcept
ion') == 'Constructor', # [RaisesException=Constructor] |
| 253 'named_constructor': named_constructor, | 255 'named_constructor': named_constructor, |
| 254 'unscopeables': sorted(unscopeables), | 256 'unscopeables': sorted(unscopeables), |
| 255 }) | 257 }) |
| 256 | 258 |
| 257 constants = [constant_context(constant, interface) for constant in interface
.constants] | 259 constants = [constant_context(constant, interface) for constant in interface
.constants] |
| 258 | 260 |
| 259 special_getter_constants = [] | 261 special_getter_constants = [] |
| 260 runtime_enabled_constants = dict() | 262 runtime_enabled_constants = dict() |
| 263 experimental_enabled_constants = dict() |
| 264 experimental_only_enabled_constants = [] |
| 261 constant_configuration_constants = [] | 265 constant_configuration_constants = [] |
| 262 | 266 |
| 263 for constant in constants: | 267 for constant in constants: |
| 268 api_experiment_name = constant['api_experiment_name'] |
| 264 if constant['measure_as'] or constant['deprecate_as']: | 269 if constant['measure_as'] or constant['deprecate_as']: |
| 265 special_getter_constants.append(constant) | 270 special_getter_constants.append(constant) |
| 266 continue | 271 continue |
| 267 runtime_enabled_function = constant['runtime_enabled_function'] | 272 runtime_enabled_function = constant['runtime_enabled_function'] |
| 268 if runtime_enabled_function: | 273 if runtime_enabled_function: |
| 269 if runtime_enabled_function not in runtime_enabled_constants: | 274 if runtime_enabled_function not in runtime_enabled_constants: |
| 270 runtime_enabled_constants[runtime_enabled_function] = [] | 275 runtime_enabled_constants[runtime_enabled_function] = [] |
| 271 runtime_enabled_constants[runtime_enabled_function].append(constant) | 276 runtime_enabled_constants[runtime_enabled_function].append(constant) |
| 277 if api_experiment_name: |
| 278 experimental_enabled_constants[constant['name']] = api_experimen
t_name |
| 279 continue |
| 280 if api_experiment_name: |
| 281 experimental_only_enabled_constants.append(constant) |
| 272 continue | 282 continue |
| 273 constant_configuration_constants.append(constant) | 283 constant_configuration_constants.append(constant) |
| 274 | 284 |
| 275 # Constants | 285 # Constants |
| 276 context.update({ | 286 context.update({ |
| 277 'constant_configuration_constants': constant_configuration_constants, | 287 'constant_configuration_constants': constant_configuration_constants, |
| 278 'constants': constants, | 288 'constants': constants, |
| 279 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, | 289 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, |
| 290 'experimental_enabled_constants': experimental_enabled_constants, |
| 291 'experimental_only_constants': experimental_only_enabled_constants, |
| 280 'has_constant_configuration': any( | 292 'has_constant_configuration': any( |
| 281 not constant['runtime_enabled_function'] | 293 (constant['runtime_enabled_function'] is None and constant['api_expe
riment_name'] is None) |
| 282 for constant in constants), | 294 for constant in constants), |
| 283 'runtime_enabled_constants': sorted(runtime_enabled_constants.iteritems(
)), | 295 'runtime_enabled_constants': sorted(runtime_enabled_constants.iteritems(
)), |
| 284 'special_getter_constants': special_getter_constants, | 296 'special_getter_constants': special_getter_constants, |
| 285 }) | 297 }) |
| 286 | 298 |
| 287 # Attributes | 299 # Attributes |
| 288 attributes = [v8_attributes.attribute_context(interface, attribute) | 300 attributes = [v8_attributes.attribute_context(interface, attribute) |
| 289 for attribute in interface.attributes] | 301 for attribute in interface.attributes] |
| 290 | 302 |
| 291 has_conditional_attributes = any(attribute['exposed_test'] for attribute in
attributes) | 303 has_conditional_attributes = any(attribute['exposed_test'] for attribute in
attributes) |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 | 528 |
| 517 if 'overloads' in method: | 529 if 'overloads' in method: |
| 518 overloads = method['overloads'] | 530 overloads = method['overloads'] |
| 519 if not overloads['visible']: | 531 if not overloads['visible']: |
| 520 continue | 532 continue |
| 521 # original interface will register instead of partial interface. | 533 # original interface will register instead of partial interface. |
| 522 if overloads['has_partial_overloads'] and interface.is_partial: | 534 if overloads['has_partial_overloads'] and interface.is_partial: |
| 523 continue | 535 continue |
| 524 conditionally_exposed_function = overloads['exposed_test_all'] | 536 conditionally_exposed_function = overloads['exposed_test_all'] |
| 525 runtime_enabled_function = overloads['runtime_enabled_function_all'] | 537 runtime_enabled_function = overloads['runtime_enabled_function_all'] |
| 538 api_experiment_name = overloads['api_experiment_name_all'] |
| 526 has_custom_registration = (overloads['has_custom_registration_all']
or | 539 has_custom_registration = (overloads['has_custom_registration_all']
or |
| 527 overloads['runtime_determined_lengths']) | 540 overloads['runtime_determined_lengths']) |
| 528 else: | 541 else: |
| 529 if not method['visible']: | 542 if not method['visible']: |
| 530 continue | 543 continue |
| 531 conditionally_exposed_function = method['exposed_test'] | 544 conditionally_exposed_function = method['exposed_test'] |
| 532 runtime_enabled_function = method['runtime_enabled_function'] | 545 runtime_enabled_function = method['runtime_enabled_function'] |
| 546 api_experiment_name = method['api_experiment_name'] |
| 533 has_custom_registration = method['has_custom_registration'] | 547 has_custom_registration = method['has_custom_registration'] |
| 534 | 548 |
| 535 if has_custom_registration: | 549 if has_custom_registration: |
| 536 custom_registration_methods.append(method) | 550 custom_registration_methods.append(method) |
| 537 continue | 551 continue |
| 538 if conditionally_exposed_function: | 552 if conditionally_exposed_function: |
| 539 conditionally_enabled_methods.append(method) | 553 conditionally_enabled_methods.append(method) |
| 540 continue | 554 continue |
| 541 if runtime_enabled_function: | 555 if runtime_enabled_function: |
| 542 custom_registration_methods.append(method) | 556 custom_registration_methods.append(method) |
| 543 continue | 557 continue |
| 558 if api_experiment_name: |
| 559 custom_registration_methods.append(method) |
| 560 continue |
| 544 if method['should_be_exposed_to_script']: | 561 if method['should_be_exposed_to_script']: |
| 545 method_configuration_methods.append(method) | 562 method_configuration_methods.append(method) |
| 546 | 563 |
| 547 for method in methods: | 564 for method in methods: |
| 548 # The value of the Function object’s “length” property is a Number | 565 # The value of the Function object’s “length” property is a Number |
| 549 # determined as follows: | 566 # determined as follows: |
| 550 # 1. Let S be the effective overload set for regular operations (if the | 567 # 1. Let S be the effective overload set for regular operations (if the |
| 551 # operation is a regular operation) or for static operations (if the | 568 # operation is a regular operation) or for static operations (if the |
| 552 # operation is a static operation) with identifier id on interface I and | 569 # operation is a static operation) with identifier id on interface I and |
| 553 # with argument count 0. | 570 # with argument count 0. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 extended_attributes = constant.extended_attributes | 625 extended_attributes = constant.extended_attributes |
| 609 return { | 626 return { |
| 610 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), | 627 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), |
| 611 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] | 628 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] |
| 612 'idl_type': constant.idl_type.name, | 629 'idl_type': constant.idl_type.name, |
| 613 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA
s] | 630 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA
s] |
| 614 'name': constant.name, | 631 'name': constant.name, |
| 615 # FIXME: use 'reflected_name' as correct 'name' | 632 # FIXME: use 'reflected_name' as correct 'name' |
| 616 'reflected_name': extended_attributes.get('Reflect', constant.name), | 633 'reflected_name': extended_attributes.get('Reflect', constant.name), |
| 617 'runtime_enabled_function': runtime_enabled_function_name(constant), | 634 'runtime_enabled_function': runtime_enabled_function_name(constant), |
| 635 'api_experiment_name': extended_attributes.get('APIExperimentEnabled'), |
| 618 'value': constant.value, | 636 'value': constant.value, |
| 619 } | 637 } |
| 620 | 638 |
| 621 | 639 |
| 622 ################################################################################ | 640 ################################################################################ |
| 623 # Overloads | 641 # Overloads |
| 624 ################################################################################ | 642 ################################################################################ |
| 625 | 643 |
| 626 def compute_method_overloads_context(interface, methods): | 644 def compute_method_overloads_context(interface, methods): |
| 627 # Regular methods | 645 # Regular methods |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 has_overload_not_visible = True | 780 has_overload_not_visible = True |
| 763 | 781 |
| 764 # If some overloads are not visible and others are visible, | 782 # If some overloads are not visible and others are visible, |
| 765 # the method is overloaded between core and modules. | 783 # the method is overloaded between core and modules. |
| 766 has_partial_overloads = has_overload_visible and has_overload_not_visible | 784 has_partial_overloads = has_overload_visible and has_overload_not_visible |
| 767 | 785 |
| 768 return { | 786 return { |
| 769 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [Depreca
teAs] | 787 'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [Depreca
teAs] |
| 770 'exposed_test_all': common_value(overloads, 'exposed_test'), # [Exposed
] | 788 'exposed_test_all': common_value(overloads, 'exposed_test'), # [Exposed
] |
| 771 'has_custom_registration_all': common_value(overloads, 'has_custom_regis
tration'), | 789 'has_custom_registration_all': common_value(overloads, 'has_custom_regis
tration'), |
| 790 'api_experiment_name_all': common_value(overloads, 'api_experiment_name'
), # [APIExperimentEnabled] |
| 772 'length': function_length, | 791 'length': function_length, |
| 773 'length_tests_methods': length_tests_methods(effective_overloads_by_leng
th), | 792 'length_tests_methods': length_tests_methods(effective_overloads_by_leng
th), |
| 774 # 1. Let maxarg be the length of the longest type list of the | 793 # 1. Let maxarg be the length of the longest type list of the |
| 775 # entries in S. | 794 # entries in S. |
| 776 'maxarg': maxarg, | 795 'maxarg': maxarg, |
| 777 'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs] | 796 'measure_all_as': common_value(overloads, 'measure_as'), # [MeasureAs] |
| 778 'returns_promise_all': promise_overload_count > 0, | 797 'returns_promise_all': promise_overload_count > 0, |
| 779 'runtime_determined_lengths': runtime_determined_lengths, | 798 'runtime_determined_lengths': runtime_determined_lengths, |
| 780 'runtime_determined_maxargs': runtime_determined_maxargs, | 799 'runtime_determined_maxargs': runtime_determined_maxargs, |
| 781 'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled
_function'), # [RuntimeEnabled] | 800 'runtime_enabled_function_all': common_value(overloads, 'runtime_enabled
_function'), # [RuntimeEnabled] |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 | 1404 |
| 1386 extended_attributes = deleter.extended_attributes | 1405 extended_attributes = deleter.extended_attributes |
| 1387 idl_type = deleter.idl_type | 1406 idl_type = deleter.idl_type |
| 1388 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') | 1407 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') |
| 1389 return { | 1408 return { |
| 1390 'is_call_with_script_state': is_call_with_script_state, | 1409 'is_call_with_script_state': is_call_with_script_state, |
| 1391 'is_custom': 'Custom' in extended_attributes, | 1410 'is_custom': 'Custom' in extended_attributes, |
| 1392 'is_raises_exception': 'RaisesException' in extended_attributes, | 1411 'is_raises_exception': 'RaisesException' in extended_attributes, |
| 1393 'name': cpp_name(deleter), | 1412 'name': cpp_name(deleter), |
| 1394 } | 1413 } |
| OLD | NEW |