forked from qt-creator/qt-creator
Qml/C++: Fix performance problem with type extraction.
By moving the offending code into a background thread. Reviewed-by: Erik Verbruggen
This commit is contained in:
@@ -1944,7 +1944,6 @@ const Value *Function::invoke(const Activation *activation) const
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QList<FakeMetaObject::ConstPtr> CppQmlTypesLoader::builtinObjects;
|
||||
QList<FakeMetaObject::ConstPtr> CppQmlTypesLoader::cppObjects;
|
||||
|
||||
QStringList CppQmlTypesLoader::load(const QFileInfoList &xmlFiles)
|
||||
{
|
||||
@@ -2438,7 +2437,6 @@ Engine::Engine()
|
||||
initializePrototypes();
|
||||
|
||||
_cppQmlTypes.load(this, CppQmlTypesLoader::builtinObjects);
|
||||
_cppQmlTypes.load(this, CppQmlTypesLoader::cppObjects);
|
||||
|
||||
// the 'Qt' object is dumped even though it is not exported
|
||||
// it contains useful information, in particular on enums - add the
|
||||
|
||||
@@ -587,7 +587,6 @@ public:
|
||||
/** \return an empty list when successful, error messages otherwise. */
|
||||
static QStringList load(const QFileInfoList &xmlFiles);
|
||||
static QList<LanguageUtils::FakeMetaObject::ConstPtr> builtinObjects;
|
||||
static QList<LanguageUtils::FakeMetaObject::ConstPtr> cppObjects;
|
||||
|
||||
// parses the xml string and fills the newObjects map
|
||||
static QString parseQmlTypeXml(const QByteArray &xml,
|
||||
|
||||
@@ -120,6 +120,14 @@ Link::Link(Context *context, const Document::Ptr &doc, const Snapshot &snapshot,
|
||||
d->snapshot = snapshot;
|
||||
d->importPaths = importPaths;
|
||||
|
||||
// populate engine with types from C++
|
||||
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
||||
if (modelManager) {
|
||||
foreach (const QList<FakeMetaObject::ConstPtr> &cppTypes, modelManager->cppQmlTypes()) {
|
||||
engine()->cppQmlTypes().load(engine(), cppTypes);
|
||||
}
|
||||
}
|
||||
|
||||
linkImports();
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,8 @@ public:
|
||||
Table _elements;
|
||||
};
|
||||
|
||||
typedef QHash<QString, QList<LanguageUtils::FakeMetaObject::ConstPtr> > CppQmlTypeHash;
|
||||
|
||||
public:
|
||||
ModelManagerInterface(QObject *parent = 0);
|
||||
virtual ~ModelManagerInterface();
|
||||
@@ -132,6 +134,8 @@ public:
|
||||
|
||||
virtual void loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri) = 0;
|
||||
|
||||
virtual CppQmlTypeHash cppQmlTypes() const = 0;
|
||||
|
||||
signals:
|
||||
void documentUpdated(QmlJS::Document::Ptr doc);
|
||||
void documentChangedOnDisk(QmlJS::Document::Ptr doc);
|
||||
|
||||
Reference in New Issue
Block a user