1
0
forked from mirrors/0ad

Replace HandleWrapper and avoid repoint function

JS::Handle<T>::repoint gets removed with SpiderMonkey 38, so the
existing solution has to be replaced. The new approach should also be a
bit clearer. Named Return Value Optimization (NRVO) should avoid a
superfluous temporary for the return value in the generic template
function implementation of AssignOrFromJSVal.

Refs #3708

This was SVN commit r17695.
This commit is contained in:
Yves
2016-01-23 14:42:59 +00:00
parent b9f1125010
commit 5f86beea6f
4 changed files with 31 additions and 52 deletions
@@ -378,13 +378,6 @@ ScriptInterface_impl::~ScriptInterface_impl()
JS_DestroyContext(m_cx);
}
// Inside ScriptInterface.cpp directly to emphasize that it should only be used/needed internally and not from other code.
template<> bool ScriptInterface::FromJSVal<ScriptInterface::HandleWrapper>(JSContext* UNUSED(cx), JS::HandleValue v, ScriptInterface::HandleWrapper& out)
{
out.set(v);
return true;
}
void ScriptInterface_impl::Register(const char* name, JSNative fptr, uint nargs)
{
JSAutoRequest rq(m_cx);