aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-05-09 16:25:58 +0200
committerGunnar Sletta <gunnar.sletta@jollamobile.com>2014-05-10 11:53:47 +0200
commit66646dd8c37adb488a79ab274b2396a649674e6d (patch)
treeb0f5ac752a52cec3de1d47692e09295197622dcd /tools
parentda15ea0f3b5805db657f13060c21efa78f10cde2 (diff)
parentd82a17b929dd88fe76258b0f801beaa1b2ee343e (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: .qmake.conf src/plugins/accessible/quick/quick.pro src/quick/items/qquickpincharea.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp src/quick/scenegraph/qsgthreadedrenderloop.cpp Manually adjusted for TestHTTPServer constructor change: tests/auto/quick/qquickimage/tst_qquickimage.cpp Change-Id: I5e58a7c08ea92d6fc5e3bce98571c54f7b2ce08f
Diffstat (limited to 'tools')
-rw-r--r--tools/qml/main.cpp14
-rw-r--r--tools/qmlbundle/main.cpp3
-rw-r--r--tools/qmlimportscanner/main.cpp58
-rw-r--r--tools/qmlplugindump/main.cpp130
-rw-r--r--tools/qmlplugindump/qmlplugindump.pro4
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp2
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.cpp5
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.h2
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.cpp35
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.h2
-rw-r--r--tools/qmlscene/main.cpp21
-rw-r--r--tools/qmlscene/qmlscene.pro2
12 files changed, 160 insertions, 118 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 08095962be..3fa36ad8f7 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -351,11 +351,7 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory)
QStringList list = dir.entryList();
for (int i = 0; i < list.size(); ++i) {
QString qml = list.at(i);
- QFile f(dir.filePath(qml));
- f.open(QIODevice::ReadOnly);
- QByteArray data = f.readAll();
- QQmlComponent comp(&engine);
- comp.setData(data, QUrl());
+ QQmlComponent comp(&engine, dir.filePath(qml));
QObject *dummyData = comp.create();
if (comp.isError()) {
@@ -500,6 +496,10 @@ int main(int argc, char *argv[])
//Load files
LoadWatcher lw(&e, files.count());
+ // Load dummy data before loading QML-files
+ if (!dummyDir.isEmpty() && QFileInfo (dummyDir).isDir())
+ loadDummyDataFiles(e, dummyDir);
+
foreach (const QString &path, files) {
//QUrl::fromUserInput doesn't treat no scheme as relative file paths
QRegularExpression urlRe("[[:word:]]+://.*");
@@ -523,10 +523,6 @@ int main(int argc, char *argv[])
}
}
-
- if (!dummyDir.isEmpty() && QFileInfo (dummyDir).isDir())
- loadDummyDataFiles(e, dummyDir);
-
return app->exec();
}
diff --git a/tools/qmlbundle/main.cpp b/tools/qmlbundle/main.cpp
index 60d12e8574..d77db353e5 100644
--- a/tools/qmlbundle/main.cpp
+++ b/tools/qmlbundle/main.cpp
@@ -40,8 +40,9 @@
****************************************************************************/
#include <private/qqmlbundle_p.h>
-#include <private/qqmlscript_p.h>
#include <QtCore/QCoreApplication>
+#include <QtCore/QSet>
+#include <QtCore/QStringList>
#include <iostream>
static bool createBundle(const QString &fileName, const QStringList &fileNames)
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index d3c5c638e9..9ad315016f 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -43,7 +43,9 @@
#include <private/qqmljsparser_p.h>
#include <private/qqmljsast_p.h>
#include <private/qv4codegen_p.h>
+#include <private/qv4value_inl_p.h>
#include <private/qqmlpool_p.h>
+#include <private/qqmlirbuilder_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
@@ -238,38 +240,38 @@ QVariantList findQmlImportsInJavascriptFile(const QString &filePath)
QVariantList imports;
- // look for ".import Foo.Bar 2.0 as FooBar" lines
- do {
- QByteArray rawLine = file.readLine();
- QByteArray line = rawLine.simplified();
- if (line.simplified().startsWith(".import")) {
- QList<QByteArray> parts = line.split(' ');
-
- if (parts.count() < 2)
- continue;
-
- QVariantMap import;
- QByteArray name = parts.at(1);
- QByteArray version = parts.at(2);
-
- // handle import cases: .js file, diriectory (check for precense of "/"),
- // and module (the most common case)
- if (name.contains(".js")) {
- import[QStringLiteral("type")] = QStringLiteral("javascript");
- import[QStringLiteral("path")] = name;
- } else if (name.contains("/")) {
- import[QStringLiteral("type")] = QStringLiteral("directory");
- import[QStringLiteral("path")] = name;
+ QString sourceCode = QString::fromUtf8(file.readAll());
+ file.close();
+ QmlIR::Document doc(/*debug mode*/false);
+ QQmlJS::DiagnosticMessage error;
+ doc.extractScriptMetaData(sourceCode, &error);
+ if (!error.message.isEmpty())
+ return imports;
+
+ foreach (const QV4::CompiledData::Import *import, doc.imports) {
+ QVariantMap entry;
+ const QString name = doc.stringAt(import->uriIndex);
+ switch (import->type) {
+ case QV4::CompiledData::Import::ImportScript:
+ entry[QStringLiteral("type")] = QStringLiteral("javascript");
+ entry[QStringLiteral("path")] = name;
+ break;
+ case QV4::CompiledData::Import::ImportLibrary:
+ if (name.contains(QLatin1Char('/'))) {
+ entry[QStringLiteral("type")] = QStringLiteral("directory");
+ entry[QStringLiteral("name")] = name;
} else {
- import[QStringLiteral("type")] = QStringLiteral("module");
- import[QStringLiteral("name")] = name;
- import[QStringLiteral("version")] = version;
+ entry[QStringLiteral("type")] = QStringLiteral("module");
+ entry[QStringLiteral("name")] = name;
+ entry[QStringLiteral("version")] = QString::number(import->majorVersion) + QLatin1Char('.') + QString::number(import->minorVersion);
}
-
- imports.append(import);
+ break;
+ default:
+ Q_UNREACHABLE();
+ continue;
}
+ imports << entry;
}
- while (file.canReadLine());
return imports;
}
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 1b4e2a3b94..bc55c40434 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -317,6 +317,29 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
return metas;
}
+class KnownAttributes {
+ QHash<QByteArray, int> m_properties;
+ QHash<QByteArray, QHash<int, int> > m_methods;
+public:
+ bool knownMethod(const QByteArray &name, int nArgs, int revision)
+ {
+ if (m_methods.contains(name)) {
+ QHash<int, int> overloads = m_methods.value(name);
+ if (overloads.contains(nArgs) && overloads.value(nArgs) <= revision)
+ return true;
+ }
+ m_methods[name][nArgs] = revision;
+ return false;
+ }
+
+ bool knownProperty(const QByteArray &name, int revision)
+ {
+ if (m_properties.contains(name) && m_properties.value(name) <= revision)
+ return true;
+ m_properties[name] = revision;
+ return false;
+ }
+};
class Dumper
{
@@ -350,12 +373,15 @@ public:
return exportString;
}
- void writeMetaContent(const QMetaObject *meta)
+ void writeMetaContent(const QMetaObject *meta, KnownAttributes *knownAttributes = 0)
{
QSet<QString> implicitSignals;
for (int index = meta->propertyOffset(); index < meta->propertyCount(); ++index) {
const QMetaProperty &property = meta->property(index);
- dump(property);
+ dump(property, knownAttributes);
+ if (knownAttributes)
+ knownAttributes->knownMethod(QByteArray(property.name()).append("Changed"),
+ 0, property.revision());
implicitSignals.insert(QString("%1Changed").arg(QString::fromUtf8(property.name())));
}
@@ -368,38 +394,52 @@ public:
|| signature == QByteArrayLiteral("destroyed()")
|| signature == QByteArrayLiteral("deleteLater()"))
continue;
- dump(method, implicitSignals);
+ dump(method, implicitSignals, knownAttributes);
}
// and add toString(), destroy() and destroy(int)
- qml->writeStartObject(QLatin1String("Method"));
- qml->writeScriptBinding(QLatin1String("name"), enquote(QLatin1String("toString")));
- qml->writeEndObject();
- qml->writeStartObject(QLatin1String("Method"));
- qml->writeScriptBinding(QLatin1String("name"), enquote(QLatin1String("destroy")));
- qml->writeEndObject();
- qml->writeStartObject(QLatin1String("Method"));
- qml->writeScriptBinding(QLatin1String("name"), enquote(QLatin1String("destroy")));
- qml->writeStartObject(QLatin1String("Parameter"));
- qml->writeScriptBinding(QLatin1String("name"), enquote(QLatin1String("delay")));
- qml->writeScriptBinding(QLatin1String("type"), enquote(QLatin1String("int")));
- qml->writeEndObject();
- qml->writeEndObject();
+ if (!knownAttributes || !knownAttributes->knownMethod(QByteArray("toString"), 0, 0)) {
+ qml->writeStartObject(QLatin1String("Method"));
+ qml->writeScriptBinding(QLatin1String("name"), enquote(QLatin1String("toString")));
+ qml->writeEndObject();
+ }
+ if (!knownAttributes || !knownAttributes->knownMethod(QByteArray("destroy"), 0, 0)) {
+ qml->writeStartObject(QLatin1String("Method"));
+ qml->writeScriptBinding(QLatin1String("name"), enquote(QLatin1String("destroy")));
+ qml->writeEndObject();
+ }
+ if (!knownAttributes || !knownAttributes->knownMethod(QByteArray("destroy"), 1, 0)) {
+ qml->writeStartObject(QLatin1String("Method"));
+ qml->writeScriptBinding(QLatin1String("name"), enquote(QLatin1String("destroy")));
+ qml->writeStartObject(QLatin1String("Parameter"));
+ qml->writeScriptBinding(QLatin1String("name"), enquote(QLatin1String("delay")));
+ qml->writeScriptBinding(QLatin1String("type"), enquote(QLatin1String("int")));
+ qml->writeEndObject();
+ qml->writeEndObject();
+ }
} else {
for (int index = meta->methodOffset(); index < meta->methodCount(); ++index)
- dump(meta->method(index), implicitSignals);
+ dump(meta->method(index), implicitSignals, knownAttributes);
}
}
- QString getPrototypeNameForCompositeType(const QMetaObject *metaObject, QSet<QByteArray> &defaultReachableNames)
+ QString getPrototypeNameForCompositeType(const QMetaObject *metaObject, QSet<QByteArray> &defaultReachableNames,
+ QList<const QMetaObject *> *objectsToMerge)
{
QString prototypeName;
if (!defaultReachableNames.contains(metaObject->className())) {
+ // dynamic meta objects can break things badly
+ // but extended types are usually fine
+ const QMetaObjectPrivate *mop = reinterpret_cast<const QMetaObjectPrivate *>(metaObject->d.data);
+ if (!(mop->flags & DynamicMetaObject) && objectsToMerge
+ && !objectsToMerge->contains(metaObject))
+ objectsToMerge->append(metaObject);
const QMetaObject *superMetaObject = metaObject->superClass();
if (!superMetaObject)
prototypeName = "QObject";
else
- prototypeName = getPrototypeNameForCompositeType(superMetaObject, defaultReachableNames);
+ prototypeName = getPrototypeNameForCompositeType(
+ superMetaObject, defaultReachableNames, objectsToMerge);
} else {
prototypeName = convertToId(metaObject->className());
}
@@ -418,8 +458,11 @@ public:
const QMetaObject *mainMeta = object->metaObject();
+ QList<const QMetaObject *> objectsToMerge;
+ KnownAttributes knownAttributes;
// Get C++ base class name for the composite type
- QString prototypeName = getPrototypeNameForCompositeType(mainMeta, defaultReachableNames);
+ QString prototypeName = getPrototypeNameForCompositeType(mainMeta, defaultReachableNames,
+ &objectsToMerge);
qml->writeScriptBinding(QLatin1String("prototype"), enquote(prototypeName));
QString qmlTyName = compositeType->qmlTypeName();
@@ -430,11 +473,10 @@ public:
qml->writeArrayBinding(QLatin1String("exportMetaObjectRevisions"), QStringList() << QString::number(compositeType->minorVersion()));
qml->writeBooleanBinding(QLatin1String("isComposite"), true);
- if (!compositeType->isCreatable())
+ if (compositeType->isSingleton()) {
qml->writeBooleanBinding(QLatin1String("isCreatable"), false);
-
- if (compositeType->isSingleton())
qml->writeBooleanBinding(QLatin1String("isSingleton"), true);
+ }
for (int index = mainMeta->classInfoCount() - 1 ; index >= 0 ; --index) {
QMetaClassInfo classInfo = mainMeta->classInfo(index);
@@ -444,25 +486,8 @@ public:
}
}
- QSet<const QMetaObject *> metas;
- QSet<const QMetaObject *> candidatesComposite;
- collectReachableMetaObjects(mainMeta, &candidatesComposite);
-
- // Also eliminate meta objects with the same classname.
- // This is required because extended objects seem not to share
- // a single meta object instance.
- foreach (const QMetaObject *mo, candidatesComposite) {
- if (!defaultReachableNames.contains(mo->className()))
- metas.insert(mo);
- }
-
- // put the metaobjects into a map so they are always dumped in the same order
- QMap<QString, const QMetaObject *> nameToMeta;
- foreach (const QMetaObject *meta, metas)
- nameToMeta.insert(convertToId(meta), meta);
-
- foreach (const QMetaObject *meta, nameToMeta)
- writeMetaContent(meta);
+ foreach (const QMetaObject *meta, objectsToMerge)
+ writeMetaContent(meta, &knownAttributes);
qml->writeEndObject();
}
@@ -580,21 +605,23 @@ private:
qml->writeScriptBinding(QLatin1String("isPointer"), QLatin1String("true"));
}
- void dump(const QMetaProperty &prop)
+ void dump(const QMetaProperty &prop, KnownAttributes *knownAttributes = 0)
{
+ int revision = prop.revision();
+ QByteArray propName = prop.name();
+ if (knownAttributes && knownAttributes->knownProperty(propName, revision))
+ return;
qml->writeStartObject("Property");
-
qml->writeScriptBinding(QLatin1String("name"), enquote(QString::fromUtf8(prop.name())));
-#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 4))
- if (int revision = prop.revision())
+ if (revision)
qml->writeScriptBinding(QLatin1String("revision"), QString::number(revision));
-#endif
writeTypeProperties(prop.typeName(), prop.isWritable());
qml->writeEndObject();
}
- void dump(const QMetaMethod &meth, const QSet<QString> &implicitSignals)
+ void dump(const QMetaMethod &meth, const QSet<QString> &implicitSignals,
+ KnownAttributes *knownAttributes = 0)
{
if (meth.methodType() == QMetaMethod::Signal) {
if (meth.access() != QMetaMethod::Public)
@@ -615,6 +642,9 @@ private:
return;
}
+ int revision = meth.revision();
+ if (knownAttributes && knownAttributes->knownMethod(name, meth.parameterNames().size(), revision))
+ return;
if (meth.methodType() == QMetaMethod::Signal)
qml->writeStartObject(QLatin1String("Signal"));
else
@@ -622,10 +652,8 @@ private:
qml->writeScriptBinding(QLatin1String("name"), enquote(name));
-#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 4))
- if (int revision = meth.revision())
+ if (revision)
qml->writeScriptBinding(QLatin1String("revision"), QString::number(revision));
-#endif
if (typeName != QLatin1String("void"))
qml->writeScriptBinding(QLatin1String("type"), enquote(typeName));
diff --git a/tools/qmlplugindump/qmlplugindump.pro b/tools/qmlplugindump/qmlplugindump.pro
index 67af71c59f..6fdcd349d1 100644
--- a/tools/qmlplugindump/qmlplugindump.pro
+++ b/tools/qmlplugindump/qmlplugindump.pro
@@ -1,6 +1,8 @@
QT += qml qml-private quick-private core-private
-CONFIG += no_import_scan qpa_minimal_plugin
+CONFIG += no_import_scan
+
+QTPLUGIN.platforms = qminimal
SOURCES += \
main.cpp \
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index 6c3e697f56..4c05fe8d64 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -108,7 +108,7 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
&m_profilerData, SLOT(addQmlEvent(QQmlProfilerService::RangeType,QQmlProfilerService::BindingType,qint64,qint64,QStringList,QmlEventLocation)));
connect(&m_qmlProfilerClient, SIGNAL(traceFinished(qint64)), &m_profilerData, SLOT(setTraceEndTime(qint64)));
connect(&m_qmlProfilerClient, SIGNAL(traceStarted(qint64)), &m_profilerData, SLOT(setTraceStartTime(qint64)));
- connect(&m_qmlProfilerClient, SIGNAL(frame(qint64,int,int)), &m_profilerData, SLOT(addFrameEvent(qint64,int,int)));
+ connect(&m_qmlProfilerClient, SIGNAL(frame(qint64,int,int,int)), &m_profilerData, SLOT(addFrameEvent(qint64,int,int,int)));
connect(&m_qmlProfilerClient, SIGNAL(complete()), this, SLOT(qmlComplete()));
connect(&m_v8profilerClient, SIGNAL(enabledChanged()), this, SLOT(profilerClientEnabled()));
diff --git a/tools/qmlprofiler/qmlprofilerclient.cpp b/tools/qmlprofiler/qmlprofilerclient.cpp
index 25557af77f..23a75d0576 100644
--- a/tools/qmlprofiler/qmlprofilerclient.cpp
+++ b/tools/qmlprofiler/qmlprofilerclient.cpp
@@ -174,8 +174,11 @@ void QmlProfilerClient::messageReceived(const QByteArray &data)
d->maximumTime = qMax(time, d->maximumTime);
} else if (event == QQmlProfilerService::AnimationFrame) {
int frameRate, animationCount;
+ int threadId = 0;
stream >> frameRate >> animationCount;
- emit this->frame(time, frameRate, animationCount);
+ if (!stream.atEnd())
+ stream >> threadId;
+ emit this->frame(time, frameRate, animationCount, threadId);
d->maximumTime = qMax(time, d->maximumTime);
} else if (event == QQmlProfilerService::StartTrace) {
emit this->traceStarted(time);
diff --git a/tools/qmlprofiler/qmlprofilerclient.h b/tools/qmlprofiler/qmlprofilerclient.h
index e0bba0b660..29492c49ff 100644
--- a/tools/qmlprofiler/qmlprofilerclient.h
+++ b/tools/qmlprofiler/qmlprofilerclient.h
@@ -102,7 +102,7 @@ signals:
qint64 startTime, qint64 length,
const QStringList &data,
const QmlEventLocation &location);
- void frame(qint64 time, int frameRate, int animationCount);
+ void frame(qint64 time, int frameRate, int animationCount, int threadId);
protected:
virtual void messageReceived(const QByteArray &);
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp
index 038d2177f9..00dc09901f 100644
--- a/tools/qmlprofiler/qmlprofilerdata.cpp
+++ b/tools/qmlprofiler/qmlprofilerdata.cpp
@@ -56,6 +56,9 @@ namespace Constants {
const char TYPE_BINDING_STR[] = "Binding";
const char TYPE_HANDLINGSIGNAL_STR[] = "HandlingSignal";
const char PROFILER_FILE_VERSION[] = "1.02";
+
+ // Save animation frames in "Qt5 style", 3 would mean Qt4
+ const int ANIMATION_FRAME_TYPE = 4;
}
struct QmlRangeEventData {
@@ -79,14 +82,15 @@ struct QmlRangeEventData {
struct QmlRangeEventStartInstance {
QmlRangeEventStartInstance() {} // never called
QmlRangeEventStartInstance(qint64 _startTime, qint64 _duration, int _frameRate,
- int _animationCount, QmlRangeEventData *_data)
+ int _animationCount, int _threadId, QmlRangeEventData *_data)
: startTime(_startTime), duration(_duration), frameRate(_frameRate),
- animationCount(_animationCount), data(_data)
+ animationCount(_animationCount), threadId(_threadId), data(_data)
{ }
qint64 startTime;
qint64 duration;
int frameRate;
int animationCount;
+ int threadId;
QmlRangeEventData *data;
};
@@ -122,7 +126,6 @@ public:
qint64 traceEndTime;
// internal state while collecting events
- QmlRangeEventStartInstance *lastFrameEvent;
qint64 qmlMeasuredTime;
qint64 v8MeasuredTime;
QHash<int, QV8EventInfo *> v8parents;
@@ -162,8 +165,6 @@ void QmlProfilerData::clear()
d->traceStartTime = -1;
d->qmlMeasuredTime = 0;
- d->lastFrameEvent = 0;
-
setState(Empty);
}
@@ -271,12 +272,12 @@ void QmlProfilerData::addQmlEvent(QQmlProfilerService::RangeType type,
d->eventDescriptions.insert(eventHashStr, newEvent);
}
- QmlRangeEventStartInstance rangeEventStartInstance(startTime, duration, 1e9/duration, -1, newEvent);
+ QmlRangeEventStartInstance rangeEventStartInstance(startTime, duration, -1, -1, -1, newEvent);
d->startInstanceList.append(rangeEventStartInstance);
}
-void QmlProfilerData::addFrameEvent(qint64 time, int framerate, int animationcount)
+void QmlProfilerData::addFrameEvent(qint64 time, int framerate, int animationcount, int threadId)
{
setState(AcquiringData);
@@ -292,18 +293,10 @@ void QmlProfilerData::addFrameEvent(qint64 time, int framerate, int animationcou
d->eventDescriptions.insert(eventHashStr, newEvent);
}
- qint64 duration = 1e9/framerate;
- // avoid overlap
- if (d->lastFrameEvent &&
- d->lastFrameEvent->startTime + d->lastFrameEvent->duration >= time) {
- d->lastFrameEvent->duration = time - 1 - d->lastFrameEvent->startTime;
- }
-
- QmlRangeEventStartInstance rangeEventStartInstance(time, duration, framerate, animationcount, newEvent);
+ QmlRangeEventStartInstance rangeEventStartInstance(time, -1, framerate, animationcount,
+ threadId, newEvent);
d->startInstanceList.append(rangeEventStartInstance);
-
- d->lastFrameEvent = &d->startInstanceList.last();
}
QString QmlProfilerData::rootEventName()
@@ -502,6 +495,9 @@ bool QmlProfilerData::save(const QString &filename)
stream.writeTextElement(QStringLiteral("details"), eventData->details);
if (eventData->eventType == QQmlProfilerService::Binding)
stream.writeTextElement(QStringLiteral("bindingType"), QString::number((int)eventData->bindingType));
+ else if (eventData->eventType == QQmlProfilerService::Painting)
+ stream.writeTextElement(QStringLiteral("animationFrame"),
+ QString::number(Constants::ANIMATION_FRAME_TYPE));
stream.writeEndElement();
}
stream.writeEndElement(); // eventData
@@ -510,12 +506,15 @@ bool QmlProfilerData::save(const QString &filename)
foreach (const QmlRangeEventStartInstance &rangedEvent, d->startInstanceList) {
stream.writeStartElement(QStringLiteral("range"));
stream.writeAttribute(QStringLiteral("startTime"), QString::number(rangedEvent.startTime));
- stream.writeAttribute(QStringLiteral("duration"), QString::number(rangedEvent.duration));
+ if (rangedEvent.duration >= 0)
+ stream.writeAttribute(QStringLiteral("duration"),
+ QString::number(rangedEvent.duration));
stream.writeAttribute(QStringLiteral("eventIndex"), QString::number(d->eventDescriptions.keys().indexOf(rangedEvent.data->eventHashStr)));
if (rangedEvent.data->eventType == QQmlProfilerService::Painting && rangedEvent.animationCount >= 0) {
// animation frame
stream.writeAttribute(QStringLiteral("framerate"), QString::number(rangedEvent.frameRate));
stream.writeAttribute(QStringLiteral("animationcount"), QString::number(rangedEvent.animationCount));
+ stream.writeAttribute(QStringLiteral("thread"), QString::number(rangedEvent.threadId));
}
stream.writeEndElement();
}
diff --git a/tools/qmlprofiler/qmlprofilerdata.h b/tools/qmlprofiler/qmlprofilerdata.h
index 134e7228af..a5d55ed6f6 100644
--- a/tools/qmlprofiler/qmlprofilerdata.h
+++ b/tools/qmlprofiler/qmlprofilerdata.h
@@ -88,7 +88,7 @@ public slots:
const QmlEventLocation &location);
void addV8Event(int depth, const QString &function, const QString &filename,
int lineNumber, double totalTime, double selfTime);
- void addFrameEvent(qint64 time, int framerate, int animationcount);
+ void addFrameEvent(qint64 time, int framerate, int animationcount, int threadId);
void complete();
bool save(const QString &filename);
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index fcf89afb9f..7512b5482f 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -58,6 +58,7 @@
#include <QtQuick/qquickview.h>
#include <private/qabstractanimation_p.h>
+#include <private/qopenglcontext_p.h>
#ifdef QT_WIDGETS_LIB
#include <QtWidgets/QApplication>
@@ -155,6 +156,7 @@ struct Options
, quitImmediately(false)
, resizeViewToRootItem(false)
, multisample(false)
+ , contextSharing(true)
{
}
@@ -171,6 +173,7 @@ struct Options
bool quitImmediately;
bool resizeViewToRootItem;
bool multisample;
+ bool contextSharing;
QString translationFile;
};
@@ -323,11 +326,7 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory)
QStringList list = dir.entryList();
for (int i = 0; i < list.size(); ++i) {
QString qml = list.at(i);
- QFile f(dir.filePath(qml));
- f.open(QIODevice::ReadOnly);
- QByteArray data = f.readAll();
- QQmlComponent comp(&engine);
- comp.setData(data, QUrl());
+ QQmlComponent comp(&engine, dir.filePath(qml));
QObject *dummyData = comp.create();
if(comp.isError()) {
@@ -358,6 +357,7 @@ static void usage()
qWarning(" --slow-animations ......................... Run all animations in slow motion");
qWarning(" --resize-to-root .......................... Resize the window to the size of the root item");
qWarning(" --quit .................................... Quit immediately after starting");
+ qWarning(" --disable-context-sharing ................. Disable the use of a shared GL context for QtQuick Windows");
qWarning(" -I <path> ................................. Add <path> to the list of import paths");
qWarning(" -B <name> <file> .......................... Add a named bundle");
qWarning(" -translation <translationfile> ............ Set the language to run in");
@@ -397,6 +397,8 @@ int main(int argc, char ** argv)
options.resizeViewToRootItem = true;
else if (lowerArgument == QLatin1String("--multisample"))
options.multisample = true;
+ else if (lowerArgument == QLatin1String("--disable-context-sharing"))
+ options.contextSharing = false;
else if (lowerArgument == QLatin1String("-i") && i + 1 < argc)
imports.append(QString::fromLatin1(argv[++i]));
else if (lowerArgument == QLatin1String("-b") && i + 2 < argc) {
@@ -452,6 +454,15 @@ int main(int argc, char ** argv)
displayFileDialog(&options);
#endif
+ // QWebEngine needs a shared context in order for the GPU thread to
+ // upload textures.
+ QScopedPointer<QOpenGLContext> shareContext;
+ if (options.contextSharing) {
+ shareContext.reset(new QOpenGLContext);
+ shareContext->create();
+ QOpenGLContextPrivate::setGlobalShareContext(shareContext.data());
+ }
+
int exitCode = 0;
if (!options.file.isEmpty()) {
diff --git a/tools/qmlscene/qmlscene.pro b/tools/qmlscene/qmlscene.pro
index 07208ea703..0411fd8e31 100644
--- a/tools/qmlscene/qmlscene.pro
+++ b/tools/qmlscene/qmlscene.pro
@@ -1,4 +1,4 @@
-QT += qml quick core-private
+QT += qml quick quick-private gui-private core-private
qtHaveModule(widgets): QT += widgets
CONFIG += no_import_scan