Diff
Modified: trunk/Source/WebCore/ChangeLog (201069 => 201070)
--- trunk/Source/WebCore/ChangeLog 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/ChangeLog 2016-05-18 03:29:22 UTC (rev 201070)
@@ -1,3 +1,39 @@
+2016-05-17 Youenn Fablet <[email protected]>
+
+ Remove toJS template methods taking const Ref and const RefPtr
+ https://bugs.webkit.org/show_bug.cgi?id=157791
+
+ Reviewed by Chris Dumez.
+
+ Updating toJS template method taking a const Ref<T>& to take a Ref<T>&&.
+ Updating toJS template method taking a const RefPtr<T>& to take a RefPtr<T>&&.
+ Updating binding generator to generate rvalue references.
+
+ Covered by existing tests.
+
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::toJS):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateConstructorDefinition):
+ * bindings/scripts/test/JS/JSTestInterface.cpp:
+ (WebCore::JSTestInterfaceConstructor::construct):
+ * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
+ (WebCore::JSTestNamedConstructorNamedConstructor::construct):
+ * bindings/scripts/test/JS/JSTestNode.cpp:
+ (WebCore::JSTestNodeConstructor::construct):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::JSTestObjConstructor::construct):
+ * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+ (WebCore::constructJSTestOverloadedConstructors1):
+ (WebCore::constructJSTestOverloadedConstructors2):
+ (WebCore::constructJSTestOverloadedConstructors3):
+ (WebCore::constructJSTestOverloadedConstructors4):
+ (WebCore::constructJSTestOverloadedConstructors5):
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ (WebCore::JSTestTypedefsConstructor::construct):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
+
2016-05-17 Nan Wang <[email protected]>
AX: Adding children incorrectly when there are nested inline continuations
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (201069 => 201070)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-05-18 03:29:22 UTC (rev 201070)
@@ -255,8 +255,8 @@
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSC::ArrayBuffer*);
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSC::ArrayBufferView*);
JSC::JSValue toJS(JSC::ExecState*, JSC::JSGlobalObject*, JSC::ArrayBufferView*);
-template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const RefPtr<T>&);
-template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const Ref<T>&);
+template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, Ref<T>&&);
+template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, RefPtr<T>&&);
template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const Vector<T>&);
template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const Vector<RefPtr<T>>&);
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const String&);
@@ -541,14 +541,14 @@
return view->wrap(exec, globalObject);
}
-template<typename T> inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const RefPtr<T>& ptr)
+template<typename T> inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Ref<T>&& ptr)
{
return toJS(exec, globalObject, ptr.get());
}
-template<typename T> inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Ref<T>& ptr)
+template<typename T> inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, RefPtr<T>&& ptr)
{
- return toJS(exec, globalObject, const_cast<T&>(ptr.get()));
+ return toJS(exec, globalObject, ptr.get());
}
template<typename T> inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<T>& vector)
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (201069 => 201070)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-18 03:29:22 UTC (rev 201070)
@@ -5154,7 +5154,7 @@
push(@$outputArray, " return JSValue::encode(jsUndefined());\n");
}
- push(@$outputArray, " return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));\n");
+ push(@$outputArray, " return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));\n");
push(@$outputArray, "}\n\n");
}
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (201069 => 201070)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp 2016-05-18 03:29:22 UTC (rev 201070)
@@ -240,7 +240,7 @@
setDOMException(state, ec);
return JSValue::encode(JSValue());
}
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
template<> JSValue JSTestInterfaceConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp (201069 => 201070)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp 2016-05-18 03:29:22 UTC (rev 201070)
@@ -100,7 +100,7 @@
setDOMException(state, ec);
return JSValue::encode(JSValue());
}
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
template<> JSValue JSTestNamedConstructorNamedConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (201069 => 201070)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp 2016-05-18 03:29:22 UTC (rev 201070)
@@ -80,7 +80,7 @@
{
auto* castedThis = jsCast<JSTestNodeConstructor*>(state->callee());
auto object = TestNode::create();
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
template<> JSValue JSTestNodeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (201069 => 201070)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-18 03:29:22 UTC (rev 201070)
@@ -1024,7 +1024,7 @@
return throwArgumentMustBeFunctionError(*state, 1, "testCallbackFunction", "TestObj", nullptr);
RefPtr<TestCallbackFunction> testCallbackFunction = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
auto object = TestObj::create(*testCallback, *testCallbackFunction);
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
template<> JSValue JSTestObjConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (201069 => 201070)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp 2016-05-18 03:29:22 UTC (rev 201070)
@@ -76,7 +76,7 @@
if (UNLIKELY(!arrayBuffer))
return throwArgumentTypeError(*state, 0, "arrayBuffer", "TestOverloadedConstructors", nullptr, "ArrayBuffer");
auto object = TestOverloadedConstructors::create(*arrayBuffer);
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
static inline EncodedJSValue constructJSTestOverloadedConstructors2(ExecState* state)
@@ -90,7 +90,7 @@
if (UNLIKELY(!arrayBufferView))
return throwArgumentTypeError(*state, 0, "arrayBufferView", "TestOverloadedConstructors", nullptr, "ArrayBufferView");
auto object = TestOverloadedConstructors::create(*arrayBufferView);
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
static inline EncodedJSValue constructJSTestOverloadedConstructors3(ExecState* state)
@@ -102,7 +102,7 @@
if (UNLIKELY(!blob))
return throwArgumentTypeError(*state, 0, "blob", "TestOverloadedConstructors", nullptr, "Blob");
auto object = TestOverloadedConstructors::create(*blob);
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
static inline EncodedJSValue constructJSTestOverloadedConstructors4(ExecState* state)
@@ -114,7 +114,7 @@
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto object = TestOverloadedConstructors::create(string);
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
static inline EncodedJSValue constructJSTestOverloadedConstructors5(ExecState* state)
@@ -124,7 +124,7 @@
if (UNLIKELY(state->hadException()))
return JSValue::encode(jsUndefined());
auto object = TestOverloadedConstructors::create(longArgs);
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
template<> EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::construct(ExecState* state)
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (201069 => 201070)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-05-18 03:29:22 UTC (rev 201070)
@@ -136,7 +136,7 @@
return throwArgumentMustBeFunctionError(*state, 1, "testCallback", "TestTypedefs", nullptr);
RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
auto object = TestTypedefs::create(hello, *testCallback);
- return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), object)));
+ return JSValue::encode(asObject(toJS(state, castedThis->globalObject(), WTFMove(object))));
}
template<> JSValue JSTestTypedefsConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (201069 => 201070)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-05-18 02:53:45 UTC (rev 201069)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-05-18 03:29:22 UTC (rev 201070)
@@ -6478,7 +6478,7 @@
m_mediaControlsHost = MediaControlsHost::create(this);
auto mediaJSWrapper = toJS(exec, globalObject, *this);
- auto mediaControlsHostJSWrapper = toJS(exec, globalObject, m_mediaControlsHost);
+ auto mediaControlsHostJSWrapper = toJS(exec, globalObject, *m_mediaControlsHost);
JSC::MarkedArgumentBuffer argList;
argList.append(toJS(exec, globalObject, root));