aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp12
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper_p.h1
-rw-r--r--src/qml/qml/v4/qv4engine.cpp13
-rw-r--r--src/qml/qml/v4/qv4engine_p.h6
-rw-r--r--src/qml/qml/v4/qv4qmlextensions.cpp51
-rw-r--r--src/qml/qml/v4/qv4qmlextensions_p.h66
-rw-r--r--src/qml/qml/v4/v4.pri6
7 files changed, 145 insertions, 10 deletions
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index ae3934fff6..aaa7db27d6 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -50,6 +50,7 @@
#include <private/qv4engine_p.h>
#include <private/qv4functionobject_p.h>
#include <private/qv4variantobject_p.h>
+#include <private/qv4qmlextensions_p.h>
QT_BEGIN_NAMESPACE
@@ -57,9 +58,6 @@ using namespace QV4;
DEFINE_MANAGED_VTABLE(QmlValueTypeWrapper);
-PersistentValue QmlValueTypeWrapper::proto;
-
-
class QmlValueTypeReference : public QmlValueTypeWrapper
{
public:
@@ -133,12 +131,12 @@ static bool readReferenceValue(const QmlValueTypeReference *reference)
void QmlValueTypeWrapper::initProto(ExecutionEngine *v4)
{
- if (!proto.isEmpty())
+ if (v4->qmlExtensions()->valueTypeWrapperPrototype)
return;
Object *o = v4->newObject();
o->defineDefaultProperty(v4, QStringLiteral("toString"), method_toString, 1);
- proto = Value::fromObject(o);
+ v4->qmlExtensions()->valueTypeWrapperPrototype = o;
}
Value QmlValueTypeWrapper::create(QV8Engine *v8, QObject *object, int property, QQmlValueType *type)
@@ -147,7 +145,7 @@ Value QmlValueTypeWrapper::create(QV8Engine *v8, QObject *object, int property,
initProto(v4);
QmlValueTypeReference *r = new (v4->memoryManager) QmlValueTypeReference(v8);
- r->prototype = proto.value().objectValue();
+ r->prototype = v4->qmlExtensions()->valueTypeWrapperPrototype;
r->type = type; r->object = object; r->property = property;
return Value::fromObject(r);
}
@@ -158,7 +156,7 @@ Value QmlValueTypeWrapper::create(QV8Engine *v8, const QVariant &value, QQmlValu
initProto(v4);
QmlValueTypeCopy *r = new (v4->memoryManager) QmlValueTypeCopy(v8);
- r->prototype = proto.value().objectValue();
+ r->prototype = v4->qmlExtensions()->valueTypeWrapperPrototype;
r->type = type; r->value = value;
return Value::fromObject(r);
}
diff --git a/src/qml/qml/qqmlvaluetypewrapper_p.h b/src/qml/qml/qqmlvaluetypewrapper_p.h
index 4841bcc523..ccf4fd300a 100644
--- a/src/qml/qml/qqmlvaluetypewrapper_p.h
+++ b/src/qml/qml/qqmlvaluetypewrapper_p.h
@@ -95,7 +95,6 @@ public:
mutable QQmlValueType *type;
static void initProto(ExecutionEngine *v4);
- static PersistentValue proto;
};
}
diff --git a/src/qml/qml/v4/qv4engine.cpp b/src/qml/qml/v4/qv4engine.cpp
index ad5bcaf9b0..d7064a1808 100644
--- a/src/qml/qml/v4/qv4engine.cpp
+++ b/src/qml/qml/v4/qv4engine.cpp
@@ -64,6 +64,7 @@
#include "qv4executableallocator_p.h"
#include "qv4sequenceobject_p.h"
#include "qv4qobjectwrapper_p.h"
+#include "qv4qmlextensions_p.h"
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
#include <execinfo.h>
@@ -95,6 +96,7 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
, m_engineId(engineSerial.fetchAndAddOrdered(1))
, regExpCache(0)
, m_multiplyWrappedQObjects(0)
+ , m_qmlExtensions(0)
{
MemoryManager::GCBlocker gcBlocker(memoryManager);
@@ -276,6 +278,7 @@ ExecutionEngine::~ExecutionEngine()
delete m_multiplyWrappedQObjects;
m_multiplyWrappedQObjects = 0;
delete memoryManager;
+ delete m_qmlExtensions;
emptyClass->destroy();
delete identifierCache;
delete bumperPointerAllocator;
@@ -877,6 +880,9 @@ void ExecutionEngine::markObjects()
variantPrototype->mark();
sequencePrototype->mark();
+
+ if (m_qmlExtensions)
+ m_qmlExtensions->markObjects();
}
namespace {
@@ -914,6 +920,13 @@ Function *ExecutionEngine::functionForProgramCounter(quintptr pc) const
return 0;
}
+QmlExtensions *ExecutionEngine::qmlExtensions()
+{
+ if (!m_qmlExtensions)
+ m_qmlExtensions = new QmlExtensions;
+ return m_qmlExtensions;
+}
+
Exception::Exception(ExecutionContext *throwingContext, const Value &exceptionValue)
: exception(exceptionValue)
{
diff --git a/src/qml/qml/v4/qv4engine_p.h b/src/qml/qml/v4/qv4engine_p.h
index 09f76ecf4b..5b7733a3a4 100644
--- a/src/qml/qml/v4/qv4engine_p.h
+++ b/src/qml/qml/v4/qv4engine_p.h
@@ -106,6 +106,7 @@ struct InternalClass;
class MultiplyWrappedQObjectMap;
class RegExp;
class RegExpCache;
+struct QmlExtensions;
struct Q_QML_EXPORT ExecutionEngine
{
@@ -297,6 +298,11 @@ struct Q_QML_EXPORT ExecutionEngine
InternalClass *newClass(const InternalClass &other);
Function *functionForProgramCounter(quintptr pc) const;
+
+ QmlExtensions *qmlExtensions();
+
+private:
+ QmlExtensions *m_qmlExtensions;
};
inline void ExecutionEngine::pushContext(SimpleCallContext *context)
diff --git a/src/qml/qml/v4/qv4qmlextensions.cpp b/src/qml/qml/v4/qv4qmlextensions.cpp
new file mode 100644
index 0000000000..41a683d7f3
--- /dev/null
+++ b/src/qml/qml/v4/qv4qmlextensions.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the V4VM module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qv4qmlextensions_p.h"
+#include "qv4object_p.h"
+
+using namespace QV4;
+
+void QmlExtensions::markObjects()
+{
+ if (valueTypeWrapperPrototype)
+ valueTypeWrapperPrototype->mark();
+}
diff --git a/src/qml/qml/v4/qv4qmlextensions_p.h b/src/qml/qml/v4/qv4qmlextensions_p.h
new file mode 100644
index 0000000000..ee25a12e72
--- /dev/null
+++ b/src/qml/qml/v4/qv4qmlextensions_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the V4VM module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QV4QMLEXTENSIONS_P_H
+#define QV4QMLEXTENSIONS_P_H
+
+#include <qtqmlglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QV4 {
+struct Object;
+
+struct Q_QML_EXPORT QmlExtensions
+{
+ QmlExtensions()
+ : valueTypeWrapperPrototype(0)
+ {}
+
+ Object *valueTypeWrapperPrototype;
+
+ void markObjects();
+};
+
+} // namespace QV4
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/qml/qml/v4/v4.pri b/src/qml/qml/v4/v4.pri
index 3538e0fc60..9d15992a6c 100644
--- a/src/qml/qml/v4/v4.pri
+++ b/src/qml/qml/v4/v4.pri
@@ -53,7 +53,8 @@ SOURCES += \
$$PWD/qv4executableallocator.cpp \
$$PWD/qv4sequenceobject.cpp \
$$PWD/qv4include.cpp \
- $$PWD/qv4qobjectwrapper.cpp
+ $$PWD/qv4qobjectwrapper.cpp \
+ $$PWD/qv4qmlextensions.cpp
HEADERS += \
$$PWD/qv4global_p.h \
@@ -105,7 +106,8 @@ HEADERS += \
$$PWD/qv4executableallocator_p.h \
$$PWD/qv4sequenceobject_p.h \
$$PWD/qv4include_p.h \
- $$PWD/qv4qobjectwrapper_p.h
+ $$PWD/qv4qobjectwrapper_p.h \
+ $$PWD/qv4qmlextensions_p.h
llvm-libs {