| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 return lambda suffix: extended_attributes['MeasureAs'] | 373 return lambda suffix: extended_attributes['MeasureAs'] |
| 374 if 'Measure' in extended_attributes: | 374 if 'Measure' in extended_attributes: |
| 375 includes.add('core/frame/UseCounter.h') | 375 includes.add('core/frame/UseCounter.h') |
| 376 measure_as_name = capitalize(definition_or_member.name) | 376 measure_as_name = capitalize(definition_or_member.name) |
| 377 if interface is not None: | 377 if interface is not None: |
| 378 measure_as_name = '%s_%s' % (capitalize(interface.name), measure_as_
name) | 378 measure_as_name = '%s_%s' % (capitalize(interface.name), measure_as_
name) |
| 379 return lambda suffix: 'V8%s_%s' % (measure_as_name, suffix) | 379 return lambda suffix: 'V8%s_%s' % (measure_as_name, suffix) |
| 380 return None | 380 return None |
| 381 | 381 |
| 382 | 382 |
| 383 def is_api_experiment_enabled(interface): |
| 384 return 'APIExperimentEnabled' in interface.extended_attributes |
| 385 |
| 386 |
| 387 def api_experiment_name(interface): |
| 388 return interface.extended_attributes['APIExperimentEnabled'] if is_api_exper
iment_enabled(interface) else None |
| 389 |
| 390 |
| 383 # [RuntimeEnabled] | 391 # [RuntimeEnabled] |
| 384 def runtime_enabled_function_name(definition_or_member): | 392 def runtime_enabled_function_name(definition_or_member): |
| 393 """Returns a conditional string which defines if a given |
| 394 method/attribute is enabled at runtime. This is based on the RuntimeEnabled |
| 395 and the API Experiment Enabled conditionals. |
| 396 """ |
| 397 extended_attributes = definition_or_member.extended_attributes |
| 398 runtime_conditional = runtime_enabled_conditional(extended_attributes) |
| 399 experiment_conditional = api_experiment_enabled_conditional(extended_attribu
tes) |
| 400 |
| 401 if runtime_conditional is not None and experiment_conditional is not None: |
| 402 return ('%s && %s' % (runtime_conditional, experiment_conditional)) |
| 403 return runtime_conditional if runtime_conditional else experiment_conditiona
l |
| 404 |
| 405 |
| 406 def runtime_enabled_conditional(extended_attributes): |
| 385 """Returns the name of the RuntimeEnabledFeatures function. | 407 """Returns the name of the RuntimeEnabledFeatures function. |
| 386 | 408 |
| 387 The returned function checks if a method/attribute is enabled. | 409 The returned function checks if a method/attribute is enabled. |
| 388 Given extended attribute RuntimeEnabled=FeatureName, return: | 410 Given extended attribute RuntimeEnabled=FeatureName, return: |
| 389 RuntimeEnabledFeatures::{featureName}Enabled | 411 RuntimeEnabledFeatures::{featureName}Enabled |
| 390 """ | 412 """ |
| 391 extended_attributes = definition_or_member.extended_attributes | |
| 392 if 'RuntimeEnabled' not in extended_attributes: | 413 if 'RuntimeEnabled' not in extended_attributes: |
| 393 return None | 414 return None |
| 394 feature_name = extended_attributes['RuntimeEnabled'] | 415 feature_name = extended_attributes['RuntimeEnabled'] |
| 395 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) | 416 runtime_function = 'RuntimeEnabledFeatures::%sEnabled()' % uncapitalize(feat
ure_name) |
| 417 return runtime_function |
| 418 |
| 419 |
| 420 # [APIExperimentEnabled] |
| 421 def api_experiment_enabled_conditional(extended_attributes): |
| 422 """Returns the name of the API Experiment Enabled function. |
| 423 |
| 424 The returned function checks if a method/attribute is enabled. |
| 425 Given extended attribute APIExperimentEnabled=ExperimentName, return: |
| 426 Experiments::isApiEnabled(currentExecutionContext(isolate), |
| 427 "{ExperimentName}") |
| 428 """ |
| 429 if 'APIExperimentEnabled' not in extended_attributes: |
| 430 return None |
| 431 return 'Experiments::isApiEnabled(currentExecutionContext(isolate), "%s")' %
extended_attributes['APIExperimentEnabled'] |
| 396 | 432 |
| 397 | 433 |
| 398 # [Unforgeable] | 434 # [Unforgeable] |
| 399 def is_unforgeable(interface, member): | 435 def is_unforgeable(interface, member): |
| 400 return (('Unforgeable' in interface.extended_attributes or | 436 return (('Unforgeable' in interface.extended_attributes or |
| 401 'Unforgeable' in member.extended_attributes) and | 437 'Unforgeable' in member.extended_attributes) and |
| 402 not member.is_static) | 438 not member.is_static) |
| 403 | 439 |
| 404 | 440 |
| 405 # [LegacyInterfaceTypeChecking] | 441 # [LegacyInterfaceTypeChecking] |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 except StopIteration: | 614 except StopIteration: |
| 579 return None | 615 return None |
| 580 | 616 |
| 581 | 617 |
| 582 IdlInterface.indexed_property_getter = property(indexed_property_getter) | 618 IdlInterface.indexed_property_getter = property(indexed_property_getter) |
| 583 IdlInterface.indexed_property_setter = property(indexed_property_setter) | 619 IdlInterface.indexed_property_setter = property(indexed_property_setter) |
| 584 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) | 620 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) |
| 585 IdlInterface.named_property_getter = property(named_property_getter) | 621 IdlInterface.named_property_getter = property(named_property_getter) |
| 586 IdlInterface.named_property_setter = property(named_property_setter) | 622 IdlInterface.named_property_setter = property(named_property_setter) |
| 587 IdlInterface.named_property_deleter = property(named_property_deleter) | 623 IdlInterface.named_property_deleter = property(named_property_deleter) |
| OLD | NEW |