aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-12-31 13:21:39 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2015-01-08 22:08:55 +0100
commita6c36616b0ccf9c1aeb71d90437c9226ae76fe10 (patch)
tree5c8e796b9fe6f15c08bd20dc20d084976c75845b /src/qml/qml
parentfbf674e566032121d6d0a865dbff2a5dac2b3f0d (diff)
Move extension mechanism over to use the v4 engine
Change-Id: Ib329fc7bcae3c78d962a116f53b2244a71f81228 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlcomponent.cpp9
-rw-r--r--src/qml/qml/qqmllocale.cpp19
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp4
-rw-r--r--src/qml/qml/v8/qv8engine_p.h8
4 files changed, 18 insertions, 22 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 115046f543..96623f21c3 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -87,12 +87,12 @@ QT_BEGIN_NAMESPACE
class QQmlComponentExtension : public QV8Engine::Deletable
{
public:
- QQmlComponentExtension(QV8Engine *);
+ QQmlComponentExtension(QV4::ExecutionEngine *v4);
virtual ~QQmlComponentExtension();
QV4::PersistentValue incubationProto;
};
-V8_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension);
+V4_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension);
/*!
\class QQmlComponent
@@ -1361,7 +1361,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
mode = QQmlIncubator::AsynchronousIfNested;
}
- QQmlComponentExtension *e = componentExtension(args->v4engine()->v8Engine);
+ QQmlComponentExtension *e = componentExtension(args->v4engine());
QV4::Scoped<QV4::QmlIncubatorObject> r(scope, v4->memoryManager->alloc<QV4::QmlIncubatorObject>(args->v4engine()->v8Engine, mode));
QV4::ScopedObject p(scope, e->incubationProto.value());
@@ -1406,9 +1406,8 @@ void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::Valu
}
}
-QQmlComponentExtension::QQmlComponentExtension(QV8Engine *engine)
+QQmlComponentExtension::QQmlComponentExtension(QV4::ExecutionEngine *v4)
{
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
QV4::ScopedObject proto(scope, v4->newObject());
proto->defineAccessorProperty(QStringLiteral("onStatusChanged"),
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 295347dcd5..9aba5824bb 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -643,20 +643,19 @@ LOCALE_STRING_PROPERTY(exponential)
LOCALE_STRING_PROPERTY(amText)
LOCALE_STRING_PROPERTY(pmText)
-class QV8LocaleDataDeletable : public QV8Engine::Deletable
+class QV4LocaleDataDeletable : public QV8Engine::Deletable
{
public:
- QV8LocaleDataDeletable(QV8Engine *engine);
- ~QV8LocaleDataDeletable();
+ QV4LocaleDataDeletable(QV4::ExecutionEngine *engine);
+ ~QV4LocaleDataDeletable();
QV4::PersistentValue prototype;
};
-QV8LocaleDataDeletable::QV8LocaleDataDeletable(QV8Engine *engine)
+QV4LocaleDataDeletable::QV4LocaleDataDeletable(QV4::ExecutionEngine *engine)
{
- QV4::ExecutionEngine *eng = QV8Engine::getV4(engine);
- QV4::Scope scope(eng);
- QV4::ScopedObject o(scope, eng->newObject());
+ QV4::Scope scope(engine);
+ QV4::Scoped<QV4::Object> o(scope, engine->newObject());
o->defineDefaultProperty(QStringLiteral("dateFormat"), QQmlLocaleData::method_dateFormat, 0);
o->defineDefaultProperty(QStringLiteral("standaloneDayName"), QQmlLocaleData::method_standaloneDayName, 0);
@@ -687,11 +686,11 @@ QV8LocaleDataDeletable::QV8LocaleDataDeletable(QV8Engine *engine)
prototype = o;
}
-QV8LocaleDataDeletable::~QV8LocaleDataDeletable()
+QV4LocaleDataDeletable::~QV4LocaleDataDeletable()
{
}
-V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data);
+V4_DEFINE_EXTENSION(QV4LocaleDataDeletable, localeV4Data);
/*!
\qmltype Locale
@@ -805,9 +804,9 @@ QV4::ReturnedValue QQmlLocale::locale(QV8Engine *v8engine, const QString &locale
QV4::ReturnedValue QQmlLocale::wrap(QV8Engine *engine, const QLocale &locale)
{
- QV8LocaleDataDeletable *d = localeV8Data(engine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
+ QV4LocaleDataDeletable *d = localeV4Data(scope.engine);
QV4::Scoped<QQmlLocaleData> wrapper(scope, v4->memoryManager->alloc<QQmlLocaleData>(v4));
wrapper->d()->locale = locale;
QV4::ScopedObject p(scope, d->prototype.value());
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 70e512df41..4b40fa3f40 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -885,9 +885,7 @@ QQmlEngine::quit() signal to the QCoreApplication::quit() slot.
*/
ReturnedValue QtObject::method_quit(CallContext *ctx)
{
- QV8Engine *v8engine = ctx->d()->engine->v8Engine;
-
- QQmlEnginePrivate::get(v8engine->engine())->sendQuit();
+ QQmlEnginePrivate::get(ctx->engine()->qmlEngine())->sendQuit();
return QV4::Encode::undefined();
}
diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h
index 7bd3e56a9d..329f4912c0 100644
--- a/src/qml/qml/v8/qv8engine_p.h
+++ b/src/qml/qml/v8/qv8engine_p.h
@@ -83,8 +83,8 @@ namespace QV4 {
#define V4THROW_TYPE(string) \
return ctx->engine()->throwTypeError(QStringLiteral(string));
-#define V8_DEFINE_EXTENSION(dataclass, datafunction) \
- static inline dataclass *datafunction(QV8Engine *engine) \
+#define V4_DEFINE_EXTENSION(dataclass, datafunction) \
+ static inline dataclass *datafunction(QV4::ExecutionEngine *engine) \
{ \
static int extensionId = -1; \
if (extensionId == -1) { \
@@ -93,10 +93,10 @@ namespace QV4 {
extensionId = QV8Engine::registerExtension(); \
QV8Engine::registrationMutex()->unlock(); \
} \
- dataclass *rv = (dataclass *)engine->extensionData(extensionId); \
+ dataclass *rv = (dataclass *)engine->v8Engine->extensionData(extensionId); \
if (!rv) { \
rv = new dataclass(engine); \
- engine->setExtensionData(extensionId, rv); \
+ engine->v8Engine->setExtensionData(extensionId, rv); \
} \
return rv; \
} \