Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: Source/bindings/scripts/v8_interface.py

Issue 1329653003: [bindings] Club related constants for a runtime enabled flag in a single |if| block (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/bindings/templates/constants.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 'interface_length': 247 'interface_length':
248 interface_length(interface, constructors + custom_constructors), 248 interface_length(interface, constructors + custom_constructors),
249 'is_constructor_raises_exception': extended_attributes.get('RaisesExcept ion') == 'Constructor', # [RaisesException=Constructor] 249 'is_constructor_raises_exception': extended_attributes.get('RaisesExcept ion') == 'Constructor', # [RaisesException=Constructor]
250 'named_constructor': named_constructor, 250 'named_constructor': named_constructor,
251 'unscopeables': sorted(unscopeables), 251 'unscopeables': sorted(unscopeables),
252 }) 252 })
253 253
254 constants = [constant_context(constant, interface) for constant in interface .constants] 254 constants = [constant_context(constant, interface) for constant in interface .constants]
255 255
256 special_getter_constants = [] 256 special_getter_constants = []
257 runtime_enabled_constants = [] 257 runtime_enabled_constants = dict()
258 constant_configuration_constants = [] 258 constant_configuration_constants = []
259 259
260 for constant in constants: 260 for constant in constants:
261 if constant['measure_as'] or constant['deprecate_as']: 261 if constant['measure_as'] or constant['deprecate_as']:
262 special_getter_constants.append(constant) 262 special_getter_constants.append(constant)
263 continue 263 continue
264 if constant['runtime_enabled_function']: 264 runtime_enabled_function = constant['runtime_enabled_function']
265 runtime_enabled_constants.append(constant) 265 if runtime_enabled_function:
266 if runtime_enabled_function not in runtime_enabled_constants:
267 runtime_enabled_constants[runtime_enabled_function] = []
268 runtime_enabled_constants[runtime_enabled_function].append(constant)
266 continue 269 continue
267 constant_configuration_constants.append(constant) 270 constant_configuration_constants.append(constant)
268 271
269 # Constants 272 # Constants
270 context.update({ 273 context.update({
271 'constant_configuration_constants': constant_configuration_constants, 274 'constant_configuration_constants': constant_configuration_constants,
272 'constants': constants, 275 'constants': constants,
273 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes, 276 'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes,
274 'has_constant_configuration': any( 277 'has_constant_configuration': any(
275 not constant['runtime_enabled_function'] 278 not constant['runtime_enabled_function']
276 for constant in constants), 279 for constant in constants),
277 'runtime_enabled_constants': runtime_enabled_constants, 280 'runtime_enabled_constants': sorted(runtime_enabled_constants.iteritems( )),
278 'special_getter_constants': special_getter_constants, 281 'special_getter_constants': special_getter_constants,
279 }) 282 })
280 283
281 # Attributes 284 # Attributes
282 attributes = [v8_attributes.attribute_context(interface, attribute) 285 attributes = [v8_attributes.attribute_context(interface, attribute)
283 for attribute in interface.attributes] 286 for attribute in interface.attributes]
284 287
285 has_conditional_attributes = any(attribute['exposed_test'] for attribute in attributes) 288 has_conditional_attributes = any(attribute['exposed_test'] for attribute in attributes)
286 if has_conditional_attributes and interface.is_partial: 289 if has_conditional_attributes and interface.is_partial:
287 raise Exception('Conditional attributes between partial interfaces in mo dules and the original interfaces(%s) in core are not allowed.' % interface.name ) 290 raise Exception('Conditional attributes between partial interfaces in mo dules and the original interfaces(%s) in core are not allowed.' % interface.name )
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 1367
1365 extended_attributes = deleter.extended_attributes 1368 extended_attributes = deleter.extended_attributes
1366 idl_type = deleter.idl_type 1369 idl_type = deleter.idl_type
1367 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1370 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1368 return { 1371 return {
1369 'is_call_with_script_state': is_call_with_script_state, 1372 'is_call_with_script_state': is_call_with_script_state,
1370 'is_custom': 'Custom' in extended_attributes, 1373 'is_custom': 'Custom' in extended_attributes,
1371 'is_raises_exception': 'RaisesException' in extended_attributes, 1374 'is_raises_exception': 'RaisesException' in extended_attributes,
1372 'name': cpp_name(deleter), 1375 'name': cpp_name(deleter),
1373 } 1376 }
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/constants.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698