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

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

Issue 2683853005: bindings: Make some value iterator properties aliases to Array.prototype functions (Closed)
Patch Set: Remove constexpr from Internals.h to fix the Android build Created 3 years, 10 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
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 71ffe60a6f0530d3c2fd7c8ade7d0a91eee9fe95..383deec27551c131b7737b03a19b40d1469c01f8 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_interface.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_interface.py
@@ -379,6 +379,7 @@ def interface_context(interface, interfaces):
interface.name != 'Window')
context.update({
'has_array_iterator': has_array_iterator,
+ 'iterable': interface.iterable,
})
# Conditionally enabled members
@@ -545,19 +546,24 @@ def methods_context(interface):
non_overridable_methods = []
overridable_methods = []
- non_overridable_methods.extend([
- generated_iterator_method('keys'),
- generated_iterator_method('values'),
- generated_iterator_method('entries'),
-
- # void forEach(Function callback, [Default=Undefined] optional any thisArg)
- generated_method(IdlType('void'), 'forEach',
- arguments=[generated_argument(IdlType('Function'), 'callback'),
- generated_argument(IdlType('any'), 'thisArg',
- is_optional=True,
- extended_attributes={'Default': 'Undefined'})],
- extended_attributes=forEach_extended_attributes),
- ])
+ is_value_iterator = interface.iterable and interface.iterable.key_type is None
+
+ # For value iterators, the |entries|, |forEach|, |keys| and |values| are originally set
+ # to corresponding properties in %ArrayPrototype%.
+ if not is_value_iterator:
+ non_overridable_methods.extend([
+ generated_iterator_method('keys'),
+ generated_iterator_method('values'),
+ generated_iterator_method('entries'),
+
+ # void forEach(Function callback, [Default=Undefined] optional any thisArg)
+ generated_method(IdlType('void'), 'forEach',
+ arguments=[generated_argument(IdlType('Function'), 'callback'),
+ generated_argument(IdlType('any'), 'thisArg',
+ is_optional=True,
+ extended_attributes={'Default': 'Undefined'})],
+ extended_attributes=forEach_extended_attributes),
+ ])
if interface.maplike:
key_argument = generated_argument(interface.maplike.key_type, 'key')

Powered by Google App Engine
This is Rietveld 408576698