aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/imports/testlib/main.cpp4
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp4
-rw-r--r--src/particles/qquickcustomaffector.cpp8
-rw-r--r--src/particles/qquickparticleemitter.cpp4
-rw-r--r--src/particles/qquickparticlesystem.cpp2
-rw-r--r--src/particles/qquickparticlesystem_p.h2
-rw-r--r--src/particles/qquicktrailemitter.cpp6
-rw-r--r--src/particles/qquickv8particledata.cpp2
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp2
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp4
-rw-r--r--src/qml/qml/v8/qv8engine.cpp14
-rw-r--r--src/qml/qml/v8/qv8engine_p.h29
-rw-r--r--src/qml/qml/v8/qv8qobjectwrapper.cpp4
-rw-r--r--src/qml/qml/v8/qv8valuetypewrapper.cpp2
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp12
-rw-r--r--src/qml/types/qqmllistmodel.cpp4
-rw-r--r--src/qml/types/qquickworkerscript.cpp2
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp4
-rw-r--r--src/quick/util/qquickglobal.cpp6
19 files changed, 43 insertions, 72 deletions
diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp
index bd13056dcb..d854a26af5 100644
--- a/src/imports/testlib/main.cpp
+++ b/src/imports/testlib/main.cpp
@@ -97,7 +97,7 @@ public Q_SLOTS:
}
}
- return QQmlV4Handle::fromV8Handle(v8::String::New(name.toUtf8()));
+ return QQmlV4Handle(v8::String::New(name.toUtf8())->v4Value());
}
bool compare(const QVariant& act, const QVariant& exp) const {
@@ -110,7 +110,7 @@ public Q_SLOTS:
int count = stacks->GetFrameCount();
if (count >= frameIndex + 1) {
v8::Handle<v8::StackFrame> frame = stacks->GetFrame(frameIndex + 1);
- return QQmlV4Handle::fromV8Handle(frame->GetScriptNameOrSourceURL());
+ return QQmlV4Handle(frame->GetScriptNameOrSourceURL()->v4Value());
}
return QQmlV4Handle();
}
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 77c04bed61..e814eda04b 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -919,7 +919,7 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const
Q_D(const QQuickXmlListModel);
if (index < 0 || index >= count())
- return QQmlV4Handle::fromValue(Value::undefinedValue());
+ return QQmlV4Handle(Value::undefinedValue());
QQmlEngine *engine = qmlContext(this)->engine();
QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
@@ -930,7 +930,7 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const
p->value = v8engine->fromVariant(d->data.value(ii).value(index));
}
- return QQmlV4Handle::fromValue(Value::fromObject(o));
+ return QQmlV4Handle(Value::fromObject(o));
}
/*!
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp
index 9c46510091..37db984e92 100644
--- a/src/particles/qquickcustomaffector.cpp
+++ b/src/particles/qquickcustomaffector.cpp
@@ -145,11 +145,11 @@ void QQuickCustomAffector::affectSystem(qreal dt)
v8::Handle<v8::Array> array = v8::Array::New(toAffect.size());
for (int i=0; i<toAffect.size(); i++)
- array->Set(i, toAffect[i]->v8Value().toV8Handle());
+ array->Set(i, toAffect[i]->v4Value().toValue());
if (dt >= simulationCutoff || dt <= simulationDelta) {
affectProperties(toAffect, dt);
- emit affectParticles(QQmlV4Handle::fromV8Handle(array), dt);
+ emit affectParticles(QQmlV4Handle(array->v4Value()), dt);
} else {
int realTime = m_system->timeInt;
m_system->timeInt -= dt * 1000.0;
@@ -157,12 +157,12 @@ void QQuickCustomAffector::affectSystem(qreal dt)
m_system->timeInt += simulationDelta * 1000.0;
dt -= simulationDelta;
affectProperties(toAffect, simulationDelta);
- emit affectParticles(QQmlV4Handle::fromV8Handle(array), simulationDelta);
+ emit affectParticles(QQmlV4Handle(array->v4Value()), simulationDelta);
}
m_system->timeInt = realTime;
if (dt > 0.0) {
affectProperties(toAffect, dt);
- emit affectParticles(QQmlV4Handle::fromV8Handle(array), dt);
+ emit affectParticles(QQmlV4Handle(array->v4Value()), dt);
}
}
diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp
index d3a7adb1a8..630565f8f2 100644
--- a/src/particles/qquickparticleemitter.cpp
+++ b/src/particles/qquickparticleemitter.cpp
@@ -481,9 +481,9 @@ void QQuickParticleEmitter::emitWindow(int timeStamp)
//We then don't need to request another reload, because the first reload isn't scheduled until we get back to the render thread
v8::Handle<v8::Array> array = v8::Array::New(toEmit.size());
for (int i=0; i<toEmit.size(); i++)
- array->Set(i, toEmit[i]->v8Value().toV8Handle());
+ array->Set(i, toEmit[i]->v4Value().toValue());
- emitParticles(QQmlV4Handle::fromV8Handle(array));//A chance for arbitrary JS changes
+ emitParticles(QQmlV4Handle(array->v4Value()));//A chance for arbitrary JS changes
}
m_last_emission = pt;
diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp
index ce67fecf54..47761994e0 100644
--- a/src/particles/qquickparticlesystem.cpp
+++ b/src/particles/qquickparticlesystem.cpp
@@ -527,7 +527,7 @@ void QQuickParticleData::clone(const QQuickParticleData& other)
animationOwner = other.animationOwner;
}
-QQmlV4Handle QQuickParticleData::v8Value()
+QQmlV4Handle QQuickParticleData::v4Value()
{
if (!v8Datum)
v8Datum = new QQuickV8ParticleData(QQmlEnginePrivate::getV8Engine(qmlEngine(system)), this);
diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h
index 3b58fd139e..1eb26a27fb 100644
--- a/src/particles/qquickparticlesystem_p.h
+++ b/src/particles/qquickparticlesystem_p.h
@@ -228,7 +228,7 @@ public:
float lifeLeft();
float curSize();
void clone(const QQuickParticleData& other);//Not =, leaves meta-data like index
- QQmlV4Handle v8Value();
+ QQmlV4Handle v4Value();
void extendLife(float time);
private:
QQuickV8ParticleData* v8Datum;
diff --git a/src/particles/qquicktrailemitter.cpp b/src/particles/qquicktrailemitter.cpp
index c0e65e52e4..85cc23cd8b 100644
--- a/src/particles/qquicktrailemitter.cpp
+++ b/src/particles/qquicktrailemitter.cpp
@@ -271,12 +271,12 @@ void QQuickTrailEmitter::emitWindow(int timeStamp)
if (isEmitConnected() || isEmitFollowConnected()) {
v8::Handle<v8::Array> array = v8::Array::New(toEmit.size());
for (int i=0; i<toEmit.size(); i++)
- array->Set(i, toEmit[i]->v8Value().toV8Handle());
+ array->Set(i, toEmit[i]->v4Value().toValue());
if (isEmitFollowConnected())
- emitFollowParticles(QQmlV4Handle::fromV8Handle(array), d->v8Value());//A chance for many arbitrary JS changes
+ emitFollowParticles(QQmlV4Handle(array->v4Value()), d->v4Value());//A chance for many arbitrary JS changes
else if (isEmitConnected())
- emitParticles(QQmlV4Handle::fromV8Handle(array));//A chance for arbitrary JS changes
+ emitParticles(QQmlV4Handle(array->v4Value()));//A chance for arbitrary JS changes
}
m_lastEmission[d->index] = pt;
}
diff --git a/src/particles/qquickv8particledata.cpp b/src/particles/qquickv8particledata.cpp
index 9b8d1adfb9..8a73e4b287 100644
--- a/src/particles/qquickv8particledata.cpp
+++ b/src/particles/qquickv8particledata.cpp
@@ -496,7 +496,7 @@ QQuickV8ParticleData::~QQuickV8ParticleData()
QQmlV4Handle QQuickV8ParticleData::v4Value()
{
- return QQmlV4Handle::fromValue(m_v4Value);
+ return QQmlV4Handle(m_v4Value);
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index acb79032e7..44c1c52afa 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -238,7 +238,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
//### 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<QQmlV4Handle>()) {
- args[ii] = reinterpret_cast<QQmlV4Handle *>(a[ii + 1])->toV8Handle();
+ args[ii] = reinterpret_cast<QQmlV4Handle *>(a[ii + 1])->toValue();
} else if (ep->isQObject(type)) {
if (!*reinterpret_cast<void* const *>(a[ii + 1]))
args[ii] = QV4::Value::nullValue();
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index a967407788..4e8fad369c 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -632,7 +632,7 @@ QV4::Value font(const v8::Arguments &args)
v8::Handle<v8::Object> obj = args[0]->ToObject();
bool ok = false;
- QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QFont, QQmlV4Handle::fromV8Handle(obj), V8ENGINE(), &ok);
+ QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QFont, QQmlV4Handle(obj->v4Value()), V8ENGINE(), &ok);
if (!ok)
V4THROW_ERROR("Qt.font(): Invalid argument: no valid font subproperties specified");
return V8ENGINE()->fromVariant(v);
@@ -650,7 +650,7 @@ QV4::Value matrix4x4(const v8::Arguments &args)
if (args.Length() == 1 && args[0]->IsObject()) {
v8::Handle<v8::Object> obj = args[0]->ToObject();
bool ok = false;
- QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QMatrix4x4, QQmlV4Handle::fromV8Handle(obj), V8ENGINE(), &ok);
+ QVariant v = QQml_valueTypeProvider()->createVariantFromJsObject(QMetaType::QMatrix4x4, QQmlV4Handle(obj->v4Value()), V8ENGINE(), &ok);
if (!ok)
V4THROW_ERROR("Qt.matrix4x4(): Invalid argument: not a valid matrix4x4 values array");
return V8ENGINE()->fromVariant(v);
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index 650d9828f3..7d1bdb7aea 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -1480,20 +1480,6 @@ QV4::Value QV8Engine::toString(const QString &string)
}
-QV4::Value QQmlV4Handle::toValue() const
-{
- QV4::Value val;
- val.val = d;
- return val;
-}
-
-QQmlV4Handle QQmlV4Handle::fromValue(const QV4::Value &v)
-{
- QQmlV4Handle handle;
- handle.d = v.val;
- return handle;
-}
-
QV4::Value QV8Engine::evaluateScript(const QString &script, QV4::Object *scopeObject)
{
QV4::ExecutionContext *ctx = m_v4Engine->current;
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h
index 077c784c30..9781375657 100644
--- a/src/qml/qml/v8/qv8engine_p.h
+++ b/src/qml/qml/v8/qv8engine_p.h
@@ -81,23 +81,10 @@
#include "qv4jsonwrapper_p.h"
#include <private/qv4value_p.h>
-namespace QV4 {
-struct ArrayObject;
-}
-
-namespace v8 {
-
-// Needed for V8ObjectSet
-inline uint qHash(const v8::Handle<v8::Object> &object, uint seed = 0)
-{
- return (object->GetIdentityHash() ^ seed);
-}
-
-}
-
QT_BEGIN_NAMESPACE
namespace QV4 {
+ struct ArrayObject;
struct ExecutionEngine;
struct Value;
}
@@ -221,18 +208,16 @@ public:
QQmlV4Handle() : d(0) {}
QQmlV4Handle(const QQmlV4Handle &other) : d(other.d) {}
QQmlV4Handle &operator=(const QQmlV4Handle &other) { d = other.d; return *this; }
+ explicit QQmlV4Handle(const QV4::Value &v) : d(v.val) {}
- static QQmlV4Handle fromV8Handle(v8::Handle<v8::Value> h) {
- return QQmlV4Handle(h);
- }
- v8::Handle<v8::Value> toV8Handle() const {
- return v8::Value::NewFromInternalValue(d);
+ QV4::Value toValue() const {
+ QV4::Value v;
+ v.val = d;
+ return v;
}
- QV4::Value toValue() const;
- static QQmlV4Handle fromValue(const QV4::Value &v);
private:
- QQmlV4Handle(v8::Handle<v8::Value> h) : d(h.val) {}
+ QQmlV4Handle(quint64 h) : d(h) {}
quint64 d;
};
diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp
index 6025289512..d998c25236 100644
--- a/src/qml/qml/v8/qv8qobjectwrapper.cpp
+++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp
@@ -426,7 +426,7 @@ static v8::Handle<v8::Value> LoadProperty(QV8Engine *engine, QObject *object,
} else if (property.isV4Handle()) {
QQmlV4Handle handle;
ReadFunction(object, property, &handle, notifier);
- return handle.toV8Handle();
+ return handle.toValue();
} else if (property.propType == qMetaTypeId<QJSValue>()) {
QJSValue v;
ReadFunction(object, property, &v, notifier);
@@ -2171,7 +2171,7 @@ void CallArgument::fromValue(int callType, QV8Engine *engine, v8::Handle<v8::Val
}
type = callType;
} else if (callType == qMetaTypeId<QQmlV4Handle>()) {
- handlePtr = new (&allocData) QQmlV4Handle(QQmlV4Handle::fromV8Handle(value));
+ handlePtr = new (&allocData) QQmlV4Handle(QQmlV4Handle(value->v4Value()));
type = callType;
} else if (callType == QMetaType::QJsonArray) {
jsonArrayPtr = new (&allocData) QJsonArray(engine->jsonArrayFromJS(value->v4Value()));
diff --git a/src/qml/qml/v8/qv8valuetypewrapper.cpp b/src/qml/qml/v8/qv8valuetypewrapper.cpp
index 124a49d5e9..dd669fc97a 100644
--- a/src/qml/qml/v8/qv8valuetypewrapper.cpp
+++ b/src/qml/qml/v8/qv8valuetypewrapper.cpp
@@ -192,7 +192,7 @@ QVariant QV8ValueTypeWrapper::toVariant(v8::Handle<v8::Object> obj, int typeHint
// NOTE: obj must not be an external resource object (ie, wrapper object)
// instead, it is a normal js object which one of the value-type providers
// may know how to convert to the given type.
- return QQml_valueTypeProvider()->createVariantFromJsObject(typeHint, QQmlV4Handle::fromV8Handle(obj), m_engine, succeeded);
+ return QQml_valueTypeProvider()->createVariantFromJsObject(typeHint, QQmlV4Handle(obj->v4Value()), m_engine, succeeded);
}
QVariant QV8ValueTypeWrapper::toVariant(v8::Handle<v8::Object> obj)
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 1616addccf..4d0f17489c 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -2131,7 +2131,7 @@ void QQmlDelegateModelGroupPrivate::emitChanges(QV8Engine *engine)
if (isChangedConnected() && !changeSet.isEmpty()) {
v8::Handle<v8::Object> removed = engineData(engine)->array(engine, changeSet.removes());
v8::Handle<v8::Object> inserted = engineData(engine)->array(engine, changeSet.inserts());
- emit q->changed(QQmlV4Handle::fromV8Handle(removed), QQmlV4Handle::fromV8Handle(inserted));
+ emit q->changed(QQmlV4Handle(removed->v4Value()), QQmlV4Handle(inserted->v4Value()));
}
if (changeSet.difference() != 0)
emit q->countChanged();
@@ -2325,14 +2325,14 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
{
Q_D(QQmlDelegateModelGroup);
if (!d->model)
- return QQmlV4Handle::fromV8Handle(QV4::Value::undefinedValue());;
+ return QQmlV4Handle(QV4::Value::undefinedValue());;
QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model);
if (!model->m_context->isValid()) {
- return QQmlV4Handle::fromV8Handle(QV4::Value::undefinedValue());
+ return QQmlV4Handle(QV4::Value::undefinedValue());
} else if (index < 0 || index >= model->m_compositor.count(d->group)) {
qmlInfo(this) << tr("get: index out of range");
- return QQmlV4Handle::fromV8Handle(QV4::Value::undefinedValue());
+ return QQmlV4Handle(QV4::Value::undefinedValue());
}
Compositor::iterator it = model->m_compositor.find(d->group, index);
@@ -2344,7 +2344,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
cacheItem = model->m_adaptorModel.createItem(
model->m_cacheMetaType, model->m_context->engine(), it.modelIndex());
if (!cacheItem)
- return QQmlV4Handle::fromV8Handle(QV4::Value::undefinedValue());
+ return QQmlV4Handle(QV4::Value::undefinedValue());
cacheItem->groups = it->flags;
model->m_cache.insert(it.cacheIndex, cacheItem);
@@ -2357,7 +2357,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
handle->SetExternalResource(cacheItem);
++cacheItem->scriptRef;
- return QQmlV4Handle::fromV8Handle(handle);
+ return QQmlV4Handle(handle->v4Value());
}
bool QQmlDelegateModelGroupPrivate::parseIndex(
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index eb52179c94..23a41d426b 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -2136,7 +2136,7 @@ QQmlV4Handle QQmlListModel::get(int index) const
}
}
- return QQmlV4Handle::fromV8Handle(result);
+ return QQmlV4Handle(result->v4Value());
}
/*!
@@ -2157,7 +2157,7 @@ QQmlV4Handle QQmlListModel::get(int index) const
*/
void QQmlListModel::set(int index, const QQmlV4Handle &handle)
{
- v8::Handle<v8::Value> valuemap = handle.toV8Handle();
+ v8::Handle<v8::Value> valuemap = handle.toValue();
if (!valuemap->IsObject() || valuemap->IsArray()) {
qmlInfo(this) << tr("set: value is not an object");
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index 39a285247d..6a98621783 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -713,7 +713,7 @@ bool QQuickWorkerScript::event(QEvent *event)
WorkerDataEvent *workerEvent = static_cast<WorkerDataEvent *>(event);
QV8Engine *v8engine = QQmlEnginePrivate::get(engine)->v8engine();
v8::Handle<v8::Value> value = QV8Worker::deserialize(workerEvent->data(), v8engine);
- emit message(QQmlV4Handle::fromV8Handle(value));
+ emit message(QQmlV4Handle(value->v4Value()));
}
return true;
} else if (event->type() == (QEvent::Type)WorkerErrorEvent::WorkerError) {
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index cc9d2c1a78..1c71c9b0cc 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -369,9 +369,9 @@ QQmlV4Handle QQuickCanvasItem::context() const
{
Q_D(const QQuickCanvasItem);
if (d->contextInitialized)
- return QQmlV4Handle::fromV8Handle(d->context->v8value());
+ return QQmlV4Handle(d->context->v8value()->v4Value());
- return QQmlV4Handle::fromV8Handle(QV4::Value::nullValue());
+ return QQmlV4Handle(QV4::Value::nullValue());
}
/*!
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp
index f018075674..6bd73736e6 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -315,7 +315,7 @@ public:
if (ok) *ok = false;
QFont retn;
- v8::Handle<v8::Object> obj = object.toV8Handle()->ToObject();
+ v8::Handle<v8::Object> obj = object.toValue();
v8::Handle<v8::Value> vbold = obj->Get(v8::String::New("bold"));
v8::Handle<v8::Value> vcap = obj->Get(v8::String::New("capitalization"));
@@ -381,7 +381,7 @@ public:
static QMatrix4x4 matrix4x4FromObject(QQmlV4Handle object, bool *ok)
{
if (ok) *ok = false;
- v8::Handle<v8::Object> obj = object.toV8Handle()->ToObject();
+ v8::Handle<v8::Object> obj = object.toValue();
if (!obj->IsArray())
return QMatrix4x4();
@@ -751,7 +751,7 @@ public:
bool variantFromJsObject(int type, QQmlV4Handle object, QV8Engine *e, QVariant *v)
{
// must be called with a valid v8 context.
- Q_ASSERT(object.toV8Handle()->IsObject());
+ Q_ASSERT(object.toValue().isObject());
bool ok = false;
switch (type) {
case QMetaType::QFont: