| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Iterable_h | 5 #ifndef Iterable_h |
| 6 #define Iterable_h | 6 #define Iterable_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/V8IteratorResultValue.h" | 8 #include "bindings/core/v8/V8IteratorResultValue.h" |
| 9 #include "bindings/core/v8/V8ScriptRunner.h" | 9 #include "bindings/core/v8/V8ScriptRunner.h" |
| 10 #include "core/dom/Iterator.h" | 10 #include "core/dom/Iterator.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 }; | 116 }; |
| 117 struct EntrySelector { | 117 struct EntrySelector { |
| 118 STATIC_ONLY(EntrySelector); | 118 STATIC_ONLY(EntrySelector); |
| 119 static Vector<ScriptValue, 2> select(ScriptState* scriptState, | 119 static Vector<ScriptValue, 2> select(ScriptState* scriptState, |
| 120 const KeyType& key, | 120 const KeyType& key, |
| 121 const ValueType& value) { | 121 const ValueType& value) { |
| 122 v8::Local<v8::Object> creationContext = scriptState->context()->Global(); | 122 v8::Local<v8::Object> creationContext = scriptState->context()->Global(); |
| 123 v8::Isolate* isolate = scriptState->isolate(); | 123 v8::Isolate* isolate = scriptState->isolate(); |
| 124 | 124 |
| 125 Vector<ScriptValue, 2> entry; | 125 Vector<ScriptValue, 2> entry; |
| 126 entry.append( | 126 entry.push_back( |
| 127 ScriptValue(scriptState, toV8(key, creationContext, isolate))); | 127 ScriptValue(scriptState, toV8(key, creationContext, isolate))); |
| 128 entry.append( | 128 entry.push_back( |
| 129 ScriptValue(scriptState, toV8(value, creationContext, isolate))); | 129 ScriptValue(scriptState, toV8(value, creationContext, isolate))); |
| 130 return entry; | 130 return entry; |
| 131 } | 131 } |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 template <typename Selector> | 134 template <typename Selector> |
| 135 class IterableIterator final : public Iterator { | 135 class IterableIterator final : public Iterator { |
| 136 public: | 136 public: |
| 137 explicit IterableIterator(IterationSource* source) : m_source(source) {} | 137 explicit IterableIterator(IterationSource* source) : m_source(source) {} |
| 138 | 138 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 class PairIterable : public Iterable<KeyType, ValueType> { | 209 class PairIterable : public Iterable<KeyType, ValueType> { |
| 210 public: | 210 public: |
| 211 Iterator* iterator(ScriptState* scriptState, ExceptionState& exceptionState) { | 211 Iterator* iterator(ScriptState* scriptState, ExceptionState& exceptionState) { |
| 212 return this->entriesForBinding(scriptState, exceptionState); | 212 return this->entriesForBinding(scriptState, exceptionState); |
| 213 } | 213 } |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 } // namespace blink | 216 } // namespace blink |
| 217 | 217 |
| 218 #endif // Iterable_h | 218 #endif // Iterable_h |
| OLD | NEW |