aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmldelayedcallqueue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmldelayedcallqueue.cpp')
-rw-r--r--src/qml/qml/qqmldelayedcallqueue.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/qml/qml/qqmldelayedcallqueue.cpp b/src/qml/qml/qqmldelayedcallqueue.cpp
index 13e62ec696..df4030e522 100644
--- a/src/qml/qml/qqmldelayedcallqueue.cpp
+++ b/src/qml/qml/qqmldelayedcallqueue.cpp
@@ -42,6 +42,7 @@
#include <private/qqmlengine_p.h>
#include <private/qqmljavascriptexpression_p.h>
#include <private/qv4value_p.h>
+#include <private/qv4jscall_p.h>
#include <private/qv4qobjectwrapper_p.h>
#include <QQmlError>
@@ -63,17 +64,17 @@ void QQmlDelayedCallQueue::DelayedFunctionCall::execute(QV4::ExecutionEngine *en
QV4::Scope scope(engine);
QV4::ArrayObject *array = m_args.as<QV4::ArrayObject>();
+ const QV4::FunctionObject *callback = m_function.as<QV4::FunctionObject>();
+ Q_ASSERT(callback);
const int argCount = array ? array->getLength() : 0;
- QV4::ScopedCallData callData(scope, argCount);
- callData->thisObject = QV4::Encode::undefined();
+ QV4::JSCallData jsCallData(scope, argCount);
+ *jsCallData->thisObject = QV4::Encode::undefined();
for (int i = 0; i < argCount; i++) {
- callData->args[i] = array->getIndexed(i);
+ jsCallData->args[i] = array->getIndexed(i);
}
- const QV4::FunctionObject *callback = m_function.as<QV4::FunctionObject>();
- Q_ASSERT(callback);
- callback->call(scope, callData);
+ callback->call(jsCallData);
if (scope.engine->hasException) {
QQmlError error = scope.engine->catchExceptionAsQmlError();
@@ -105,9 +106,10 @@ void QQmlDelayedCallQueue::init(QV4::ExecutionEngine* engine)
m_tickedMethod = metaObject.method(methodIndex);
}
-void QQmlDelayedCallQueue::addUniquelyAndExecuteLater(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData)
+QV4::ReturnedValue QQmlDelayedCallQueue::addUniquelyAndExecuteLater(const QV4::BuiltinFunction *b, QV4::CallData *callData)
{
- if (callData->argc == 0)
+ QV4::Scope scope(b);
+ if (callData->argc() == 0)
THROW_GENERIC_ERROR("Qt.callLater: no arguments given");
const QV4::FunctionObject *func = callData->args[0].as<QV4::FunctionObject>();
@@ -158,8 +160,8 @@ void QQmlDelayedCallQueue::addUniquelyAndExecuteLater(const QV4::BuiltinFunction
dfc.m_guarded = true;
} else if (func->scope()->type == QV4::Heap::ExecutionContext::Type_QmlContext) {
QV4::QmlContext::Data *g = static_cast<QV4::QmlContext::Data *>(func->scope());
- Q_ASSERT(g->qml->scopeObject);
- dfc.m_objectGuard = QQmlGuard<QObject>(g->qml->scopeObject);
+ Q_ASSERT(g->qml()->scopeObject);
+ dfc.m_objectGuard = QQmlGuard<QObject>(g->qml()->scopeObject);
dfc.m_guarded = true;
}
}
@@ -169,22 +171,21 @@ void QQmlDelayedCallQueue::addUniquelyAndExecuteLater(const QV4::BuiltinFunction
m_tickedMethod.invoke(this, Qt::QueuedConnection);
m_callbackOutstanding = true;
}
- scope.result = QV4::Encode::undefined();
+ return QV4::Encode::undefined();
}
void QQmlDelayedCallQueue::storeAnyArguments(DelayedFunctionCall &dfc, const QV4::CallData *callData, int offset, QV4::ExecutionEngine *engine)
{
- const int length = callData->argc - offset;
+ const int length = callData->argc() - offset;
if (length == 0) {
dfc.m_args.clear();
return;
}
QV4::Scope scope(engine);
QV4::ScopedArrayObject array(scope, engine->newArrayObject(length));
- int i = 0;
- for (int j = offset; j < callData->argc; ++i, ++j) {
+ uint i = 0;
+ for (int j = offset, ej = callData->argc(); j < ej; ++i, ++j)
array->putIndexed(i, callData->args[j]);
- }
dfc.m_args.set(engine, array);
}