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

Unified Diff: Source/core/testing/Internals.cpp

Issue 848673002: Add keys(), values() and entries() methods on iterable<> interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/modules/fetch/Headers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index 9e78bd2aded76c8441266fb9a931a191f4f86ed0..dc2f6240f1e6eed5bf106443e34b2a576c01856c 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -156,27 +156,15 @@ namespace blink {
namespace {
-class InternalsIterator final : public Iterator {
+class InternalsIterationSource final : public ValueIterable<int>::IterationSource {
public:
- InternalsIterator() : m_current(0) { }
-
- virtual ScriptValue next(ScriptState* scriptState, ExceptionState& exceptionState) override
+ bool next(ScriptState* scriptState, int& value, ExceptionState& exceptionState) override
{
- int value = m_current * m_current;
- if (m_current >= 5)
- return v8IteratorResultDone(scriptState);
- ++m_current;
- return v8IteratorResult(scriptState, value);
+ if (m_index >= 5)
+ return false;
+ value = m_index * m_index;
+ return true;
}
-
- virtual ScriptValue next(ScriptState* scriptState, ScriptValue value, ExceptionState& exceptionState) override
- {
- exceptionState.throwTypeError("Not implemented");
- return ScriptValue();
- }
-
-private:
- int m_current;
};
} // namespace
@@ -2364,14 +2352,14 @@ void Internals::forcePluginPlaceholder(HTMLElement* element, const PluginPlaceho
toHTMLPlugInElement(element)->setPlaceholder(DictionaryPluginPlaceholder::create(element->document(), options));
}
-Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptionState)
+void Internals::forceBlinkGCWithoutV8GC()
{
- return new InternalsIterator;
+ ThreadState::current()->scheduleGC();
}
-void Internals::forceBlinkGCWithoutV8GC()
+ValueIterable<int>::IterationSource* Internals::startIteration(ScriptState*, ExceptionState&)
{
- ThreadState::current()->scheduleGC();
+ return new InternalsIterationSource();
}
} // namespace blink
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/modules/fetch/Headers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698