<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200411] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200411">200411</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2016-05-04 01:22:18 -0700 (Wed, 04 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Rename JSKeyValueIterator as JSDOMIterator
https://bugs.webkit.org/show_bug.cgi?id=157308
Reviewed by Darin Adler.
No change of behavior.
* bindings/js/JSDOMIterator.h: Renamed from Source/WebCore/bindings/js/JSKeyValueIterator.h.
(WebCore::JSDOMIteratorPrototype::create):
(WebCore::JSDOMIteratorPrototype::createStructure):
(WebCore::JSDOMIteratorPrototype::JSDOMIteratorPrototype):
(WebCore::createKeyValueIterator):
(WebCore::keyValueIteratorForEach):
(WebCore::JSDOMIterator<JSWrapper>::destroy):
(WebCore::JSDOMIterator<JSWrapper>::next):
(WebCore::JSDOMIteratorPrototype<JSWrapper>::next):
(WebCore::JSDOMIteratorPrototype<JSWrapper>::finishCreation):
* bindings/js/JSFontFaceSetCustom.cpp:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementationIterableFunctions):
* bindings/scripts/test/JS/JSTestObj.cpp:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSFontFaceSetCustomcpp">trunk/Source/WebCore/bindings/js/JSFontFaceSetCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMIteratorh">trunk/Source/WebCore/bindings/js/JSDOMIterator.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsJSKeyValueIteratorh">trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200410 => 200411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-04 07:44:40 UTC (rev 200410)
+++ trunk/Source/WebCore/ChangeLog        2016-05-04 08:22:18 UTC (rev 200411)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-05-04 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
+ Rename JSKeyValueIterator as JSDOMIterator
+ https://bugs.webkit.org/show_bug.cgi?id=157308
+
+ Reviewed by Darin Adler.
+
+ No change of behavior.
+
+ * bindings/js/JSDOMIterator.h: Renamed from Source/WebCore/bindings/js/JSKeyValueIterator.h.
+ (WebCore::JSDOMIteratorPrototype::create):
+ (WebCore::JSDOMIteratorPrototype::createStructure):
+ (WebCore::JSDOMIteratorPrototype::JSDOMIteratorPrototype):
+ (WebCore::createKeyValueIterator):
+ (WebCore::keyValueIteratorForEach):
+ (WebCore::JSDOMIterator<JSWrapper>::destroy):
+ (WebCore::JSDOMIterator<JSWrapper>::next):
+ (WebCore::JSDOMIteratorPrototype<JSWrapper>::next):
+ (WebCore::JSDOMIteratorPrototype<JSWrapper>::finishCreation):
+ * bindings/js/JSFontFaceSetCustom.cpp:
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementationIterableFunctions):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+
</ins><span class="cx"> 2016-05-04 Jiewen Tan <jiewen_tan@apple.com>
</span><span class="cx">
</span><span class="cx"> CrashTracer: [USER] com.apple.WebKit.WebContent at …ple.WebCore: WebCore::EditCommandComposition::unapply + 105
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMIteratorhfromrev200410trunkSourceWebCorebindingsjsJSKeyValueIteratorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/bindings/js/JSDOMIterator.h (from rev 200410, trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h) (0 => 200411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMIterator.h         (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSDOMIterator.h        2016-05-04 08:22:18 UTC (rev 200411)
</span><span class="lines">@@ -0,0 +1,188 @@
</span><ins>+/*
+ * Copyright (C) 2016 Canon, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CANON INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef JSDOMIterator_h
+#define JSDOMIterator_h
+
+#include "JSDOMBinding.h"
+#include <runtime/JSDestructibleObject.h>
+#include <type_traits>
+
+namespace WebCore {
+
+template<typename JSWrapper>
+class JSDOMIteratorPrototype : public JSC::JSNonFinalObject {
+public:
+ using Base = JSC::JSNonFinalObject;
+ using DOMWrapped = typename JSWrapper::DOMWrapped;
+
+ static JSDOMIteratorPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+ {
+ JSDOMIteratorPrototype* prototype = new (NotNull, JSC::allocateCell<JSDOMIteratorPrototype>(vm.heap)) JSDOMIteratorPrototype(vm, structure);
+ prototype->finishCreation(vm, globalObject);
+ return prototype;
+ }
+
+ DECLARE_INFO;
+
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+ static JSC::EncodedJSValue JSC_HOST_CALL next(JSC::ExecState*);
+
+private:
+ JSDOMIteratorPrototype(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure) { }
+
+ void finishCreation(JSC::VM&, JSC::JSGlobalObject*);
+};
+
+enum class IterationKind { Key, Value, KeyValue };
+
+template<typename JSWrapper>
+class JSDOMIterator: public JSDOMObject {
+public:
+ using DOMWrapped = typename std::remove_reference<decltype(std::declval<JSWrapper>().wrapped())>::type;
+ using Base = JSDOMObject;
+
+ DECLARE_INFO;
+
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+ static JSDOMIterator* create(JSC::VM& vm, JSC::Structure* structure, JSWrapper& iteratedObject, IterationKind kind)
+ {
+ JSDOMIterator* instance = new (NotNull, JSC::allocateCell<JSDOMIterator>(vm.heap)) JSDOMIterator(structure, iteratedObject, kind);
+ instance->finishCreation(vm);
+ return instance;
+ }
+
+ static JSDOMIteratorPrototype<JSWrapper>* createPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
+ {
+ return JSDOMIteratorPrototype<JSWrapper>::create(vm, globalObject,
+ JSDOMIteratorPrototype<JSWrapper>::createStructure(vm, globalObject, globalObject->objectPrototype()));
+ }
+
+ JSC::JSValue next(JSC::ExecState&);
+
+private:
+ JSDOMIterator(JSC::Structure* structure, JSWrapper& iteratedObject, IterationKind kind)
+ : Base(structure, *iteratedObject.globalObject())
+ , m_iterator(iteratedObject.wrapped().createIterator())
+ , m_kind(kind)
+ {
+ }
+
+ static void destroy(JSC::JSCell*);
+
+ typename DOMWrapped::Iterator m_iterator;
+ IterationKind m_kind;
+};
+
+template<typename JSWrapper>
+JSC::EncodedJSValue createKeyValueIterator(JSC::ExecState& state, IterationKind kind, const char* propertyName)
+{
+ auto wrapper = JSC::jsDynamicCast<JSWrapper*>(state.thisValue());
+ if (UNLIKELY(!wrapper))
+ return throwThisTypeError(state, JSWrapper::info()->className, propertyName);
+ JSDOMGlobalObject& globalObject = *wrapper->globalObject();
+ return JSC::JSValue::encode(JSDOMIterator<JSWrapper>::create(globalObject.vm(), getDOMStructure<JSDOMIterator<JSWrapper>>(globalObject.vm(), globalObject), *wrapper, kind));
+}
+
+template<typename JSWrapper>
+JSC::EncodedJSValue keyValueIteratorForEach(JSC::ExecState& state, const char* propertyName)
+{
+ auto wrapper = JSC::jsDynamicCast<JSWrapper*>(state.thisValue());
+ if (UNLIKELY(!wrapper))
+ return throwThisTypeError(state, JSWrapper::info()->className, propertyName);
+
+ JSC::CallData callData;
+ JSC::CallType callType = JSC::getCallData(state.argument(0), callData);
+ if (callType == JSC::CallType::None)
+ return throwVMTypeError(&state);
+
+ auto iterator = wrapper->wrapped().createIterator();
+ while (auto value = iterator.next(state)) {
+ JSC::MarkedArgumentBuffer arguments;
+ arguments.append(toJS(&state, wrapper->globalObject(), value.value().value));
+ arguments.append(toJS(&state, wrapper->globalObject(), value.value().key));
+ arguments.append(wrapper);
+ JSC::call(&state, state.argument(0), callType, callData, wrapper, arguments);
+ if (state.hadException())
+ break;
+ }
+ return JSC::JSValue::encode(JSC::jsUndefined());
+}
+
+template<typename JSWrapper>
+void JSDOMIterator<JSWrapper>::destroy(JSCell* cell)
+{
+ JSDOMIterator<JSWrapper>* thisObject = JSC::jsCast<JSDOMIterator<JSWrapper>*>(cell);
+ thisObject->JSDOMIterator<JSWrapper>::~JSDOMIterator();
+}
+
+template<typename JSWrapper>
+JSC::JSValue JSDOMIterator<JSWrapper>::next(JSC::ExecState& state)
+{
+ auto iteratorValue = m_iterator.next(state);
+ if (!iteratorValue)
+ return createIteratorResultObject(&state, JSC::jsUndefined(), true);
+
+ JSC::JSValue value;
+ if (m_kind == IterationKind::Value)
+ value = toJS(&state, globalObject(), iteratorValue.value().value);
+ else if (m_kind == IterationKind::Key)
+ value = toJS(&state, globalObject(), iteratorValue.value().key);
+ else
+ value = jsPair(state, globalObject(), iteratorValue.value().key, iteratorValue.value().value);
+
+ return createIteratorResultObject(&state, value, false);
+}
+
+template<typename JSWrapper>
+JSC::EncodedJSValue JSC_HOST_CALL JSDOMIteratorPrototype<JSWrapper>::next(JSC::ExecState* state)
+{
+ auto iterator = JSC::jsDynamicCast<JSDOMIterator<JSWrapper>*>(state->thisValue());
+ if (!iterator)
+ return JSC::JSValue::encode(throwTypeError(state, ASCIILiteral("Cannot call next() on a non-Iterator object")));
+
+ return JSC::JSValue::encode(iterator->next(*state));
+}
+
+template<typename JSWrapper>
+void JSDOMIteratorPrototype<JSWrapper>::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
+{
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+
+ JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, next, JSC::DontEnum, 0, JSC::NoIntrinsic);
+}
+
+}
+
+#endif // !defined(JSDOMIterator_h)
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSFontFaceSetCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSFontFaceSetCustom.cpp (200410 => 200411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSFontFaceSetCustom.cpp        2016-05-04 07:44:40 UTC (rev 200410)
+++ trunk/Source/WebCore/bindings/js/JSFontFaceSetCustom.cpp        2016-05-04 08:22:18 UTC (rev 200411)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx">
</span><span class="cx"> #include "FontFace.h"
</span><span class="cx"> #include "JSFontFace.h"
</span><del>-#include "JSKeyValueIterator.h"
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSKeyValueIteratorh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h (200410 => 200411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h        2016-05-04 07:44:40 UTC (rev 200410)
+++ trunk/Source/WebCore/bindings/js/JSKeyValueIterator.h        2016-05-04 08:22:18 UTC (rev 200411)
</span><span class="lines">@@ -1,188 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Canon, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY CANON INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CANON INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef JSKeyValueIterator_h
-#define JSKeyValueIterator_h
-
-#include "JSDOMBinding.h"
-#include <runtime/JSDestructibleObject.h>
-#include <type_traits>
-
-namespace WebCore {
-
-template<typename JSWrapper>
-class JSKeyValueIteratorPrototype : public JSC::JSNonFinalObject {
-public:
- using Base = JSC::JSNonFinalObject;
- using DOMWrapped = typename JSWrapper::DOMWrapped;
-
- static JSKeyValueIteratorPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
- {
- JSKeyValueIteratorPrototype* prototype = new (NotNull, JSC::allocateCell<JSKeyValueIteratorPrototype>(vm.heap)) JSKeyValueIteratorPrototype(vm, structure);
- prototype->finishCreation(vm, globalObject);
- return prototype;
- }
-
- DECLARE_INFO;
-
- static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
- {
- return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
- }
-
- static JSC::EncodedJSValue JSC_HOST_CALL next(JSC::ExecState*);
-
-private:
- JSKeyValueIteratorPrototype(JSC::VM& vm, JSC::Structure* structure) : Base(vm, structure) { }
-
- void finishCreation(JSC::VM&, JSC::JSGlobalObject*);
-};
-
-enum class IterationKind { Key, Value, KeyValue };
-
-template<typename JSWrapper>
-class JSKeyValueIterator: public JSDOMObject {
-public:
- using DOMWrapped = typename std::remove_reference<decltype(std::declval<JSWrapper>().wrapped())>::type;
- using Base = JSDOMObject;
-
- DECLARE_INFO;
-
- static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
- {
- return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
- }
-
- static JSKeyValueIterator* create(JSC::VM& vm, JSC::Structure* structure, JSWrapper& iteratedObject, IterationKind kind)
- {
- JSKeyValueIterator* instance = new (NotNull, JSC::allocateCell<JSKeyValueIterator>(vm.heap)) JSKeyValueIterator(structure, iteratedObject, kind);
- instance->finishCreation(vm);
- return instance;
- }
-
- static JSKeyValueIteratorPrototype<JSWrapper>* createPrototype(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
- {
- return JSKeyValueIteratorPrototype<JSWrapper>::create(vm, globalObject,
- JSKeyValueIteratorPrototype<JSWrapper>::createStructure(vm, globalObject, globalObject->objectPrototype()));
- }
-
- JSC::JSValue next(JSC::ExecState&);
-
-private:
- JSKeyValueIterator(JSC::Structure* structure, JSWrapper& iteratedObject, IterationKind kind)
- : Base(structure, *iteratedObject.globalObject())
- , m_iterator(iteratedObject.wrapped().createIterator())
- , m_kind(kind)
- {
- }
-
- static void destroy(JSC::JSCell*);
-
- typename DOMWrapped::Iterator m_iterator;
- IterationKind m_kind;
-};
-
-template<typename JSWrapper>
-JSC::EncodedJSValue createKeyValueIterator(JSC::ExecState& state, IterationKind kind, const char* propertyName)
-{
- auto wrapper = JSC::jsDynamicCast<JSWrapper*>(state.thisValue());
- if (UNLIKELY(!wrapper))
- return throwThisTypeError(state, JSWrapper::info()->className, propertyName);
- JSDOMGlobalObject& globalObject = *wrapper->globalObject();
- return JSC::JSValue::encode(JSKeyValueIterator<JSWrapper>::create(globalObject.vm(), getDOMStructure<JSKeyValueIterator<JSWrapper>>(globalObject.vm(), globalObject), *wrapper, kind));
-}
-
-template<typename JSWrapper>
-JSC::EncodedJSValue keyValueIteratorForEach(JSC::ExecState& state, const char* propertyName)
-{
- auto wrapper = JSC::jsDynamicCast<JSWrapper*>(state.thisValue());
- if (UNLIKELY(!wrapper))
- return throwThisTypeError(state, JSWrapper::info()->className, propertyName);
-
- JSC::CallData callData;
- JSC::CallType callType = JSC::getCallData(state.argument(0), callData);
- if (callType == JSC::CallType::None)
- return throwVMTypeError(&state);
-
- auto iterator = wrapper->wrapped().createIterator();
- while (auto value = iterator.next(state)) {
- JSC::MarkedArgumentBuffer arguments;
- arguments.append(toJS(&state, wrapper->globalObject(), value.value().value));
- arguments.append(toJS(&state, wrapper->globalObject(), value.value().key));
- arguments.append(wrapper);
- JSC::call(&state, state.argument(0), callType, callData, wrapper, arguments);
- if (state.hadException())
- break;
- }
- return JSC::JSValue::encode(JSC::jsUndefined());
-}
-
-template<typename JSWrapper>
-void JSKeyValueIterator<JSWrapper>::destroy(JSCell* cell)
-{
- JSKeyValueIterator<JSWrapper>* thisObject = JSC::jsCast<JSKeyValueIterator<JSWrapper>*>(cell);
- thisObject->JSKeyValueIterator<JSWrapper>::~JSKeyValueIterator();
-}
-
-template<typename JSWrapper>
-JSC::JSValue JSKeyValueIterator<JSWrapper>::next(JSC::ExecState& state)
-{
- auto iteratorValue = m_iterator.next(state);
- if (!iteratorValue)
- return createIteratorResultObject(&state, JSC::jsUndefined(), true);
-
- JSC::JSValue value;
- if (m_kind == IterationKind::Value)
- value = toJS(&state, globalObject(), iteratorValue.value().value);
- else if (m_kind == IterationKind::Key)
- value = toJS(&state, globalObject(), iteratorValue.value().key);
- else
- value = jsPair(state, globalObject(), iteratorValue.value().key, iteratorValue.value().value);
-
- return createIteratorResultObject(&state, value, false);
-}
-
-template<typename JSWrapper>
-JSC::EncodedJSValue JSC_HOST_CALL JSKeyValueIteratorPrototype<JSWrapper>::next(JSC::ExecState* state)
-{
- auto iterator = JSC::jsDynamicCast<JSKeyValueIterator<JSWrapper>*>(state->thisValue());
- if (!iterator)
- return JSC::JSValue::encode(throwTypeError(state, ASCIILiteral("Cannot call next() on a non-Iterator object")));
-
- return JSC::JSValue::encode(iterator->next(*state));
-}
-
-template<typename JSWrapper>
-void JSKeyValueIteratorPrototype<JSWrapper>::finishCreation(JSC::VM& vm, JSC::JSGlobalObject* globalObject)
-{
- Base::finishCreation(vm);
- ASSERT(inherits(info()));
-
- JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->next, next, JSC::DontEnum, 0, JSC::NoIntrinsic);
-}
-
-}
-
-#endif // !defined(JSKeyValueIterator_h)
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200410 => 200411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-04 07:44:40 UTC (rev 200410)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-04 08:22:18 UTC (rev 200411)
</span><span class="lines">@@ -4157,11 +4157,11 @@
</span><span class="cx"> my $className = "JS$interfaceName";
</span><span class="cx"> my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
</span><span class="cx">
</span><del>- AddToImplIncludes("JSKeyValueIterator.h");
</del><ins>+ AddToImplIncludes("JSDOMIterator.h");
</ins><span class="cx">
</span><span class="cx"> push(@implContent, <<END);
</span><del>-using ${interfaceName}Iterator = JSKeyValueIterator<${className}>;
-using ${interfaceName}IteratorPrototype = JSKeyValueIteratorPrototype<${className}>;
</del><ins>+using ${interfaceName}Iterator = JSDOMIterator<${className}>;
+using ${interfaceName}IteratorPrototype = JSDOMIteratorPrototype<${className}>;
</ins><span class="cx">
</span><span class="cx"> template<>
</span><span class="cx"> const JSC::ClassInfo ${interfaceName}Iterator::s_info = { "${visibleInterfaceName} Iterator", &Base::s_info, 0, CREATE_METHOD_TABLE(${interfaceName}Iterator) };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200410 => 200411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-05-04 07:44:40 UTC (rev 200410)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-05-04 08:22:18 UTC (rev 200411)
</span><span class="lines">@@ -30,12 +30,12 @@
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "JSDOMBinding.h"
</span><span class="cx"> #include "JSDOMConstructor.h"
</span><ins>+#include "JSDOMIterator.h"
</ins><span class="cx"> #include "JSDOMPromise.h"
</span><span class="cx"> #include "JSDOMStringList.h"
</span><span class="cx"> #include "JSDocument.h"
</span><span class="cx"> #include "JSEventListener.h"
</span><span class="cx"> #include "JSFetchRequest.h"
</span><del>-#include "JSKeyValueIterator.h"
</del><span class="cx"> #include "JSNode.h"
</span><span class="cx"> #include "JSSVGDocument.h"
</span><span class="cx"> #include "JSSVGPoint.h"
</span><span class="lines">@@ -5890,8 +5890,8 @@
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-using TestObjIterator = JSKeyValueIterator<JSTestObj>;
-using TestObjIteratorPrototype = JSKeyValueIteratorPrototype<JSTestObj>;
</del><ins>+using TestObjIterator = JSDOMIterator<JSTestObj>;
+using TestObjIteratorPrototype = JSDOMIteratorPrototype<JSTestObj>;
</ins><span class="cx">
</span><span class="cx"> template<>
</span><span class="cx"> const JSC::ClassInfo TestObjIterator::s_info = { "TestObject Iterator", &Base::s_info, 0, CREATE_METHOD_TABLE(TestObjIterator) };
</span></span></pre>
</div>
</div>
</body>
</html>