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

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

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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
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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 'has_named_properties_object': is_global and context['named_property_get ter'], 582 'has_named_properties_object': is_global and context['named_property_get ter'],
583 }) 583 })
584 584
585 # Origin Trials 585 # Origin Trials
586 context.update({ 586 context.update({
587 'origin_trial_features': origin_trial_features(interface, context['const ants'], context['attributes'], context['methods']), 587 'origin_trial_features': origin_trial_features(interface, context['const ants'], context['attributes'], context['methods']),
588 }) 588 })
589 return context 589 return context
590 590
591 591
592 def reflected_name(constant_name):
593 """Returns the name to use for the matching constant name in blink code.
594
595 Given an all-uppercase 'CONSTANT_NAME', returns a camel-case
596 'kConstantName'.
597 """
598 # Check for SHOUTY_CASE constants
599 if constant_name.upper() != constant_name:
600 return constant_name
601 return 'k' + ''.join(part.title() for part in constant_name.split('_'))
602
603
592 # [DeprecateAs], [OriginTrialEnabled], [Reflect], [RuntimeEnabled] 604 # [DeprecateAs], [OriginTrialEnabled], [Reflect], [RuntimeEnabled]
593 def constant_context(constant, interface): 605 def constant_context(constant, interface):
594 extended_attributes = constant.extended_attributes 606 extended_attributes = constant.extended_attributes
595 607
596 return { 608 return {
597 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'), 609 'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'),
598 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs] 610 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs]
599 'idl_type': constant.idl_type.name, 611 'idl_type': constant.idl_type.name,
600 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA s] 612 'measure_as': v8_utilities.measure_as(constant, interface), # [MeasureA s]
601 'name': constant.name, 613 'name': constant.name,
602 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct ion_name(constant), # [OriginTrialEnabled] 614 'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_funct ion_name(constant), # [OriginTrialEnabled]
603 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(cons tant), # [OriginTrialEnabled] 615 'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(cons tant), # [OriginTrialEnabled]
604 # FIXME: use 'reflected_name' as correct 'name' 616 # FIXME: use 'reflected_name' as correct 'name'
605 'reflected_name': extended_attributes.get('Reflect', constant.name), 617 'reflected_name': extended_attributes.get('Reflect', reflected_name(cons tant.name)),
606 'runtime_enabled_function': runtime_enabled_function_name(constant), # [RuntimeEnabled] 618 'runtime_enabled_function': runtime_enabled_function_name(constant), # [RuntimeEnabled]
607 'runtime_feature_name': v8_utilities.runtime_feature_name(constant), # [RuntimeEnabled] 619 'runtime_feature_name': v8_utilities.runtime_feature_name(constant), # [RuntimeEnabled]
608 'value': constant.value, 620 'value': constant.value,
609 } 621 }
610 622
611 623
612 ################################################################################ 624 ################################################################################
613 # Overloads 625 # Overloads
614 ################################################################################ 626 ################################################################################
615 627
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 extended_attributes = deleter.extended_attributes 1398 extended_attributes = deleter.extended_attributes
1387 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1399 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1388 is_ce_reactions = 'CEReactions' in extended_attributes 1400 is_ce_reactions = 'CEReactions' in extended_attributes
1389 return { 1401 return {
1390 'is_call_with_script_state': is_call_with_script_state, 1402 'is_call_with_script_state': is_call_with_script_state,
1391 'is_ce_reactions': is_ce_reactions, 1403 'is_ce_reactions': is_ce_reactions,
1392 'is_custom': 'Custom' in extended_attributes, 1404 'is_custom': 'Custom' in extended_attributes,
1393 'is_raises_exception': 'RaisesException' in extended_attributes, 1405 'is_raises_exception': 'RaisesException' in extended_attributes,
1394 'name': cpp_name(deleter), 1406 'name': cpp_name(deleter),
1395 } 1407 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698