aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtDeclarative fixes and workarounds for NaClwip/naclMorten Johan Sørvig2016-05-131-0/+5
| | | | | | | | | | | Make QtDeclarative run on Native Client. Some of these should be looked at more closely at a later point in time, but will do as workarounds from now. Change-Id: Ifddcb45b190c3a80c6137772a05ababb5466ea22 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* qml: preserve composite singleton types.Marco Benelli2015-12-171-2/+2
| | | | | | | | Composite singleton types used to always have version -1,-1; regardless of what is written in qmldir. Change-Id: Ia193e73695e57095f6a09b97768805f2f23cd56a Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Load component synchronously in method_createQmlObjectUlf Hermann2015-11-031-65/+84
| | | | | | | | | | | setData() is not guaranteed to synchronously load the type. In fact, most of the time, it doesn't. However, by adding a private Synchronous mode to QQmlTypeLoader we can prefetch the type synchronously and then inject it into the component. Task-number: QTBUG-45418 Change-Id: I640f12ad20c01b778b5bc41f43574d8aea504195 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix function signatureLars Knoll2015-09-221-9/+8
| | | | | | | Returning a PersistentValue doesn't make much sense. Change-Id: I6044a12e48aa835ef78008e070bacda5125a7ca7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Smaller cleanupLars Knoll2015-09-091-3/+2
| | | | | | | Move the takeContextOwnership method over to the QmlContext. Change-Id: I9330b31a0cb079b1c7e68a00236a69e25ed2c5af Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Pass a QmlContext to QV4::Script instead of a contextwrapperLars Knoll2015-09-091-4/+5
| | | | | Change-Id: Ia8db166aacbbe6e8f588179dffa04e2dce9566cb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix profiling of QML/JS compilationUlf Hermann2015-08-241-2/+6
| | | | | | | | | | | | | | | | | | | The compilation of .js resources was missed and the compile times were underestimated because the dependency resolution and error checking wasn't factored in. In particular we only profiled the done() step for QQmlTypeData. However, JavaScript compilation also occurs in the dataReceived() step of QQmlScriptBlob and QQmlTypeData will already parse the program into an AST at that step. Compile steps can be nested now, but considering the fact that significant time may be spent before and after compiling dependencies for a parent module, this seems to be the best way to model them. Furthermore, in order to not needlessly convert QUrl to QString at runtime, the compilation profiler saves the files now as QUrl. Change-Id: I215a87787f9117c069ecd77b2d913cc0b0ff3c89 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Force completion of asynchronously loaded components.Robert Griebl2015-06-231-0/+14
| | | | | | | | | [ChangeLog][QtQuick][QQmlComponent] Synchronously complete the loading of a Asynchronous QQmlComponent, if a PreferSynchronous QQmlComponent is created for the same url (given that this url does support synchronous loading). Change-Id: I3291d0569a69bac2aeb4815f1068a426ef2707ef Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Smaller cleanup in the context wrapperLars Knoll2015-06-181-2/+2
| | | | | Change-Id: If9f8139cdb67bd7a1179d8b1ab18bde04e3b2fbb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix to debug flag DATABLOB_DEBUGTuomas Heimonen2015-06-171-1/+1
| | | | | Change-Id: I65ea0283c643371f3debd4a29a5fe4dbcb1c642c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Add 28 QList::reserve() callsSérgio Martins2015-06-081-0/+1
| | | | | Change-Id: Id4820ac458f48b10f2bf457144767efdef9e2c07 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Some cleanups to QQmlRefCountLars Knoll2015-06-051-1/+1
| | | | | | | | | Rename QQmlRefPointer::take to adopt, as it's a better fit with the semantics. Get rid of the assignment operator from a raw pointer and add a Adopt argument to the constructor. Change-Id: Ia1ebe42b24570f32543e783f91eb3206602772a2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Speed up object creationSimon Hausmann2015-04-161-2/+2
| | | | | | | | Avoid copying url and file name twice into the context every time we instantiate an object. Change-Id: I1c76b80b9c44f95512af5899d760151f6dcd7bb5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QtQml: Micro-optimize iterator loops.Friedemann Kleint2015-02-261-4/+4
| | | | | | | Avoid repeated instantiation of end() in loops, use variable instead. Change-Id: I3bb1c6918cfd16a5dcefbcc03c442e99fe9bf76b Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-241-4/+7
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf LICENSE.GPLv2 examples/qml/networkaccessmanagerfactory/view.qml src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4stringobject.cpp Change-Id: I5d12f436d60995e51d5c2f59d364e9cbc24f8e32
| * Fix crash when invalidating qqmltypeloaderDaiwei Li2015-02-061-4/+7
| | | | | | | | | | | | Change-Id: I16db2ea9a6c25d26e2b803b9bb8d9ef7156e254d Reviewed-by: Gunnar Sletta <gunnar@sletta.org> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* | Typeloader cleanupSimon Hausmann2015-01-231-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QQmlDataBlob base class had a typeloader member that was provided with startLoading() later, just to allow calling the url interceptor. The one sub-class of QQmlDataBlob - QQmlTypeLoader::Blob - also had a typeloader pointer, provided at constructor time. This patch cleans this up by removing the duplicated typeloader pointer in the sub-class and passing it straight through to the base-class at construction type. This also allows moving the url interception to the constructor. Also fixed the findCachedCompilationUnit calls to use the url after applying the intercept and removed one unnecessary findCachedCompilationUnit call - the QFile::exists call is sufficient. Change-Id: If5c49d38a6ec66fea6cd7c21013c046cf75acafd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Get rid of most uses of ValueRefLars Knoll2015-01-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Make sure we always have an engine when assigning to a PersistentLars Knoll2015-01-131-3/+3
| | | | | | | | | | | | | | This prepares things for a rewrite of the internals of Persistent. Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Clean up JS .import/.pragma directive scanningSimon Hausmann2015-01-081-12/+5
| | | | | | | | | | | | | | | | | | | | | | There's a scanner in QQmlJS::Lexer::scanDirectives that can parse those, so let's get rid of extra parser that operates on a string. Instead this way we can do the scanning all in one shot, avoid detaching a copy of the source code string and (most importantly) bring the parser closer to the copy in Qt Creator, which uses the directives approach to extract imports and pragma. Change-Id: Iff6eb8d91a45d8a70f383f953115692be48259de Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
* | Remove qv8engine usage in the contextwrapperLars Knoll2015-01-081-2/+1
| | | | | | | | | | Change-Id: Iaf807add5d971e96cac57e38e13385e901f9c930 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Do not cause SegFault when importing empty javascriptNobuaki Sukegawa2015-01-021-0/+8
| | | | | | | | | | Change-Id: I31f6571e73b5dd74bf3ade5cadc2daa02475b5cb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove QML bundle codeSimon Hausmann2014-12-121-122/+20
| | | | | | | | | | | | | | | | | | | | This feature is effectively not maintained, experimental and undocumented. Consensus on the mailing list is to remove it: http://lists.qt-project.org/pipermail/development/2014-December/019384.html Change-Id: Iaa73b3e90806c338ef81bbd4307ddd2addd37964 Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* | Cleanup: Merge QQmlDataLoader and QQmlTypeLoaderSimon Hausmann2014-12-091-92/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There exists only one sub-class of QQmlDataLoader and there are no virtual functions. This also clears up a confusion reported in Jira that suggested QQmlDataLoader should get a virtual destructor as it is being subclassed and somebody might have a pointer only to a QQmlDataLoader and deleting that would not do proper polymorphic destruction. Change-Id: I34611be5a95522bc85a87fb7df97b6d1de7a3d37 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
* | Cleanup exception catching codeLars Knoll2014-11-151-2/+1
|/ | | | | Change-Id: I85afd5758f72e19c280dc196601ee145f0c25f01 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix QQmlExpression/QQmlScriptString/QQmlBinding crashesSimon Hausmann2014-10-091-13/+2
| | | | | | | | | | | | | | | | | | | | | | | | In the QQmlScriptString we store the binding id and it is an index into the runtimeFunctions array of the compilation unit. However we don't store the compilation unit and instead in QQmlBinding and QQmlExpression try to retrieve it from the cache via the context url (we have the context after all). That turns out to be not a reliable way, as sometimes the URL might slightly differ from the originally compiled cache (qrc:/// turning to qrc:/ maybe). Consequently the type is (unnecessarily) compiled again and unfortunately not _linked_, therefore the runtime functions array is empty. Another option is that when the component was created from a QByteArray, then no entry exists in the cache in the first place. This patch addresses the problem by storing a reference to the compilation unit in the QQmlContextData. That we can safely retrieve and it'll make sure the compilation unit also stays alive. In the process of that the manual reference counting was switched over to QQmlRefCount and QQmlRefPointer for QV4::CompilationUnit. Task-number: QTBUG-41193 Change-Id: I9111f9a3b65618e453954abcd789c039e65a94f7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Don't start QQmlThreads from their constructorUlf Hermann2014-09-161-0/+2
| | | | | | | | | | In the case of derived classes (like the only user of QQmlThread) we cannot guarantee that the class is completely constructed when the thread starts. This includes the vtable which is necessary to decide which virtual functions to call. Change-Id: Ieaea67a72cc3b4f845b8621b34ca2928185917fb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add new property "designersupported" to qmldirTim Jenssen2014-08-281-0/+4
| | | | | | | | | | | | | | | | | This patch adds a property called "designersupported" to qmldir. This allows the Qt Quick Designer to only load plugins that have the line ""designersupported"" in their qmldir file. So the designer can load sub components without risking to load plugins that have never been tested in the designer and that might crash. The check for "designersupported"" is activated by using QQmlImports::setDesignerSupportRequired(). Change-Id: I4bf07cc163faa47996eacb1365a7961c51c51060 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com> Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Simon Hausmann2014-08-261-3/+16
|\ | | | | | | | | | | Conflicts: src/qml/qml/qqmlobjectcreator_p.h Change-Id: I60858ddb46866a8fa1a8576bb05b412afeeb4e41
| * Fix crash with recursively loading cached compilation unitsSimon Hausmann2014-08-221-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When a cached compilation unit depends on an import that is implemented as a Qml C++ plugin and that plugin in turn loads an asynchronous component that is cached, we would get a crash in the typeloader and a failing assertion (ASSERT: "d->m_mainThreadWaiting == false" in file qml/ftw/qqmlthread.cpp, line 300) This is because we did not implement the asynchronous loading within the loader thread for cached compilation units. This is simply done using a posted event, using the same mechanism used for other async load methods. Change-Id: Iefce67ab634ce26122c348dcdfc8e66b00fec671 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* | CleanupSimon Hausmann2014-08-151-4/+3
| | | | | | | | | | | | | | | | | | Merge QV4::CompiledData::QmlUnit into QV4::CompiledData::Unit. For pure JS units it means a slight increase of memory usage by a few bytes, but overall it makes the code a lot simpler. Change-Id: Ib48927749720b056f004aac0fe22cb8ec729e3f6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Get rid of all uses of ObjectRefLars Knoll2014-07-221-1/+1
| | | | | | | | | | Change-Id: I705e2362dcda542f56826dadec6b0a6f15848788 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Avoid race condition in QQmlEngine on shutdown.Gunnar Sletta2014-07-041-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | The QQmlTypeLoader was deleted (and its thread shut down) when the QQmlEnginePrivate was destroyed. However, the QQmlTypeLoader runs a thread which would happiliy make calls on the engine and its managed data. Fix this by stopping the QQmlTypeLoader's thread right away in QQmlEngine. Task-number: QTBUG-39905 Change-Id: Ida8e95d083f79237c74b036fd3521133a9fa4ac7 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* | Cleanup: Get rid of the url and file name members in QQmlCompiledDataSimon Hausmann2014-06-051-4/+2
|/ | | | | | | | This is part of the effor of moving members from QQmlCompiledData into QV4::CompilationUnit in order to eliminate the former in the long run. Change-Id: Icce7fe0ee9a49cb3a7677fd7020008fc55ecdcf6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Extend the QML bootstrap library by the IR buildersSimon Hausmann2014-04-231-6/+19
| | | | | | | | | | | | | This is among other things needed to fix the qml import scanner to detect dependencies from .js files correctly. The patch also fixes the use of Q_QML_EXPORT towards Q_QML_PRIVATE_EXPORT where appropriate and corrects the wrong include path for the double conversion code to actually be relative to the file it is included from. This worked by accident because of other include paths present in the build. Change-Id: I338583dad2f76300819af8ab0dae8e5724c84430 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make it possible to supply compilation units from pluginsSimon Hausmann2014-03-291-36/+141
| | | | | | | | | This also cleans up the script and type initialization in the type loader, for example by getting rid of the m_irUnit member for scripts. Change-Id: I207afeb21c0bae9091d3c7b4cac2e80e9aae0ea3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Various cleanupsSimon Hausmann2014-03-281-16/+17
| | | | | | | | | | | | | * Encapsulate the string pooling for the V4 data generation into a StringGenerator class. * Move type reference collection into the IR::Document, where it belongs (as it writes into the typeReferences there) * const fixes * Remove unused methods and members * Store unit and qml unit sizes right in the generated data structure. That makes copying easier (like we do when generating the QML data based on the JS fields) Change-Id: I053146ab0b00cc90ac7f72f867415962d1be121b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup: Get rid of QQmlScript::TypeReferenceSimon Hausmann2014-03-191-9/+8
| | | | | Change-Id: I5f8b203ac71f0667947087bd2b1e7ce6d91d843d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* CleanupSimon Hausmann2014-03-191-97/+66
| | | | | | | | Get rid of QQmlScript::Import in favor of operating on QV4::CompiledData::Import structures throughout the type loader. Change-Id: I29de369373a3dc4fd8e7f30517b804edcce93e7a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up script importsSimon Hausmann2014-03-191-19/+43
| | | | | | | | | | Move the .pragma and .import script extraction out of qqmlscript and into qqmlirbuilder, where it can populate a QQmlIR::Document. Changed the script part of the type loader to use that, which also allowed eliminating the m_source member and m_metaData. Change-Id: Icc64d219fff5666679a02e6afda73f7edfca132b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean, part 3Simon Hausmann2014-03-191-32/+10
| | | | | | | | | | * Get rid of QQmlScript::Pragma * Allow retrieving the QML unit size after generation * Add flag equivalent of .pragma library to QV4::CompiledData * Remove unused method Change-Id: I2f95b83f919004013741bc539c82960cc878f3a4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup, part 2Simon Hausmann2014-03-181-51/+48
| | | | | | | | | | | * QQmlCodeGenerator -> QQmlIR::IRBuilder (it doesn't generate code, it generates the Object/Property/Signal/etc. IR of the .qml file, that's going to get transformed to QV4::CompiledData::*) * ParsedQML -> QQmlIR::Document Change-Id: I329e858487b66e1ae528d44316761f5dd34b79f4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Namespace cleanupSimon Hausmann2014-03-171-4/+4
| | | | | | | Move the QML IR types into the QmlIR namespace and clean them up. Change-Id: I2125449e5a519034e23670651efa620f405730b4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix QQmlTypeData object leakLiang Jian2014-03-131-0/+5
| | | | | | | | 1) unref QQmlTypeData object stored in m_compositeSingletons 2) unref QQmlTypeData object in resolveQmlType() Change-Id: I5f2e3a542637f62509c4a2f2ed8a6ba080eacf1b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove old compiler and VMESimon Hausmann2014-03-071-98/+15
| | | | | | | | | | | | This removes the bulk of the code. A few smaller cleanups remain, to be done in smaller changes as they move code around. Additionally the "optimize" option of qqmlbundle was removed. It called QQmlScript::Parser::preparseData, which however was not implemented and always returned an empty QByteArray. Therefore "optimize" would not do anything and the class is gone now :) Change-Id: I0c265e756704cb53c5250be1f69e4a3e1b6e64d5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix tst_qqmlengine::trimComponentCacheSimon Hausmann2014-03-021-0/+6
| | | | | | | Fix bug in QQmlCompiledData refcounting. Change-Id: I09528419c602d3173db2f13c516d2f0d79abd92e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] When resolving names of attached properties, don't report the ↵Simon Hausmann2014-03-021-2/+4
| | | | | | | | | error at import time Instead report it later with a more specific error message. This is consistent with the old compiler. Change-Id: Iba345b7ecc8a9ff474938f69118665eb0d965594 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add dedicated QML profiler and adapterUlf Hermann2014-02-151-2/+2
| | | | | | | | The remaining "profiling" parts of the QML profiler service are engine specific and are best accessed through their own adapter. Change-Id: Idb763104bdd80e4dabdf132ec1a496b9bc9f6f46 Reviewed-by: Kai Koehne <kai.koehne@digia.com>