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

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

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/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 84e61a3e4dfd95098bae38b8716c604d998a7a61..d5087624a6888067ff198f97c5f255604798de04 100644
--- a/third_party/WebKit/Source/bindings/core/v8/Iterable.h
+++ b/third_party/WebKit/Source/bindings/core/v8/Iterable.h
@@ -11,7 +11,9 @@
namespace blink {
-// Typically, use one of ValueIterable<> and PairIterable<> (below) instead!
+// Typically, you should use PairIterable<> (below) instead.
+// Also, note that value iterators are set up automatically by the bindings
+// code and the operations below come directly from V8.
template <typename KeyType, typename ValueType>
class Iterable {
public:
@@ -165,45 +167,6 @@ class Iterable {
};
// Utiltity mixin base-class for classes implementing IDL interfaces with
-// "iterable<T>".
-template <typename ValueType>
-class ValueIterable : public Iterable<unsigned, ValueType> {
- public:
- Iterator* iterator(ScriptState* scriptState, ExceptionState& exceptionState) {
- return this->valuesForBinding(scriptState, exceptionState);
- }
-
- class IterationSource
- : public Iterable<unsigned, ValueType>::IterationSource {
- public:
- IterationSource() : m_index(0) {}
-
- ~IterationSource() override {}
-
- // If end of iteration has been reached or an exception thrown: return
- // false.
- // Otherwise: set |value| and return true.
- // Note: |this->m_index| is the index being accessed.
- virtual bool next(ScriptState*, ValueType&, ExceptionState&) = 0;
-
- protected:
- unsigned m_index;
-
- private:
- bool next(ScriptState* scriptState,
- unsigned& key,
- ValueType& value,
- ExceptionState& exceptionState) final {
- if (!next(scriptState, value, exceptionState))
- return false;
- key = m_index;
- ++m_index;
- return true;
- }
- };
-};
-
-// Utiltity mixin base-class for classes implementing IDL interfaces with
// "iterable<T1, T2>".
template <typename KeyType, typename ValueType>
class PairIterable : public Iterable<KeyType, ValueType> {

Powered by Google App Engine
This is Rietveld 408576698