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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 return [constant for constant in constants if | 71 return [constant for constant in constants if |
| 72 not constant['measure_as'] and | 72 not constant['measure_as'] and |
| 73 not constant['deprecate_as'] and | 73 not constant['deprecate_as'] and |
| 74 not constant['runtime_enabled_function'] and | 74 not constant['runtime_enabled_function'] and |
| 75 not constant['origin_trial_feature_name']] | 75 not constant['origin_trial_feature_name']] |
| 76 | 76 |
| 77 | 77 |
| 78 def filter_has_special_getter(constants): | 78 def filter_has_special_getter(constants): |
| 79 return [constant for constant in constants if | 79 return [constant for constant in constants if |
| 80 constant['measure_as'] or | 80 constant['measure_as'] or |
| 81 constant['deprecate_as'] or | 81 constant['deprecate_as']] |
| 82 constant['origin_trial_enabled_function']] | |
| 83 | 82 |
| 84 | 83 |
| 85 def filter_runtime_enabled(constants): | 84 def filter_runtime_enabled(constants): |
| 86 return [constant for constant in constants if | 85 return [constant for constant in constants if |
| 87 constant['runtime_enabled_function']] | 86 constant['runtime_enabled_function']] |
| 88 | 87 |
| 89 | 88 |
| 89 def filter_origin_trial_enabled(constants): | |
| 90 return [constant for constant in constants if | |
| 91 constant['origin_trial_feature_name']] | |
| 92 | |
| 93 | |
| 90 def constant_filters(): | 94 def constant_filters(): |
| 91 return {'has_constant_configuration': filter_has_constant_configuration, | 95 return {'has_constant_configuration': filter_has_constant_configuration, |
| 92 'has_special_getter': filter_has_special_getter, | 96 'has_special_getter': filter_has_special_getter, |
| 93 'runtime_enabled_constants': filter_runtime_enabled} | 97 'runtime_enabled_constants': filter_runtime_enabled, |
| 98 'origin_trial_enabled_constants': filter_origin_trial_enabled} | |
| 99 | |
| 100 | |
| 101 def origin_trial_feature_names(constants, attributes): | |
|
haraken
2016/06/13 01:12:59
Are you going to support methods in the future?
iclelland
2016/06/15 14:08:41
Yes, that will be in a follow-up CL to this.
| |
| 102 """ Returns a list of the names of each origin trial feature used in this in terface. | |
| 103 | |
| 104 This list is the union of the sets of names used for constants and attribute s. | |
| 105 """ | |
| 106 | |
| 107 feature_names = set( | |
| 108 [constant['origin_trial_feature_name'] for constant in constants if cons tant['origin_trial_feature_name']] + | |
| 109 [attribute['origin_trial_feature_name'] for attribute in attributes if a ttribute['origin_trial_feature_name']] | |
| 110 ) | |
| 111 return sorted(feature_names) | |
| 94 | 112 |
| 95 | 113 |
| 96 def interface_context(interface): | 114 def interface_context(interface): |
| 97 includes.clear() | 115 includes.clear() |
| 98 includes.update(INTERFACE_CPP_INCLUDES) | 116 includes.update(INTERFACE_CPP_INCLUDES) |
| 99 header_includes = set(INTERFACE_H_INCLUDES) | 117 header_includes = set(INTERFACE_H_INCLUDES) |
| 100 | 118 |
| 101 if interface.is_partial: | 119 if interface.is_partial: |
| 102 # A partial interface definition cannot specify that the interface | 120 # A partial interface definition cannot specify that the interface |
| 103 # inherits from another interface. Inheritance must be specified on | 121 # inherits from another interface. Inheritance must be specified on |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 'indexed_property_deleter': property_deleter(interface.indexed_property_ deleter), | 597 'indexed_property_deleter': property_deleter(interface.indexed_property_ deleter), |
| 580 'is_override_builtins': 'OverrideBuiltins' in extended_attributes, | 598 'is_override_builtins': 'OverrideBuiltins' in extended_attributes, |
| 581 'named_property_getter': property_getter(interface.named_property_getter , ['propertyName']), | 599 'named_property_getter': property_getter(interface.named_property_getter , ['propertyName']), |
| 582 'named_property_setter': property_setter(interface.named_property_setter , interface), | 600 'named_property_setter': property_setter(interface.named_property_setter , interface), |
| 583 'named_property_deleter': property_deleter(interface.named_property_dele ter), | 601 'named_property_deleter': property_deleter(interface.named_property_dele ter), |
| 584 }) | 602 }) |
| 585 context.update({ | 603 context.update({ |
| 586 'has_named_properties_object': is_global and context['named_property_get ter'], | 604 'has_named_properties_object': is_global and context['named_property_get ter'], |
| 587 }) | 605 }) |
| 588 | 606 |
| 607 # Origin Trials | |
| 608 context.update({ | |
| 609 'origin_trial_feature_names': origin_trial_feature_names(context['consta nts'], context['attributes']), | |
| 610 }) | |
| 589 return context | 611 return context |
| 590 | 612 |
| 591 | 613 |
| 592 # [DeprecateAs], [OriginTrialEnabled], [Reflect], [RuntimeEnabled] | 614 # [DeprecateAs], [OriginTrialEnabled], [Reflect], [RuntimeEnabled] |
| 593 def constant_context(constant, interface): | 615 def constant_context(constant, interface): |
| 594 extended_attributes = constant.extended_attributes | 616 extended_attributes = constant.extended_attributes |
| 595 | 617 |
| 596 return { | 618 return { |
| 597 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), | 619 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), |
| 598 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] | 620 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1379 extended_attributes = deleter.extended_attributes | 1401 extended_attributes = deleter.extended_attributes |
| 1380 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') |
| 1381 is_ce_reactions = 'CEReactions' in extended_attributes | 1403 is_ce_reactions = 'CEReactions' in extended_attributes |
| 1382 return { | 1404 return { |
| 1383 'is_call_with_script_state': is_call_with_script_state, | 1405 'is_call_with_script_state': is_call_with_script_state, |
| 1384 'is_ce_reactions': is_ce_reactions, | 1406 'is_ce_reactions': is_ce_reactions, |
| 1385 'is_custom': 'Custom' in extended_attributes, | 1407 'is_custom': 'Custom' in extended_attributes, |
| 1386 'is_raises_exception': 'RaisesException' in extended_attributes, | 1408 'is_raises_exception': 'RaisesException' in extended_attributes, |
| 1387 'name': cpp_name(deleter), | 1409 'name': cpp_name(deleter), |
| 1388 } | 1410 } |
| OLD | NEW |