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

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

Issue 877523004: Add extended attribute, [Measure], to simplify use counting (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use the same key for overloads. Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/attributes.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 # 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 361
362 def cpp_name_or_partial(interface): 362 def cpp_name_or_partial(interface):
363 cpp_class_name = cpp_name(interface) 363 cpp_class_name = cpp_name(interface)
364 if interface.is_partial: 364 if interface.is_partial:
365 return ''.join([cpp_class_name, 'Partial']) 365 return ''.join([cpp_class_name, 'Partial'])
366 return cpp_class_name 366 return cpp_class_name
367 367
368 368
369 # [MeasureAs] 369 # [MeasureAs]
370 def measure_as(definition_or_member): 370 def measure_as(definition_or_member, interface=None):
haraken 2015/01/28 13:02:22 Can we force the interface parameter? I'm wonderin
371 extended_attributes = definition_or_member.extended_attributes 371 extended_attributes = definition_or_member.extended_attributes
372 if 'MeasureAs' not in extended_attributes: 372 if 'DoNotMeasure' in extended_attributes:
373 return None 373 return None
374 includes.add('core/frame/UseCounter.h') 374 if 'MeasureAs' in extended_attributes:
375 return extended_attributes['MeasureAs'] 375 includes.add('core/frame/UseCounter.h')
376 return lambda suffix: extended_attributes['MeasureAs']
377 if 'Measure' in extended_attributes or (interface is not None and 'Measure' in interface.extended_attributes):
378 includes.add('core/frame/UseCounter.h')
379 measure_as_name = capitalize(definition_or_member.name)
380 if interface is not None:
381 measure_as_name = '%s_%s' % (capitalize(interface.name), measure_as_ name)
Jens Widell 2015/01/28 12:48:31 Nit: I don't know if it makes much sense to use ca
382 return lambda suffix: 'V8%s_%s' % (measure_as_name, suffix)
383 return None
376 384
377 385
378 # [PerContextEnabled] 386 # [PerContextEnabled]
379 def per_context_enabled_function_name(definition_or_member): 387 def per_context_enabled_function_name(definition_or_member):
380 extended_attributes = definition_or_member.extended_attributes 388 extended_attributes = definition_or_member.extended_attributes
381 if 'PerContextEnabled' not in extended_attributes: 389 if 'PerContextEnabled' not in extended_attributes:
382 return None 390 return None
383 feature_name = extended_attributes['PerContextEnabled'] 391 feature_name = extended_attributes['PerContextEnabled']
384 return 'ContextFeatures::%sEnabled' % uncapitalize(feature_name) 392 return 'ContextFeatures::%sEnabled' % uncapitalize(feature_name)
385 393
386 394
387 # [RuntimeEnabled] 395 # [RuntimeEnabled]
388 def runtime_enabled_function_name(definition_or_member): 396 def runtime_enabled_function_name(definition_or_member):
389 """Returns the name of the RuntimeEnabledFeatures function. 397 """Returns the name of the RuntimeEnabledFeatures function.
390 398
391 The returned function checks if a method/attribute is enabled. 399 The returned function checks if a method/attribute is enabled.
392 Given extended attribute RuntimeEnabled=FeatureName, return: 400 Given extended attribute RuntimeEnabled=FeatureName, return:
393 RuntimeEnabledFeatures::{featureName}Enabled 401 RuntimeEnabledFeatures::{featureName}Enabled
394 """ 402 """
395 extended_attributes = definition_or_member.extended_attributes 403 extended_attributes = definition_or_member.extended_attributes
396 if 'RuntimeEnabled' not in extended_attributes: 404 if 'RuntimeEnabled' not in extended_attributes:
397 return None 405 return None
398 feature_name = extended_attributes['RuntimeEnabled'] 406 feature_name = extended_attributes['RuntimeEnabled']
399 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) 407 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698