aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlboundsignal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmlboundsignal.cpp')
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index 49f6dec7fa..7e549275e2 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -55,6 +55,8 @@
#include <private/qv8debugservice_p.h>
#include "qqmlinfo.h"
+#include <private/qv4value_p.h>
+
#include <QtCore/qstringbuilder.h>
#include <QtCore/qdebug.h>
@@ -119,8 +121,6 @@ void QQmlBoundSignalExpression::init(QQmlContextData *ctxt, QObject *scope)
QQmlBoundSignalExpression::~QQmlBoundSignalExpression()
{
- qPersistentDispose(m_v8function);
- qPersistentDispose(m_v8qmlscope);
}
QString QQmlBoundSignalExpression::expressionIdentifier(QQmlJavaScriptExpression *e)
@@ -138,9 +138,7 @@ QString QQmlBoundSignalExpression::expression() const
{
if (m_expressionFunctionValid) {
Q_ASSERT (context() && engine());
- v8::HandleScope handle_scope;
- v8::Context::Scope context_scope(QQmlEnginePrivate::get(engine())->v8engine()->context());
- return QV8Engine::toStringStatic(m_v8function->ToString());
+ return m_v8function.value().toQString();
} else if (!m_expressionUtf8.isEmpty()) {
return QString::fromUtf8(m_expressionUtf8);
} else {
@@ -161,8 +159,6 @@ void QQmlBoundSignalExpression::evaluate(void **a)
ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation.
{
- v8::HandleScope handle_scope;
- v8::Context::Scope context_scope(ep->v8engine()->context());
if (!m_expressionFunctionValid) {
//TODO: look at using the property cache here (as in the compiler)
@@ -210,17 +206,16 @@ void QQmlBoundSignalExpression::evaluate(void **a)
m_fileName, m_line, &m_v8qmlscope);
}
- if (m_v8function.IsEmpty() || m_v8function->IsNull()) {
+ if (m_v8function.isEmpty() || m_v8function.value().isNull()) {
ep->dereferenceScarceResources();
return; // could not evaluate function. Not valid.
}
- setUseSharedContext(false);
m_expressionFunctionValid = true;
}
if (!hasParameterInfo()) {
- QQmlJavaScriptExpression::evaluate(context(), m_v8function, 0);
+ QQmlJavaScriptExpression::evaluate(context(), m_v8function.value(), 0);
} else {
QV8Engine *engine = ep->v8engine();
QVarLengthArray<int, 9> dummy;
@@ -229,7 +224,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
int *argsTypes = QQmlPropertyCache::methodParameterTypes(m_target, methodIndex, dummy, 0);
int argCount = argsTypes ? m_parameterCountForJS : 0;
- QVarLengthArray<v8::Handle<v8::Value>, 9> args(argCount);
+ QVarLengthArray<QV4::Value, 9> args(argCount);
for (int ii = 0; ii < argCount; ++ii) {
int type = argsTypes[ii + 1];
@@ -240,20 +235,20 @@ void QQmlBoundSignalExpression::evaluate(void **a)
args[ii] = engine->fromVariant(*((QVariant *)a[ii + 1]));
} else if (type == QMetaType::Int) {
//### optimization. Can go away if we switch to metaTypeToJS, or be expanded otherwise
- args[ii] = v8::Integer::New(*reinterpret_cast<const int*>(a[ii + 1]));
- } else if (type == qMetaTypeId<QQmlV8Handle>()) {
- args[ii] = reinterpret_cast<QQmlV8Handle *>(a[ii + 1])->toHandle();
+ args[ii] = QV4::Value::fromInt32(*reinterpret_cast<const int*>(a[ii + 1]));
+ } else if (type == qMetaTypeId<QQmlV4Handle>()) {
+ args[ii] = reinterpret_cast<QQmlV4Handle *>(a[ii + 1])->toValue();
} else if (ep->isQObject(type)) {
if (!*reinterpret_cast<void* const *>(a[ii + 1]))
- args[ii] = v8::Null();
+ args[ii] = QV4::Value::nullValue();
else
- args[ii] = engine->newQObject(*reinterpret_cast<QObject* const *>(a[ii + 1]));
+ args[ii] = QV4::QObjectWrapper::wrap(ep->v4engine(), *reinterpret_cast<QObject* const *>(a[ii + 1]));
} else {
args[ii] = engine->fromVariant(QVariant(type, a[ii + 1]));
}
}
- QQmlJavaScriptExpression::evaluate(context(), m_v8function, argCount, args.data(), 0);
+ QQmlJavaScriptExpression::evaluate(context(), m_v8function.value(), argCount, args.data(), 0);
}
}
ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete.