| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 # [DeprecateAs] | 135 # [DeprecateAs] |
| 136 def generate_deprecate_as(member, contents, includes): | 136 def generate_deprecate_as(member, contents, includes): |
| 137 deprecate_as = member.extended_attributes.get('DeprecateAs') | 137 deprecate_as = member.extended_attributes.get('DeprecateAs') |
| 138 if not deprecate_as: | 138 if not deprecate_as: |
| 139 return | 139 return |
| 140 contents['deprecate_as'] = deprecate_as | 140 contents['deprecate_as'] = deprecate_as |
| 141 includes.update(['core/page/UseCounter.h']) | 141 includes.update(['core/page/UseCounter.h']) |
| 142 | 142 |
| 143 | 143 |
| 144 # [PerContextEnabled] |
| 145 def per_context_enabled_function_name(definition_or_member): |
| 146 extended_attributes = definition_or_member.extended_attributes |
| 147 if 'PerContextEnabled' not in extended_attributes: |
| 148 return None |
| 149 feature_name = extended_attributes['PerContextEnabled'] |
| 150 return 'ContextFeatures::%sEnabled' % uncapitalize(feature_name) |
| 151 |
| 152 |
| 144 # [RuntimeEnabled] | 153 # [RuntimeEnabled] |
| 145 def runtime_enabled_function_name(definition_or_member): | 154 def runtime_enabled_function_name(definition_or_member): |
| 146 """Returns the name of the RuntimeEnabledFeatures function. | 155 """Returns the name of the RuntimeEnabledFeatures function. |
| 147 | 156 |
| 148 The returned function checks if a method/attribute is enabled. | 157 The returned function checks if a method/attribute is enabled. |
| 149 Given extended attribute RuntimeEnabled=FeatureName, return: | 158 Given extended attribute RuntimeEnabled=FeatureName, return: |
| 150 RuntimeEnabledFeatures::{featureName}Enabled | 159 RuntimeEnabledFeatures::{featureName}Enabled |
| 151 """ | 160 """ |
| 152 extended_attributes = definition_or_member.extended_attributes | 161 extended_attributes = definition_or_member.extended_attributes |
| 153 if 'RuntimeEnabled' not in extended_attributes: | 162 if 'RuntimeEnabled' not in extended_attributes: |
| 154 return None | 163 return None |
| 155 feature_name = extended_attributes['RuntimeEnabled'] | 164 feature_name = extended_attributes['RuntimeEnabled'] |
| 156 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) | 165 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) |
| 157 | 166 |
| 158 | 167 |
| 159 # [ImplementedAs] | 168 # [ImplementedAs] |
| 160 def cpp_name(definition_or_member): | 169 def cpp_name(definition_or_member): |
| 161 return definition_or_member.extended_attributes.get('ImplementedAs', definit
ion_or_member.name) | 170 return definition_or_member.extended_attributes.get('ImplementedAs', definit
ion_or_member.name) |
| 162 | 171 |
| 163 | 172 |
| 164 # [MeasureAs] | 173 # [MeasureAs] |
| 165 def generate_measure_as(definition_or_member, contents, includes): | 174 def generate_measure_as(definition_or_member, contents, includes): |
| 166 if 'MeasureAs' not in definition_or_member.extended_attributes: | 175 if 'MeasureAs' not in definition_or_member.extended_attributes: |
| 167 return | 176 return |
| 168 contents['measure_as'] = definition_or_member.extended_attributes['MeasureAs
'] | 177 contents['measure_as'] = definition_or_member.extended_attributes['MeasureAs
'] |
| 169 includes.add('core/page/UseCounter.h') | 178 includes.add('core/page/UseCounter.h') |
| OLD | NEW |