aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* V4: allow inlining of ExecutionEngine::{qml,js}Engine()Erik Verbruggen2016-05-201-0/+1
| | | | | | | | All other changes are just to be able to include qv8engine_p.h in qv4engine_p.h Change-Id: I71ba2ec42cdc20d5c7d97a74b99b4d1ada1a5ed8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QmlProfiler: Reduce memory usage for file names and URLsUlf Hermann2016-05-021-7/+8
| | | | | | | | | | | | | | | | | | | | | As the various file names are actually not kept as QStrings in the respective objects being profiled, our saving them as QStrings in each and every profiling event is not implicitly shared and causes a huge memory overhead. Avoid that by saving each location only once, indexed by a disguised pointer to the object it refers to. Normally, objects could disappear during the profiling session, and new objects could be allocated in their place, which would mess up our indexing system. We prevent that by referencing the objects when we index them, thus preventing them from getting auto-destructed. Mind that those are not JavaScript objects but rather functions, bindings, components and the like. So, this will only cause a memory leak if you're compiling and dropping QML components over and over. Task-number: QTBUG-52937 Change-Id: Ia4dfb09a71a5c9a2d6ce25c3811bbe2a1036c1c1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-071-0/+2
|\ | | | | | | Change-Id: Icfa1d61fcc286c3418d4a625de11d2191336fa60
| * Let QQmlObjectCreator::setPropertyBinding return false for invalid typesFrederik Gladhorn2016-03-041-0/+2
| | | | | | | | | | | | | | | | | | This in theory happen for attached property types. Fixes Coverity CID 154272. Change-Id: I113797dea8949877cbeac82bae57655170878d4c Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Qml: replace QStringLiteral with QLatin1StringAnton Kudryavtsev2016-02-101-1/+1
| | | | | | | | | | | | | | ... in string comparisons. It's more efficient. Change-Id: I3be5a2be9ba5d55546472eac28f5f639a496bf3b Reviewed-by: Lars Knoll <lars.knoll@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>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-12-071-2/+15
|\| | | | | | | Change-Id: Ica75a71062d0613e415f2433c5c22c2e251b37cd
| * Make property interceptors work on alias properties againLars Knoll2015-11-261-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a regression introduced by change 01c0c0963794f4dd8c3601e8340cc3dc4dec41bd, where interceptors wouldn't work correctly on alias properties. This required some refactoring and splitting out the interceptor handling from the VMEMO into it's own class, as we are now installing bindings directly on the target property of an alias and not on the alias anymore. We now resolve the target property inside the QML object creator and install a interceptor metaobject on the target if required where we can then register the interceptor. Change-Id: I3ebc8f492ce5dcab7acf901711b47336d5182ffa Task-number: QTBUG-49072 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-141-1/+6
|\| | | | | | | Change-Id: I11ea57222ba5aa683b7bfd7735fbc1d2cf86e875
| * Make QML composite types inherit attached propertiesJ-P Nurmi2015-10-091-1/+6
| | | | | | | | | | | | | | | | Change-Id: Ic06af4805da987dd08e361f2668e7a1788d3eefe Task-number: QTBUG-43581 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-09-251-8/+7
|\| | | | | | | | | | | | | Conflicts: src/qml/debugger/qqmldebug.cpp Change-Id: I93de5a81b18cdece475870cf7cfba1b9baef2304
| * Fix function signatureLars Knoll2015-09-221-1/+2
| | | | | | | | | | | | | | Returning a PersistentValue doesn't make much sense. Change-Id: I6044a12e48aa835ef78008e070bacda5125a7ca7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Make QML composite types inherit enumsJ-P Nurmi2015-09-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: in Qt Quick Controls 2, enums declared in the abstract C++ base types were not accessible with the concrete QML type name, but had to be referenced using the base type name: Slider { snapMode: AbstractSlider.SnapOnRelease } Solution: this change resolves the C++ base type and creates the missing link between the composite type and its base type's meta- object. This allows referencing enums using the concrete/composite QML type name: Slider { snapMode: Slider.SnapOnRelease } Change-Id: Icefdec91b012b12728367fd54b4d16796233ee12 Task-number: QTBUG-43582 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Further cleanupsLars Knoll2015-09-151-5/+3
| | | | | | | | | | | | | | Reduce usage of ScopedContext. Change-Id: I84a6a7478065de3398fd0b21596ca1308e78ceb3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Don't push new QML contexts onto the context stackLars Knoll2015-09-081-1/+0
| | | | | | | | | | | | | | | | | | | | When creating new QML contexts, these are not used directly, but rather as scopes for other functions. Change the behavior, so that newQmlContext doesn't push the new context onto the context stack. Change-Id: I8254da3f660c4791941835c925b9892274ea51b0 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
| * Refactor the way we declare signal parameter namesLars Knoll2015-09-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Qml Connection objects where using an awkward way to make the parameter names of signals available to the signal handler. This now uses an approach that is equivalent to what we do with other functions. The main difference is that we can't know the parameter names at type compile time, so we have to rewrite the internal class of the QV4::Function at connect time. Change-Id: I5e538ac840b5a46ccb14ff71684404d947948324 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Decode signal signatures as UTF-8 rather than Latin1Ulf Hermann2015-09-151-3/+4
|/ | | | | | | | QML source code is supposed to be in UTF-8, including signal specifications. Change-Id: Ic2d0aef579addabf39b3910393a77989130bc11a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Create less BindingWrappersLars Knoll2015-08-251-11/+12
| | | | | | | | Instead create QmlContext's directly as they are the only thing used from the binding wrapper. Change-Id: If3a987134dee9e85b6a76ed74aacd76b19279117 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Add some typesafetyLars Knoll2015-06-181-1/+1
| | | | | | | | Even though the goal is to get rid of the contextwrapper, this helps in the meantime. Change-Id: I234ef39f74fb0eee78710884de6a1c90763bce74 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove a global read-write QQmlBinding::Invalid variableLars Knoll2015-06-101-1/+1
| | | | | Change-Id: I3ca148ae021ffc349b943231cc749828b0b7816c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make bindings refcountedLars Knoll2015-06-101-13/+8
| | | | | | | | | | | Refcounting our bindings greatly simplifies our memory management of the objects and ensures we safely clean them all up. In addition, it allows us to remove the m_mePtr and weak reference handling from QQmlAbstractBinding as we can safely handle this through the same mechanism. Change-Id: If23ebc8be276096146952b0008b62018f5d57faf Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Replace bindingType() method by a virtual getterLars Knoll2015-06-051-1/+1
| | | | | | | | | This removes the need to save some bits in the abstract binding object, and should make it easier to move QQmlAbstractBinding over to be reference counted. Change-Id: Ib46cb3217f3dc462f1dcaa6153d90ea2f7401f48 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix build with QT_STRICT_ITERATORSSérgio Martins2015-05-151-2/+2
| | | | | Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Smaller cleanupsLars Knoll2015-04-271-4/+2
| | | | | Change-Id: Ib8a222c26316ad31699d3becaa945ac4035e437b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Simplify binding setup code furtherLars Knoll2015-04-271-17/+3
| | | | | | | | Reduce the number of setBinding/removeBinding overloads and simplify their internal handling. Change-Id: I87174a3b2dc0ecb8380e8fc28f8969fbf475c728 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* CleanupLars Knoll2015-04-261-2/+2
| | | | | | | | Rename QQmlAbstractBinding::object() and propertyIndex() to targetObject() and targetPropertyIndex() Change-Id: Ic50da69e7a7c6412b5abb36f433be046e6566763 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Make removal of bindings explicitLars Knoll2015-04-251-2/+2
| | | | | | | This simplifies the code for further refactoring. Change-Id: I6bcb5ce397f642242af80ce37dc8bba1fa9bf3f5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove the QQmlContextData pointer from QQmlBindingLars Knoll2015-04-251-1/+1
| | | | | | | | The pointer is never used in practice, so let's get rid of it and save some memory. Change-Id: I8dccafb4cd3e14397fcf1c30633d60ea7ea9ce0c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Eliminate remaining property cache string lookups upon object instantiationSimon Hausmann2015-04-211-4/+5
| | | | | | | | Even for the id property binding we can use the property data cache and therefore avoid string hashing. Change-Id: Id9a4ca3159cdfe5ba93060f1bc8626e70140daa1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up instantiation of objects that are assigned to list propertiesSimon Hausmann2015-04-211-3/+10
| | | | | | | | | | For example massive amount of Item{} objects that are "children" of another item and thus get assigned to the default data list property. Instead of repeatedly retrieving that list property via a meta-call, we can do that only once and re-load if necessary. Change-Id: Ia7d10b84b3c7dca58d9f0b4b2138bd6f916c128d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up property binding initialization on object creationSimon Hausmann2015-04-211-43/+33
| | | | | | | | | | Avoid repeated string hashing and lookups in the property cache in order to retrieve the property details when initializing literal and script bindings. Instead we now cache the property data at type validation time, similar to how the property data was encoded in the VME instructions in the old engine. Change-Id: I3957c7c4c3e26dfa97c4880b23940a3755ee90e4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up composite type instantiation with lots of IDsSimon Hausmann2015-04-161-11/+1
| | | | | | | | We don't need to convert from a QHash to a QVector in order to populate the property name cache in QQmlContextData. Change-Id: Ifa8e4f64a1e174907e92684b2d38abaf0a4a705c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up object creationSimon Hausmann2015-04-161-5/+3
| | | | | | | | 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>
* Speed up creation of objects without script bindingsSimon Hausmann2015-04-161-27/+27
| | | | | | | | Avoid the creation of the QML binding wrappers if we don't need it, by moving the creation into a function that creates it on demand. Change-Id: I1af6a8507a114c1a0b83374704981b7ed4c4a3fc Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up creation of objects that don't import scriptsSimon Hausmann2015-04-161-1/+1
| | | | | | | | In the common case of no 'import "Foo.js" as Bar' we can avoid the creation of the JS array that holds the script references. Change-Id: I6704bd9efaf8681f939a148b2cb0a1de2cb22d80 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Simple speed-up for binding setup during object instantiationSimon Hausmann2015-04-141-2/+1
| | | | | | | | | | | | We use stringAt() to retrieve the name of the id property of an object but all we do with that string is check if it has a length. So if an id is set, we allocate memory and copy the string data into a new QString, and if it's not set then we get a default constructed QString. Either way the string isn't used and we can simply check for whether the id is set by checking if the idIndex is non-zero. Change-Id: Ib84fb05ed31c59f7e85dac72ab61b4d3bc9c902b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* CleanupSimon Hausmann2015-04-141-3/+2
| | | | | | | | | Avoid re-using the same variable for different purposes, so just pull in the first use into the tight scope and the second "property" variable close to the loop it is used with. Change-Id: I3a325478f9e56413b65dea9c7e05566497fbc6cf Reviewed-by: Lars Knoll <lars.knoll@digia.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>
* Remove all remaining usages of ValueRefLars Knoll2015-01-231-2/+2
| | | | | Change-Id: Icd76d3d03fac2e57530e55f8ec15b97109dcdcbc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of most uses of ValueRefLars Knoll2015-01-231-1/+1
| | | | | | | | | | | | 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-1/+1
| | | | | | | This prepares things for a rewrite of the internals of Persistent. Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove QQmlTrace. We have a real profiler.Erik Verbruggen2015-01-091-13/+0
| | | | | Change-Id: I50d981b277187327c2c63f8372f64db1300ed9ef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove qv8engine usage in the contextwrapperLars Knoll2015-01-081-2/+2
| | | | | Change-Id: Iaf807add5d971e96cac57e38e13385e901f9c930 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove most of the places where getPointer() is usedLars Knoll2014-12-201-2/+2
| | | | | | | This is no longer required, and simply uglifies the code Change-Id: Iba91a1d7735ebe23a43437f137a488423b6eb743 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Return Heap::ExecutionContext for globalContext()Lars Knoll2014-12-191-2/+4
| | | | | Change-Id: Ide7c81735be4662ff45bf268cfe750ff1f784453 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Encapsulate accesses to the root contextLars Knoll2014-12-111-2/+2
| | | | | Change-Id: I668cef1363a5c1a5c5b9a7e138f3bd0338712eea Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Changed value type property index encodingSimon Hausmann2014-12-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | We used to encode property index and value type property index in one int with 16 bits each, for example font.pixelSize with index of "font" in the lower 16 bits and "pixelSize" in the upper 16 bits. Detecting if a given encoded index was using value types or not was based on whether the value type index (upper 16 bits) were non-zero. That assumption holds given that all valid property indicies of value types are > 0 because they are all sub-classes of QObject, which provides the first property (objectName). With the introduction of gadgets property index zero will become popular again, and value types are a core use-case for gadgets. Therefore we need to change the encoding to allow for zero to be a valid value type property index. This is implemented by centralizing all decoding call sites to call one function that indicates -1 as non-present value type core index return value. That way we can encode the index with an offset of 1. Change-Id: I266abf140211a4f7204b47b94d07c364f0a8f408 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Store Heap objects in the qml binding wrapperLars Knoll2014-11-121-2/+4
| | | | | Change-Id: I7fae0710d148a2b07ec5f36a7fb96c2b645e564e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix QQmlExpression/QQmlScriptString/QQmlBinding crashesSimon Hausmann2014-10-091-1/+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>
* Select specific features to be recorded when profiling QMLUlf Hermann2014-09-111-1/+1
| | | | | | | | | | | | Some features, like the memory profiler, create huge amounts of data. Often enough, we're not actually interested in all the data available from the profiler and collecting it all can lead to excessive memory consumption. This change enables us to optionally turn various aspects of QML profiling off. Task-number: QTBUG-41118 Change-Id: I7bb223414e24eb903124ffa6e0896af6ce974e49 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>