aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmldata_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix memory corruption when multiple QML engines have JavaScript wrappers for ↵Simon Hausmann2015-05-081-2/+2
| | | | | | | | | | | | | | | the same QObject It's possible that the same QObject is exposed to multiple JavaScript environments, for which we have this "extra" hack in the form of a QMap. The common case is that QQmlData has a QV4::WeakValue that points to the JS wrapper for the object. However in the rare case of multiple exposure, a map in the other engines stores those references. That map was erroneously storing pointers to temporary values on the JS stack instead of heap pointers. Change-Id: I8587f9921a9b4f9efd288326d00cebc25ad0bc12 Task-number: QTBUG-45051 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Only heap allocate binding bits storage if needed.Aaron Kennedy2015-04-271-9/+15
| | | | | | | | | | | | | | | | | | | | For samegame, this has the following change on the total bytes allocated: Startup (main page): Before: 1636 After: 1072 Difference: 564 bytes (-34%) Actual game (single player): Before: 14120 After: 10432 Difference: 3688 bytes (-26%) Done-with: Robin Burchell <robin.burchell@viroteck.net> Change-Id: I10fd1e9f1440dcff93aed06e2c77c2912bc7dd39 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> (cherry picked from commit 54a19db8d00b67044861c8ffd1d5b1e646658609) 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>
* QQmlData: More member reorganisation to remove holes.Robin Burchell2015-01-201-2/+3
| | | | | | | Drops size from 136 bytes to 128 bytes on x86_64. Change-Id: I008f899539fcae8ad29b8978116e6dce2e10a40e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* QQmlData: Reorder fields to drop size from 144 to 136 bytes on x86_64.Robin Burchell2015-01-171-5/+5
| | | | | Change-Id: Icfeb5c27060731dfa79b48151b6dcb5484586708 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Further reduce v8engine dependenciesLars Knoll2015-01-081-1/+1
| | | | | Change-Id: I9f50f5ed1928de0c389c9646b308b431b51dae37 Reviewed-by: Simon Hausmann <simon.hausmann@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>
* Don't dereference null pointer.Sérgio Martins2014-07-281-1/+1
| | | | | | Task-number: QTBUG-40448 Change-Id: I75eb886ae765191101d6b01ebd038211e5fe8fba Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move PersistenValue and WeakValue into it's own fileLars Knoll2014-02-051-0/+1
| | | | | | | | They deserve having their own set of files, and it helps reduce dependencies. Change-Id: Ifd4394f88ef51cbccc61bf92dd20636f570141d9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename some filesLars Knoll2014-01-311-1/+1
| | | | | | | | | | | | Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to qv4value_inl_p.h. It makes more sense to have the class definition in the file that is named after the class and move the inline methods into a _inl file. Doing this now, as I expect we'll be needing a few more _inl files soon. Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-3/+3
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add support for accelerated property access to QML types and namespace supportSimon Hausmann2013-11-281-0/+3
| | | | | | | | | | | * Resolve lookups in namespaces at compile time and instruct the SSA optimizer to eliminate reads from the namespace (QQmlTypeWrapper) if possible. For example access to attached properties of types (i.e. MyNameSpace.ListView.isCurrentItem) requires neither reading the namespace nor the type. * Add support for accelerated lookup of attached properties Change-Id: Ib0b66404ed7e70e1d4a46a1ac8218743a4cc8608 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Allow for QtQml and QtDeclarative to co-exist at run-timeSimon Hausmann2013-11-251-2/+3
| | | | | | | | | | | This patch changes QQmlData to share the very first bit with QDeclarativeData, to indicate if the QObject in question is exposed in the QML1 or QML2 run-time. Task-number: QTBUG-35006 Change-Id: I3aa1d7c99038792011afd9f481ad30d9b981721f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into ↵Simon Hausmann2013-06-241-2/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wip/v4 Conflicts: src/imports/qtquick2/plugins.qmltypes src/qml/debugger/qv8debugservice.cpp src/qml/qml/qml.pri src/qml/qml/qqmlcompiler.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlcontext.cpp src/qml/qml/qqmldata_p.h src/qml/qml/qqmlengine_p.h src/qml/qml/qqmljavascriptexpression.cpp src/qml/qml/qqmlxmlhttprequest.cpp src/qml/qml/v4/qv4bindings.cpp src/qml/qml/v4/qv4irbuilder.cpp src/qml/qml/v4/qv4jsonobject_p.h src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/qml/qml/v8/qv8bindings.cpp src/qml/qml/v8/qv8contextwrapper.cpp src/qml/qml/v8/qv8listwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper.cpp src/qml/qml/v8/qv8qobjectwrapper_p.h src/qml/qml/v8/qv8sequencewrapper_p_p.h src/qml/qml/v8/qv8typewrapper.cpp src/qml/qml/v8/qv8valuetypewrapper.cpp src/qml/types/qqmldelegatemodel.cpp src/quick/items/context2d/qquickcanvasitem.cpp src/quick/items/context2d/qquickcontext2d.cpp sync.profile tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/benchmarks/qml/animation/animation.pro tools/qmlprofiler/qmlprofiler.pro Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
| * Partial fix for deferred properties when combined with componentsAlan Alpert2013-05-221-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current deferred properties implementation did not store context or compiled data pointers correctly. Those pointers are now stored when the defer is reached, so as to avoid confusion (confusion leads to asserts or crashes). Does not extend the deferred property support to allow multiple deferred blocks per item. This now prints and error and the side effect is only that one of the deferred blocks is lost. This use case is sufficiently rare that it may not be worth the cost. Task-number: QTBUG-30325 Change-Id: I80cb074ed4452e95020208a0142a91e721bced7d Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove last traces of v8 API and v8 compatibility layerSimon Hausmann2013-06-121-1/+0
| | | | | | | | | | | | | | | | The debugger and profiler service remain as bigger parts that need to be ported properly to v4. Change-Id: I68e72d6db66fe497eb58ed60df417ffe4662d115 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Cleanups in QObject bindingsSimon Hausmann2013-06-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | * Rename v8object to jsWrapper in QQmlData * Rename v8objectid to jsEngineId, as that's the identifier of the engine that currently owns the primary JS wrapper This is in preparation for moving newObject away from QV8QObjectWrapper Change-Id: I6432365e849d159600e22f09e7e2ab2ae2117db6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix failing tst_qqmlecmascript::deleteRootObjectDuringCreation unit testSimon Hausmann2013-05-291-0/+7
| | | | | | | | | | | | | | | | | | Respect the rootObjectInCreation flag in QQmlData. Centralize the checking code for that through the places in the engine where it is checked, along with the indestructible flag. Change-Id: Ie977b34ac8d070f6dcd7bab11a95dd27ca25145e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix QObject ownershipSimon Hausmann2013-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Implement the JS vs. C++ ownership policy. QV4::WeakValue is a weak reference that's now used instead of PersistentValue in QQmlData. Whether or not to delete the QObject when the JS object is garbage collected is decided in the ~QObjectWrapper destructor (conveniently). Fixes four ownership tests. Change-Id: Iedeb498f510295b5e656d0bb3b324084efa98f0f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Remove more v8::Persistent usagesLars Knoll2013-05-071-1/+3
|/ | | | | Change-Id: Ifa1706e2e609ded86a8bc1a840ca2ed36b869098 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-101-1/+1
| | | | | | Change-Id: I6c3bd7bebe3d62d1cfd0fa6334544c9db8398c76 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-231-24/+24
| | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: Ie7f5d49ed8235d7a7845ab68f99ad1c220e64d5c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Evaluate bindings more intelligently during constructionAaron Kennedy2012-08-291-1/+35
| | | | | | | | | | | | | | | | | Instead of just evaluating bindings in a fixed order, and possibly having to evaluate a single binding multiple times, prior to reading a property, we check if there are any bindings "pending" on it and evaluate them then. A pending binding is one that has been assigned to the property, but not yet evaluated. To minimize side effects we only do this for "safe" bindings. A safe binding is one that has no side effects, which we currently define as not calling functions or otherwise assigning values during its evaluation. This isn't an entirely foolproof way to ensure that the evaluation has no side effects, but it should be good enough. Change-Id: I98aa76a95719e5d182e8941738d64f8d409f404a Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Make connectNotify() work with QMLThomas McGuire2012-08-221-0/+1
| | | | | | | | | Call connectNotify() and disconnectNotify() in QQmlNotifierEndPoint, which works for QML signal handlers and for QML bindings. Task-number: QTBUG-11284 Change-Id: Ic9a08ee6687e5c7e606f315c8fb30eec1493cd83 Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Reduce memory consumption of source coordinatesMatthew Vogt2012-08-161-2/+2
| | | | | | | | | | Reduce memory consumption by storing source location coordinates as 16-bit variables (in run-time structures). Also modify qmlmin to restrict line lengths so that the column bound is not normally exceeded. Change-Id: I08605626ffbdf081b6da2aea1116bdfe24998572 Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
* Implement QAbstractDeclarativeData::isSignalConnected hookKent Hansen2012-06-271-0/+2
| | | | | | | | | | QQml_isSignalConnected is no longer needed, since QObjectPrivate::isSignalConnected will now call the declarativeData hook. Change-Id: I0685b0fa909d6c6c2d275bfa8d41100d9926a046 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Disallow parent changes for QML created objectsAaron Kennedy2012-06-061-2/+3
| | | | | | | | | Currently this is protected with a QML_PARENT_TEST environment variable to allow the rest of QtQuick to be updated before it is enforced. Change-Id: I4dd3644cbbce91d67f24c9556637f97eafb00638 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Allow the existence of a VME metaobject to be assertedMatthew Vogt2012-05-211-2/+4
| | | | | | | | | Test for the existence of a VME metaobject. Otherwise, assertion of a static cast result is not meaningful. Change-Id: Ic9e9c38e5dce65c41d20e405c33e179334c37b00 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Remove unnecessary exportsMatthew Vogt2012-05-181-1/+1
| | | | | | | | | Reduce library load time by removing any exports which are not required by existing clients. Task-number: QTBUG-24768 Change-Id: Ia5754d6f97bb2ed46e290820a5b092f85a4bc5b0 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Add QQmlEngine::trimComponentCache()Matthew Vogt2012-05-171-2/+2
| | | | | | | | | | | | Allow unused data in the engine's component cache to be safely discarded so that the memory can be freed for other purposes. Unloading of scripts that are no longer required after trimming unused components is not yet supported. Task-number: QTBUG-25653 Change-Id: I37bc9d5592eeb5edceeb34d010a555dcffd11cea Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Fix edge case in signal emission semanticsChris Adams2012-05-091-12/+1
| | | | | | | | | | | | | | Signal emission triggered by property changes during an onDestruction handler was previously not well tested. This commit adds several unit tests to ensure correct behaviour in that situation. Those unit tests showed a problem in signal emission related to when children objects are cleaned up. This commit also ensures that if such children own their own context, their onDestruction handlers are called prior to marking the child as deleted. Change-Id: Ibf84ae56ba1134e5d6402b742aee1bdc0e5e4e15 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Better checking top level root object creation statusCharles Yin2012-05-091-4/+4
| | | | | | | | Add QQmlContextData::isRootObjectInCreation flag, only set it to true in Init qml instruction, once a root ojbect created, set it to false and set QQmlData::rootObjectInCreation to true. Change-Id: Iba7b348ab664a472280d8d7283e93787b3dd0a56 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Remove QQmlData::objectNameChanged callback.Michael Brasser2012-05-091-5/+1
| | | | | | | | | The objectName property now has a proper NOTIFY signal. Also remove the objectName accessor, as it is no longer required. Task-number: QTBUG-23526 Change-Id: Ib18ba7335bf62a2fe2a9e489cb4c0f1fb142d74c Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Ensure binding target has not been deletedMatthew Vogt2012-05-041-1/+16
| | | | | | | | | | | | Prevent the evaluation of bindings if the target has been deleted. Also, mark an item as queued for deletion at the beginning of the destructor call chain, so that bindings triggered by the operation of the destructor itself are not evaluated (after the context is destructed, if necessary). Task-number: QTBUG-25516 Change-Id: I587ef7923eb749eb7980156ad73822c1fb7c1ff3 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Add a static flag to avoid unnecessary QQmlData::init() callsCharles Yin2012-05-031-5/+10
| | | | | Change-Id: I0b38753bfaf2d1e22ab67977001b946a686b0f56 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Remove init() call from QQmlData's ctor.Charles Yin2012-05-011-1/+0
| | | | | | | | This static method only needs to be called once and is already called in QQmlEnginePrivate::init() method. Change-Id: If2ea46ed06dca068164116b3f0b04cc404a18fb5 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
* Prevent object being delete by GC before object is fully createdCharles Yin2012-05-011-2/+7
| | | | | | | | | | Add a new flag inCreation to QQmlData. Set it to true when a top-level object begins creation, and back to false when initial creation is finished and the object has been marked indestructible. In the GC callback function, if inCreation is true, skip the GC and make a weak reference for next GC loop. Change-Id: I4ec82864c52f6be0c3e6ef892474dd77d835e152 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Also check notifier endpoints when checking whether a signal is connected.Michael Brasser2012-04-231-0/+1
| | | | | | | This is required for the QQmlBoundSignal optimizations. Change-Id: I63540b96cd7d4523ec49973a2540054c83d82b12 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Provide receivers count from QQmlData.Michael Brasser2012-04-201-0/+3
| | | | | | Change-Id: I70b06507158797df3083dc23a119935497aa19f4 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Don't crash if calling a method on a QObject that has been gc()'dAaron Kennedy2012-04-031-0/+14
| | | | | | | | | | As we don't actually delete an object immediately when it is collected, it is possible to get into a situation where a method is called on an object after the collector has marked it to be destroyed. This fixes a crash in this case. Change-Id: I131d4c5d7ed788a91aa52f6af2e5c089d9bf5e08 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Remove QObject parenting from QQmlAbstractBoundSignal.Michael Brasser2012-03-261-1/+3
| | | | | Change-Id: If549cf57bbac18a986a2a0e63fdc76902d2dae43 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Fix crash caused by dereferencing collected v8 dataChris Adams2012-03-151-3/+4
| | | | | | | | | | | | | | | | | | If a var property of a QObject is read after the v8 data associated with the qobject has been deleted but prior to the DeferredDelete event being processed, the varProperties array will be null and a crash will occur. This patch ensures that we check for this condition in both the access and set codepaths for var properties, and also ensures that an object which has previously been queued for deletion cannot be referenced in JS. Finally, it adds a unit test to ensure that we don't regress. Task-number: QTBUG-24748 Change-Id: Idde384ca01e18f4dcf9e376e9379f2c5eb410e14 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* Rename QDeclarative symbols to QQuick and QQmlMatthew Vogt2012-02-241-0/+207
Symbols beginning with QDeclarative are already exported by the quick1 module. Users can apply the bin/rename-qtdeclarative-symbols.sh script to modify client code using the previous names of the renamed symbols. Task-number: QTBUG-23737 Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66 Reviewed-by: Martin Jones <martin.jones@nokia.com>