diff options
author | Michael Brasser <michael.brasser@live.com> | 2016-04-12 20:15:42 -0500 |
---|---|---|
committer | Michael Brasser <michael.brasser@live.com> | 2016-04-13 11:16:44 +0000 |
commit | 8a546b889e14aad7202dc198bc9fe942ef7e94a6 (patch) | |
tree | b93dfea21b87255195de992b835819080b90c613 /src/qml/qml/qqmldelayedcallqueue.cpp | |
parent | d146a75bf0d5307c63a8d495a691a973f6807a32 (diff) |
Update DelayedFunctionCall to use an array object.
Change-Id: I9ffaa95ab58eff14abaf3573f5aa0d351ac0624d
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmldelayedcallqueue.cpp')
-rw-r--r-- | src/qml/qml/qqmldelayedcallqueue.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/qml/qml/qqmldelayedcallqueue.cpp b/src/qml/qml/qqmldelayedcallqueue.cpp index 250d5f20f3..8d0fb22866 100644 --- a/src/qml/qml/qqmldelayedcallqueue.cpp +++ b/src/qml/qml/qqmldelayedcallqueue.cpp @@ -62,12 +62,13 @@ void QQmlDelayedCallQueue::DelayedFunctionCall::execute(QV4::ExecutionEngine *en QV4::Scope scope(engine); - const int argCount = m_args.count(); + QV4::ArrayObject *array = m_args.as<QV4::ArrayObject>(); + const int argCount = array ? array->getLength() : 0; QV4::ScopedCallData callData(scope, argCount); callData->thisObject = QV4::Encode::undefined(); for (int i = 0; i < argCount; i++) { - callData->args[i] = m_args[i].value(); + callData->args[i] = array->getIndexed(i); } const QV4::FunctionObject *callback = m_function.as<QV4::FunctionObject>(); @@ -175,11 +176,18 @@ QV4::ReturnedValue QQmlDelayedCallQueue::addUniquelyAndExecuteLater(QV4::CallCon void QQmlDelayedCallQueue::storeAnyArguments(DelayedFunctionCall &dfc, const QV4::CallData *callData, int offset, QV4::ExecutionEngine *engine) { - dfc.m_args.clear(); - dfc.m_args.reserve(callData->argc - offset); - for (int j = offset; j < callData->argc; j++) { - dfc.m_args.append(QV4::PersistentValue(engine, callData->args[j])); + 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) { + array->putIndexed(i, callData->args[j]); + } + dfc.m_args.set(engine, array); } void QQmlDelayedCallQueue::executeAllExpired_Later() |