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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/Iterable.h

Issue 2891063003: bindings: Use an alias for @@iterator in certain declarations. (Closed)
Patch Set: Rebase patch Created 3 years, 7 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/core/v8/Iterable.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/Iterable.h b/third_party/WebKit/Source/bindings/core/v8/Iterable.h
index d85365fc052b25fc42b81d9b59d826816e3d3c13..b83f6510032a954d0b6bfcdcadfb5d8eefe1071d 100644
--- a/third_party/WebKit/Source/bindings/core/v8/Iterable.h
+++ b/third_party/WebKit/Source/bindings/core/v8/Iterable.h
@@ -175,7 +175,7 @@ class Iterable {
};
// Utiltity mixin base-class for classes implementing IDL interfaces with
-// "iterable<T1, T2>".
+// "iterable<T1, T2>" or "maplike<T1, T2>".
template <typename KeyType, typename ValueType>
class PairIterable : public Iterable<KeyType, ValueType> {
public:
@@ -185,6 +185,20 @@ class PairIterable : public Iterable<KeyType, ValueType> {
}
};
+// Utiltity mixin base-class for classes implementing IDL interfaces with
+// "setlike<V>" (not "iterable<V>").
+// IDL interfaces with "iterable<V>" (value iterators) inherit @@iterator,
+// values(), entries(), keys() and forEach() from the %ArrayPrototype%
+// intrinsic object automatically.
+template <typename ValueType>
+class SetlikeIterable : public Iterable<ValueType, ValueType> {
+ public:
+ Iterator* GetIterator(ScriptState* script_state,
+ ExceptionState& exception_state) {
+ return this->valuesForBinding(script_state, exception_state);
+ }
+};
+
} // namespace blink
#endif // Iterable_h

Powered by Google App Engine
This is Rietveld 408576698