aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypeloader_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix concurrent loading of the same qmldir from different scriptsAndy Shaw2017-05-021-6/+6
| | | | | | | | | | | | | | | | QQmlQmldirData keeps a pointer to a QQmlScript::Import, and an integer priority. Each Blob that is waiting on it was setting its own import and priority even though the QQmlQmldirData itself was shared. This resulted in whichever one began loading last succeeding to load, and the rest failing. This change instead stores the import and priority data per-dependent Blob Fix was originally done by Josh Faust <jfaust@suitabletech.com>. I added the test. Task-number: QTBUG-30469 Change-Id: Id3d15569a999a7c22eeb12b431e5daf1ddae51dc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9Simon Hausmann2017-03-251-1/+2
|\
| * Merge remote-tracking branch 'origin/5.8' into 5.9Simon Hausmann2017-03-151-1/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qqmltypecompiler_p.h src/qml/qml/qqmltypeloader.cpp src/qml/qml/qqmltypeloader_p.h Change-Id: I4894555ab7a0879b56bbda7a46d16d1c40c19e7c
| | * Fix caching of QML singleton typesSimon Hausmann2017-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a QML file depends on a QML singleton, we failed to include it in the dependency hash. Thus changes to the QML singleton did not result in a re-creation of the caches of files that use it. The list of singletons comes from random-ordered hashes in the qml import handling. We provide an order to the direct dependencies by sorting by the singleton type names. Task-number: QTBUG-58486 Change-Id: Ie7e9d006f9bf3a60af1f819ee439c29bc234bd8a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| | * Clean up type dependency hashing for QML cachingSimon Hausmann2017-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of passing the engine parameter all the way through the data structure generator, along with the dependent type data structure that is unused otherwise, let's simply provide a function object for the dependency hashing. This is also in preparation for adding singleton types to the dependency hash. Task-number: QTBUG-58486 Change-Id: I5bb5e5c06b7b5c77195cec3da13141333cfea7a8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Avoid an extra stat() on the source .qml file when loading cacheSimon Hausmann2017-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | For timestamp comparison it is not necessary to create another QFileInfo() object and call exists() and lastModified(), when we can pass that information through from the type loader. Change-Id: I225cd36e672f1f390bddb4e6ebfafa3fc1269795 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Avoid reading (not parsing) .qml files when using the cacheSimon Hausmann2017-03-211-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By making SourceCodeData copyable we can delay the reading of the source file until we really need to. This also allows persisting the QFileInfo object and therefore having only one stat() call to check if the file exists, what its size is and what the last modification time is. Change-Id: Ic7e4d5f566d870f3b1fa8302227417fa813cb139 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Simplify internal source access APISimon Hausmann2017-03-211-17/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All call sites of QQmlDataBlob::Data immediately convert the data to UTf-8 - for .qml, .js and qmldir files. We can simplify the code by reflecting that in the API and that also opens up the possibility for future optimizations. This means that the bi-pointer has to go, but at the moment the Data object is stack-allocated anyway. Since the "Data" class always represents source code, it is now called SourceCodeData. Change-Id: Icd262ed1e35f9edd64945ba6c16d80f9917eae72 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Re-do QML type compilation of ahead-of-time generated QML cache filesSimon Hausmann2017-01-311-0/+1
| | | | | | | | | | | | | | | | | | | | As we currently lack the ability to do type resolution at AOT cache generation time, we need to re-do the work after loading the cache file, making us essentially only re-use the code and avoiding the step of parsing. Change-Id: I12844692d4766345d8a313b59d21abf1f868e2d1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Un-nest QQmlTypeLoader::QmldirContentRobin Burchell2017-01-261-30/+30
| | | | | | | | | | | | | | | | | | This is mandatory to split some of QQmlImport's internal classes out into headers for reuse elsewhere, as we cannot forward-declare a nested class. Change-Id: I6524a372a89b37a22a99ed3eada76036e10e8660 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qml: Rename importCache vars to typeNameCacheRobin Burchell2017-01-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This better reflects what it is, and especially removes some confusion in QQmlTypeCompiler which has a m_importCache member (of type QQmlImports), which lead to some strange-to-read things like this: m_importCache.populateCache(*importCache); Which is now: m_importCache.populateCache(*typeNameCache); Change-Id: I7590dd1ba71ca77a8d964250a0d517156b723f8e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QQmlTypeLoader: Deduplicate type resolution codeRobin Burchell2017-01-241-1/+1
| | | | | | | | | | Change-Id: I325a0c27f4a851d91876612c5eb2da08bd1fb75e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | headers: Add missing override and remove redundant virtualAlexander Volkov2016-12-071-2/+2
| | | | | | | | | | | | Change-Id: Ifa816ebcd79372afca42dbd0dc0ecde006bb688a Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Qml: mark some methods as constAnton Kudryavtsev2016-10-241-1/+1
| | | | | | | | | | | | | | These methods do not modify objects. Change-Id: Iefe8effa97e6f6142308d61d57d08f9dc14a7709 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-181-6/+7
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4variantobject.cpp src/qml/types/qquickworkerscript.cpp src/quick/scenegraph/util/qsgdefaultpainternode_p.h tools/qmljs/qmljs.cpp Change-Id: I876242714ec8c046238d8fd673a5ace2455b2b59
| * Turn the no-network support into a configurable featureLars Knoll2016-10-101-6/+7
| | | | | | | | | | | | Change-Id: Ic70f60c124fe166b37fbe9b853735be3c5e0d46d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Qml: add missing 'override'Anton Kudryavtsev2016-10-071-16/+16
|/ | | | | | | ... and drop redundant 'virtual' Change-Id: Ib1f68c1ebd0468cb4a77eecc986bbf718f6bf789 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Disable disk caching when debugging JavaScriptSimon Hausmann2016-08-051-0/+2
| | | | | | | | The debugging changes the code generation and is currently not suitable for caching. Change-Id: I40db58a5f24457cf3383d08a1de3a4168874056f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Safeguard disk cache loading with checksum verificationSimon Hausmann2016-08-041-2/+8
| | | | | | | | | | | | | | | When loading a QML component from the disk cache, compare the checksum of the dependent types against the checksum when the cache was created. Any change in the meta-object of a dependent type should trigger a re-creation discard of the cache and consequent re-creation (in the test-case). Unfortunately this also requires extending the existing hack in the unit test to deal with the low second precision on HFS+ in order to pass the tests. Change-Id: Ib8e899347680f7be676788388e9c23a09b0277e3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add a checksum to the generated QML compilation unitsSimon Hausmann2016-08-021-1/+3
| | | | | Change-Id: Icd5b1d805059981cbbb4c0eb2a5c842d59223839 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Cleanup: Move ResolvedTypeReference(Map) one scope upSimon Hausmann2016-08-011-1/+4
| | | | | | | | The class is a candidate for further functionality, it doesn't have to be nested in CompilationUnit. Change-Id: I100553160f5ae34f66b9f8ff5df9f636da2ffb67 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Improve robustness of qml cache expiry checkingSimon Hausmann2016-07-191-1/+1
| | | | | | | | | | | Instead of relying on two time stamps in the file system (source file and cache file), make the determination on whether the source file is newer than the cache solely depend on the time stamp of only the source file. This means that when cache files are stored in archives for example their modification date does not need to be preserved upon extraction. Change-Id: I0b4362663868c6fb9bd7e106028161b2d67274d4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Added basic loading of compilation units from diskSimon Hausmann2016-07-191-0/+2
| | | | | | | | This remains hidden behind the QML_DISK_CACHE flag until all backends support it and the verification code is in place. Change-Id: Ic77c64e20a2dc4c43473c47640e09f8070237e85 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move type compilation independent bits out of QQmlTypeCompilerSimon Hausmann2016-06-201-0/+1
| | | | | | | | | | The type validation is something that works on the final compilation unit, so it can be done separately. The same applies to the composite type registration and object/binding calculation. Both steps will be shared with compilation units loaded from disk. Change-Id: I43636d7ac76077c76289d7c1c9eba5e9c6b8239a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Minor cleanup for implicit import handlingSimon Hausmann2016-06-201-1/+0
| | | | | | | | We don't need the m_implicitImport member in the QQmlTypeData when it is used in only one function and generally a pointer into the memory pool. Change-Id: Ib3de07631a6626ba1ebdf9e6fef379af1231fd24 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up pragma singleton handling in the type loaderSimon Hausmann2016-06-201-2/+0
| | | | | | | | | Get rid of the m_isSingleton boolean by checking the CompiledData::Unit::flags after the type compilation. This is more compact and makes the singleton type checks independent from the IR. Change-Id: I04189d284e6ea275ac8540918836b641914e7588 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up file/error handling in the type loaderSimon Hausmann2016-06-201-43/+4
| | | | | | | | | | | Fold the functionality of reading QFile contents via QQmlFile into QQmlDataBlob::Data. This reduces the dependency on QQmlFile - which is scheduled for removal - and it makes it possible in the future to avoid reading the file altogether if we have a cached compilation unit on disk. Change-Id: Ieeaf52b6fb1d25665cd3c3b196819e25aba3dd15 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Moved import cache and type resolution cache codeSimon Hausmann2016-06-171-4/+4
| | | | | | | | | | The code reads mostly from QQmlTypeData internal data structures, so it's cleaner to move it there - we can remove the getters for these internal fields. And it also allows for re-use later when not using the type compiler. Change-Id: I36cfaf3f1cecd6c8b223ee08516884a07bc60d6c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Cleanup: generalize type reference collection codeSimon Hausmann2016-06-141-0/+1
| | | | | | | | | | For loading compilation units from disk we'll have to scan the unit for type references, in order to correctly load dependencies. In preparation for that this patch template'izes the loops so that they can work on the Qml IR as well as on the CompiledData::Object structures. Change-Id: I32e4e3277e16c5a2d1bf6baf24456c9837c189ff Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Another manual refcounting cleanupSimon Hausmann2016-06-071-1/+1
| | | | | | | | There is little reason to use manual reference counting for an encapsulated member. Change-Id: I024a6ff700872da6837954a5167e502487e9b12c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove QQmlCompiledData in favor of QV4::CompiledData::CompilationUnitSimon Hausmann2016-06-011-3/+2
| | | | | | | | | QQmlCompiledData used to contain the binary data for instantiating QML types in the QML VME. Nowadays the QML type compiler as well as the JavaScript compiler create a QV4::CompiledData::CompilationUnit. Change-Id: I155f62a5ecfb55a3fe230520231b6d8fd5b28ac9 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-131-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsapi/qjsengine.cpp src/qml/qml/qqmlengine_p.h src/quick/items/qquickanchors.cpp src/quick/items/qquickanimatedimage_p_p.h src/quick/items/qquickitem_p.h tests/auto/qml/qqmlecmascript/testtypes.h tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp tests/benchmarks/qml/creation/tst_creation.cpp Change-Id: I65861e32f16e8a04c7090a90231627e1ebf6ba6f
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-271-0/+2
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickimagebase.cpp src/imports/layouts/plugin.cpp Change-Id: I5f48474df4034a1347ec74795c85d369a55b6b21
| | * Occasionally trim the type cacheUlf Hermann2016-04-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As loaded components are kept in a cache, they are never removed by the garbage collector. So, if you periodically create new components, they leak. This change adds a floating threshold for the number of components. When that threshold is surpassed trimCache() is called and unneeded components are removed. Task-number: QTBUG-42055 Change-Id: I30e3e4ee287f6d34376713668009c67614a50e0c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | QtLite: no_network option for QtDeclarativePaolo Angelelli2016-03-041-0/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | This patch adds the support for a no_network option for QtDeclarative, and the necessary #ifndef all around the code. no_network changes the interface of some classes, therefore using it breaks source compatibility. Change-Id: Iff612fb07041b8a7db99bd595bf038efaac2dd8a Reviewed-by: Risto Avila <risto.avila@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* / Updated license headersJani Heikkinen2016-01-191-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Load component synchronously in method_createQmlObjectUlf Hermann2015-11-031-2/+9
| | | | | | | | | | | 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-1/+1
| | | | | | | Returning a PersistentValue doesn't make much sense. Change-Id: I6044a12e48aa835ef78008e070bacda5125a7ca7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of qv4value_inl_p.h and replace it by qv4typedvalue_p.hLars Knoll2015-04-241-1/+1
| | | | | | | | This is a cleaner separation and further reduces include dependencies in the definitions of our basic data structured. Change-Id: I18aa86cdea0c0dfbc16075d4d617af97e638811e 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-6/+9
| | | | | | | | | | | | | | | | | | 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>
* Remove QML bundle codeSimon Hausmann2014-12-121-21/+1
| | | | | | | | | | 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: Remove unused codeSimon Hausmann2014-12-091-2/+0
| | | | | | | | isConcurrent is not virtual and always returns true, so we can remove it and remove the if() on the caller side. Change-Id: Ie750fdeddaf8c339e1fcab99ebd967e3446bd975 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Cleanup: Merge QQmlDataLoader and QQmlTypeLoaderSimon Hausmann2014-12-091-55/+46
| | | | | | | | | | | | | | 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>
* Fix QQmlExpression/QQmlScriptString/QQmlBinding crashesSimon Hausmann2014-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add new property "designersupported" to qmldirTim Jenssen2014-08-281-0/+2
| | | | | | | | | | | | | | | | | 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-1/+1
|\ | | | | | | | | | | Conflicts: src/qml/qml/qqmlobjectcreator_p.h Change-Id: I60858ddb46866a8fa1a8576bb05b412afeeb4e41
| * Fix crash with recursively loading cached compilation unitsSimon Hausmann2014-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Avoid race condition in QQmlEngine on shutdown.Gunnar Sletta2014-07-041-0/+1
|/ | | | | | | | | | | | 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>