aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4serialize.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-12-18 16:20:11 +0100
committerUlf Hermann <ulf.hermann@qt.io>2018-02-11 19:20:12 +0000
commitb897a4b9e54fc2c53115ca70dc64332ee3a00462 (patch)
tree0cddd885f8f1b4b4bd23631b09c36fa004af024f /src/qml/jsruntime/qv4serialize.cpp
parentbf1a4d3c88bd954c4f5dc53639e0a27b7be963f7 (diff)
QML: Make mapping of sequence object in JS optional
qv4sequenceobject.o is the largest single object in QtQml.so. This is probably due to template and macro explosion. Not everyone will want to pay this price to have Qt containers natively available in JS. Change-Id: I7dc64566a653c865d5c1b6e4f21a3a9089db100a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4serialize.cpp')
-rw-r--r--src/qml/jsruntime/qv4serialize.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qml/jsruntime/qv4serialize.cpp
index 14def49d0a..9bb226a1af 100644
--- a/src/qml/jsruntime/qv4serialize.cpp
+++ b/src/qml/jsruntime/qv4serialize.cpp
@@ -46,7 +46,9 @@
#include <private/qv4value_p.h>
#include <private/qv4dateobject_p.h>
#include <private/qv4regexpobject_p.h>
+#if QT_CONFIG(qml_sequence_object)
#include <private/qv4sequenceobject_p.h>
+#endif
#include <private/qv4objectproto_p.h>
#include <private/qv4qobjectwrapper_p.h>
@@ -83,7 +85,9 @@ enum Type {
WorkerDate,
WorkerRegexp,
WorkerListModel,
+#if QT_CONFIG(qml_sequence_object)
WorkerSequence
+#endif
};
static inline quint32 valueheader(Type type, quint32 size = 0)
@@ -239,6 +243,7 @@ void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine
// No other QObject's are allowed to be sent
push(data, valueheader(WorkerUndefined));
} else if (const Object *o = v.as<Object>()) {
+#if QT_CONFIG(qml_sequence_object)
if (o->isListType()) {
// valid sequence. we generate a length (sequence length + 1 for the sequence type)
uint seqLength = ScopedValue(scope, o->get(engine->id_length()))->toUInt32();
@@ -256,6 +261,7 @@ void Serialize::serialize(QByteArray &data, const QV4::Value &v, ExecutionEngine
return;
}
+#endif
// regular object
QV4::ScopedValue val(scope, v);
@@ -369,6 +375,7 @@ ReturnedValue Serialize::deserialize(const char *&data, ExecutionEngine *engine)
agent->setEngine(engine);
return rv->asReturnedValue();
}
+#if QT_CONFIG(qml_sequence_object)
case WorkerSequence:
{
ScopedValue value(scope);
@@ -387,6 +394,7 @@ ReturnedValue Serialize::deserialize(const char *&data, ExecutionEngine *engine)
QVariant seqVariant = QV4::SequencePrototype::toVariant(array, sequenceType, &succeeded);
return QV4::SequencePrototype::fromVariant(engine, seqVariant, &succeeded);
}
+#endif
}
Q_ASSERT(!"Unreachable");
return QV4::Encode::undefined();