int m_nextId;
- static QV4::Value sendMessage(const v8::Arguments &args);
+ static QV4::Value sendMessage(QV4::SimpleCallContext *ctx);
signals:
void stopThread();
QV4::FunctionObject *createsendconstructor = createsendscript.run().asFunctionObject();
QV4::Value args[] = {
- V8FUNCTION(QQuickWorkerScriptEnginePrivate::sendMessage, this)->v4Value()
+ QV4::Value::fromObject(m_v4Engine->newBuiltinFunction(m_v4Engine->rootContext, m_v4Engine->newString(QStringLiteral("sendMessage")),
+ QQuickWorkerScriptEnginePrivate::sendMessage))
};
createsend = createsendconstructor->call(global(), args, 1);
}
{
}
-QV4::Value QQuickWorkerScriptEnginePrivate::sendMessage(const v8::Arguments &args)
+QV4::Value QQuickWorkerScriptEnginePrivate::sendMessage(QV4::SimpleCallContext *ctx)
{
- WorkerEngine *engine = (WorkerEngine*)V8ENGINE();
+ WorkerEngine *engine = (WorkerEngine*)ctx->engine->publicEngine->handle();
- int id = args[1]->Int32Value();
+ int id = ctx->argument(1).toInt32();
- QByteArray data = QV4::Serialize::serialize(args[2]->v4Value(), engine);
+ QByteArray data = QV4::Serialize::serialize(ctx->argument(2), engine);
QMutexLocker locker(&engine->p->m_lock);
WorkerScript *script = engine->p->workers.value(id);
if (args->length() < 1)
args->setReturnValue(QV4::Value::nullValue());
- v8::Handle<v8::Value> value = (*args)[0];
+ QV4::Value value = (*args)[0];
QString result;
QV8Engine *engine = args->engine();
//Check for Object Type
- if (value->IsObject()
- && !value->IsFunction()
- && !value->IsArray()
- && !value->IsDate()
- && !value->IsRegExp()) {
- QVariant v = engine->toVariant(value->v4Value(), QMetaType::UnknownType);
+ if (value.isObject()
+ && !value.asFunctionObject()
+ && !value.asArrayObject()) {
+ QVariant v = engine->toVariant(value, QMetaType::UnknownType);
if (v.isValid()) {
switch (v.type()) {
case QVariant::Vector3D:
result = QLatin1String("Object");
}
} else {
- v8::Handle<v8::String> jsstr = value->ToString();
- QString tmp = jsstr->v4Value().toQString();
- if (value->IsArray())
+ QString tmp = value.toQString();
+ if (value.asArrayObject())
result.append(QString::fromLatin1("[%1]").arg(tmp));
else
result.append(tmp);