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

Unified Diff: Source/bindings/scripts/v8_interface.py

Issue 577303002: IDL: Support [DeprecateAs] and [MeasureAs] on constants (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: adjusted encrypted-media-constants-expected.txt Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.cpp ('k') | Source/bindings/templates/constants.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_interface.py
diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py
index e7b580265b9ddd7e035b6ceee5cb2810d53d5ec1..5d56ed05357ddfb8d9b69ee968662f98ddeb831b 100644
--- a/Source/bindings/scripts/v8_interface.py
+++ b/Source/bindings/scripts/v8_interface.py
@@ -248,13 +248,29 @@ def interface_context(interface):
constants = [constant_context(constant) for constant in interface.constants]
+ special_getter_constants = []
+ runtime_enabled_constants = []
+ constant_configuration_constants = []
+
+ for constant in constants:
+ if constant['measure_as'] or constant['deprecate_as']:
+ special_getter_constants.append(constant)
+ continue
+ if constant['runtime_enabled_function']:
+ runtime_enabled_constants.append(constant)
+ continue
+ constant_configuration_constants.append(constant)
+
# Constants
context.update({
+ 'constant_configuration_constants': constant_configuration_constants,
'constants': constants,
'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes,
'has_constant_configuration': any(
not constant['runtime_enabled_function']
for constant in constants),
+ 'runtime_enabled_constants': runtime_enabled_constants,
+ 'special_getter_constants': special_getter_constants,
})
# Attributes
@@ -366,22 +382,17 @@ def interface_context(interface):
# [DeprecateAs], [Reflect], [RuntimeEnabled]
def constant_context(constant):
- # (Blink-only) string literals are unquoted in tokenizer, must be re-quoted
- # in C++.
- if constant.idl_type.name == 'String':
- value = '"%s"' % constant.value
- else:
- value = constant.value
-
extended_attributes = constant.extended_attributes
return {
'cpp_class': extended_attributes.get('PartialInterfaceImplementedAs'),
+ 'deprecate_as': v8_utilities.deprecate_as(constant), # [DeprecateAs]
'idl_type': constant.idl_type.name,
+ 'measure_as': v8_utilities.measure_as(constant), # [MeasureAs]
'name': constant.name,
# FIXME: use 'reflected_name' as correct 'name'
'reflected_name': extended_attributes.get('Reflect', constant.name),
'runtime_enabled_function': runtime_enabled_function_name(constant),
- 'value': value,
+ 'value': constant.value,
}
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.cpp ('k') | Source/bindings/templates/constants.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698