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

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

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
Index: third_party/WebKit/Source/bindings/scripts/v8_interface.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_interface.py b/third_party/WebKit/Source/bindings/scripts/v8_interface.py
index 95bebe6d73e6bad0083dace58c3c811477425eee..785e30f04dfc3073efa58912a72b771500987fe0 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_interface.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_interface.py
@@ -48,7 +48,8 @@ from v8_types import cpp_ptr_type, cpp_template_type
import v8_utilities
from v8_utilities import (cpp_name_or_partial, capitalize, conditional_string, cpp_name, gc_type,
has_extended_attribute_value, runtime_enabled_function_name,
- extended_attribute_value_as_list, is_legacy_interface_type_checking)
+ extended_attribute_value_as_list, is_legacy_interface_type_checking,
+ experimental_api_name)
INTERFACE_H_INCLUDES = frozenset([
@@ -65,6 +66,7 @@ INTERFACE_CPP_INCLUDES = frozenset([
'bindings/core/v8/V8ObjectConstructor.h',
'core/dom/ContextFeatures.h',
'core/dom/Document.h',
+ 'core/experiments/Experiments.h',
haraken 2015/12/16 02:16:41 I feel that "Experiments" sounds a bit too general
Daniel Nishi 2015/12/16 21:42:02 core/experiments/* is already landed by a differen
'platform/RuntimeEnabledFeatures.h',
'platform/TraceEvent.h',
'wtf/GetPtr.h',
@@ -167,6 +169,7 @@ def interface_context(interface):
'cpp_class': cpp_class_name,
'cpp_class_or_partial': cpp_class_name_or_partial,
'event_target_inheritance': 'InheritFromEventTarget' if is_event_target else 'NotInheritFromEventTarget',
+ 'experimental_api_name': v8_utilities.experimental_api_name(interface),
'gc_type': this_gc_type,
# FIXME: Remove 'EventTarget' special handling, http://crbug.com/383699
'has_access_check_callbacks': (is_check_security and
@@ -239,10 +242,10 @@ def interface_context(interface):
unscopeables = []
for attribute in interface.attributes:
if 'Unscopeable' in attribute.extended_attributes:
- unscopeables.append((attribute.name, v8_utilities.runtime_enabled_function_name(attribute)))
+ unscopeables.append((attribute.name, v8_utilities.runtime_enabled_function_name(attribute), v8_utilities.experimental_api_name(attribute)))
for method in interface.operations:
if 'Unscopeable' in method.extended_attributes:
- unscopeables.append((method.name, v8_utilities.runtime_enabled_function_name(method)))
+ unscopeables.append((method.name, v8_utilities.runtime_enabled_function_name(method), v8_utilities.experimental_api_name(method)))
context.update({
'constructors': constructors,
@@ -258,9 +261,12 @@ def interface_context(interface):
special_getter_constants = []
runtime_enabled_constants = dict()
+ experimental_enabled_constants = dict()
+ experimental_only_enabled_constants = []
constant_configuration_constants = []
for constant in constants:
+ experimental_api_name = constant['experimental_api_name']
if constant['measure_as'] or constant['deprecate_as']:
special_getter_constants.append(constant)
continue
@@ -269,6 +275,11 @@ def interface_context(interface):
if runtime_enabled_function not in runtime_enabled_constants:
runtime_enabled_constants[runtime_enabled_function] = []
runtime_enabled_constants[runtime_enabled_function].append(constant)
+ if experimental_api_name:
+ experimental_enabled_constants[constant['name']] = experimental_api_name
+ continue
+ if experimental_api_name:
+ experimental_only_enabled_constants.append(constant)
continue
constant_configuration_constants.append(constant)
@@ -277,8 +288,10 @@ def interface_context(interface):
'constant_configuration_constants': constant_configuration_constants,
'constants': constants,
'do_not_check_constants': 'DoNotCheckConstants' in extended_attributes,
+ 'experimental_enabled_constants': experimental_enabled_constants,
+ 'experimental_only_constants': experimental_only_enabled_constants,
'has_constant_configuration': any(
- not constant['runtime_enabled_function']
+ (constant['runtime_enabled_function'] is None and constant['experimental_api_name'] is None)
for constant in constants),
'runtime_enabled_constants': sorted(runtime_enabled_constants.iteritems()),
'special_getter_constants': special_getter_constants,
@@ -523,6 +536,7 @@ def interface_context(interface):
continue
conditionally_exposed_function = overloads['exposed_test_all']
runtime_enabled_function = overloads['runtime_enabled_function_all']
+ experimental_api_name = overloads['experimental_api_name_all']
has_custom_registration = (overloads['has_custom_registration_all'] or
overloads['runtime_determined_lengths'])
else:
@@ -530,6 +544,7 @@ def interface_context(interface):
continue
conditionally_exposed_function = method['exposed_test']
runtime_enabled_function = method['runtime_enabled_function']
+ experimental_api_name = method['experimental_api_name']
has_custom_registration = method['has_custom_registration']
if has_custom_registration:
@@ -541,6 +556,9 @@ def interface_context(interface):
if runtime_enabled_function:
custom_registration_methods.append(method)
continue
+ if experimental_api_name:
+ custom_registration_methods.append(method)
+ continue
if method['should_be_exposed_to_script']:
method_configuration_methods.append(method)
@@ -615,6 +633,7 @@ def constant_context(constant, interface):
# FIXME: use 'reflected_name' as correct 'name'
'reflected_name': extended_attributes.get('Reflect', constant.name),
'runtime_enabled_function': runtime_enabled_function_name(constant),
+ 'experimental_api_name': extended_attributes.get('ExperimentEnabled'),
'value': constant.value,
}
@@ -769,6 +788,7 @@ def overloads_context(interface, overloads):
'deprecate_all_as': common_value(overloads, 'deprecate_as'), # [DeprecateAs]
'exposed_test_all': common_value(overloads, 'exposed_test'), # [Exposed]
'has_custom_registration_all': common_value(overloads, 'has_custom_registration'),
+ 'experimental_api_name_all': common_value(overloads, 'experimental_api_name'), # [ExperimentEnabled]
'length': function_length,
'length_tests_methods': length_tests_methods(effective_overloads_by_length),
# 1. Let maxarg be the length of the longest type list of the

Powered by Google App Engine
This is Rietveld 408576698