aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycache_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove QQmlEnginePrivate::typePropertyCacheSimon Hausmann2017-08-021-0/+1
| | | | | | | | | Instead of maintaining a hash per QQmlType and minor version, move the version specific property caches into QQmlType. Task-number: QTBUG-61536 Change-Id: I72f3990cb93e64ac5074060b4ff327043eab7966 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move property cache from the engine to QQmlTypeSimon Hausmann2017-08-021-0/+2
| | | | | | | | | | | | | Now that the property cache is independent of a specific engine, we can cache them in QQmlType instead of caching them per engine. This simplifies the logic and avoids duplicated property caches when multiple engines are running. Task-number: QTBUG-61536 Change-Id: I6f082e1e7495ae0f5b92559e8d0a3437c56e303a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move the engine pointer from the property cache to the VME meta objectLars Knoll2017-08-021-13/+5
| | | | | | | | | This is where it belongs, and it makes the PropertyCache independent of the engine used. Task-number: QTBUG-61536 Change-Id: I21c2674ee3e2895abd2418764d140b154b47b868 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-231-0/+2
|\ | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4object_p.h Change-Id: Iff4d3aba7710a999b8befdc493cbe959e1ce02f9
| * QML: Add another specialization for QQmlPropertyCache::propertyErik Verbruggen2016-11-161-0/+2
| | | | | | | | | | | | | | | | | | QQmlListReference passes a QLatin1String in, which can behandled by the stringCache just fine. So if there is a cache entry, then this will skip toQString conversion. Change-Id: I13afe4f6e63d486b313ac58cbd86fb7f9e1a80f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QQmlPropertyCache: add property() overload with QStringRef argAnton Kudryavtsev2016-11-081-1/+7
| | | | | | | | | | | | | | | | Now we can pass 'name' arg as QStringRef. Client code can reduce allocations. Change-Id: I444f7135f4912f54d57e0a1193f330a3976fc186 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devJ-P Nurmi2016-11-031-2/+2
|\| | | | | | | | | | | | | Conflicts: tools/qmljs/qmljs.cpp Change-Id: Ifa9e74bdb780eaff22fbc9ba1c514d0078a3fb29
| * QML: Hint LTO to never inline QQmlPropertyCache::resolveErik Verbruggen2016-10-251-2/+2
| | | | | | | | | | | | | | | | ... so the fast-path doesn't get bogged down by accidental slow-path inlining. Change-Id: Ifb3eadf5e96b5a61f41fb1f0d32269e43f13be57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-181-0/+14
|\| | | | | | | | | | | | | | | | | | | 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
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-101-0/+14
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/quick/quickwidgets/quickwidget/main.cpp src/qml/jsruntime/qv4jsonobject.cpp src/qml/jsruntime/qv4qobjectwrapper.cpp src/qml/jsruntime/qv4qobjectwrapper_p.h src/qml/qml/qqmlengine.cpp src/qml/qml/qqmlpropertycache.cpp src/qml/qml/qqmlpropertycache_p.h src/quick/items/qquickanimatedsprite.cpp src/quick/items/qquickitem.cpp src/quick/items/qquickitem.h src/quick/items/qquickitem_p.h src/quick/items/qquickview_p.h src/quick/scenegraph/qsgcontext.cpp src/quick/scenegraph/qsgdefaultrendercontext.cpp Change-Id: I172c6fbff97208f21ed4c8b6db3d1747a889f22b
| | * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-041-0/+16
| | |\ | | | | | | | | | | | | Change-Id: I48764527fa1ab6d8d59c24552394459b1cdc58ee
| | | * Fix crash with window-less QQuickItemsSimon Hausmann2016-09-301-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark QQuickItem visual children directly in QQuickItem instead of relying on the item being a (grand) child of a window. [ChangeLog][QtQuick] Fix crash with QQuickItems created via JavaScript being garbage collected sometimes when they're not assigned to a window. This may happen even in qmlscene when between the creation of the root item and the assignment to the QQuickWindow the garbage collector runs. The previous approach of a persistent in QQuickView marking the visual item hierarchy relies on the existence of a view. The only thing left to do in the view and qml window implementation is enforcing the CppOwnership policy set on the content item in QQuickWindow by ensuring the presence of the JS wrapper, replacing the persistent with a weak value. This also introduces a new internal mechanism for QObject sub-classes to provide their own V4 JS wrapper types. Task-number: QTBUG-39888 Change-Id: Icd45a636a6d4e4528fc19165b13f4e1ca7967087 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | | Qml, Imports: mark some methods as constAnton Kudryavtsev2016-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These methods do not modify objects. Change-Id: I67b1a10cfd0b32688500fca3265a96f53afd1b57 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | | Qml: add missing 'override'Anton Kudryavtsev2016-10-071-2/+2
|/ / / | | | | | | | | | | | | | | | | | | ... and drop redundant 'virtual' Change-Id: Ib1f68c1ebd0468cb4a77eecc986bbf718f6bf789 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QML: Obliterate QQmlAccessorsErik Verbruggen2016-08-301-5/+0
| | | | | | | | | | | | | | | Change-Id: I70a080feb401cf23aef1bde44a19a11e27642f30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Switch from using accessors to static_metacallErik Verbruggen2016-08-241-21/+46
| | | | | | | | | | | | | | | Change-Id: I7a781eb3cb0af9c68b385af5752555bd9cb313d4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Remove hasAccessors flag from QQmlPropertyRawDataErik Verbruggen2016-08-181-5/+2
| | | | | | | | | | | | | | | | | | | | | We can now always check if the pointer is null (no accessors) or not. Change-Id: Ie9abf2f8930ea1f75a6d637a47f7f9c4fbab1151 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Change storage types of QQmlPropertyRawData fieldsErik Verbruggen2016-08-181-41/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By getting rid of the unions, all "features" (like accessors and notify indices) can now be used for all properties or functions. Other fields are trimmed to the size as used in other parts of QML. Now the size of QQmlPropertyRawData is 24 bytes on 32bit platforms, and 32 bytes on 64bit platforms. Change-Id: Ie2f22eb60e6119c93e3d3ea32a2974a718d45e91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Get rid of propTypeName in QQmlPropertyRawDataErik Verbruggen2016-08-171-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This information can be recreated when needed: the property/method index is known, just like the meta-object, so we can query that for the type name. Change-Id: I9d4f557eda4e4a946a80b68d3787823767b0b1d3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Move flag from QQmlPropertyRawData fields into its flagsErik Verbruggen2016-08-111-9/+8
| | | | | | | | | | | | | | | Change-Id: I4f1aaf92fd1c67ec18ab0f80d6d0bf58b4af6a17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Make all fields in QQmlPropertyRawData privateErik Verbruggen2016-08-101-75/+123
| | | | | | | | | | | | | | | | | | | | | | | | And add accessors. This makes it easier later on to change the storage of the fields. Change-Id: I21163668ac83a7d52f398981baf3c27ef161c177 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Split off value type information from property dataErik Verbruggen2016-08-091-42/+6
| | | | | | | | | | | | | | | Change-Id: I2ae2fb0f18af9b866cc9482fd4f42d9d4269f8cb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QQmlPropertyCache: remove unused method propertyNames()Anton Kudryavtsev2016-08-081-1/+0
| | | | | | | | | | | | | | | Change-Id: Ibcae6b396677c5d4648f59a4c5998a08862cb033 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Change the property data flags into a bit fieldErik Verbruggen2016-08-051-90/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | This will make it easier in follow-up patches to add or remove flags. It also shrinks the flags, because each type doesn't need its own bit (as those are mutually exclusive). Change-Id: I5ba6de5f330eb20c82aa16b4467ed6c952725979 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Introduce QQmlPropertyIndexErik Verbruggen2016-08-041-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | This helps in making it clear when an index is a plain old number and when it consists of an encoded value type index. Change-Id: Ic50d95caf244ed0ee2d62bdba53910a371cfee04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add a checksum to QQmlPropertyCacheSimon Hausmann2016-08-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | By running an md5 hash over the meta-object data and string tables this will allow us to detect changes to meta-objects and invalidate QML disk caches. Change-Id: I15b92de4cdf0cb525281b86e1c7b8ba0b11347a0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Add a function to QQmlPropertyCache to calculate the meta-object sizesSimon Hausmann2016-08-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This will be used later for calculating checksums of the meta-object data. Change-Id: Iba925eae298cbfc7b89196f4dd6fb2854ce75e2e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QML: Unify property reads/writes and use accessorsErik Verbruggen2016-07-251-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pass property reads/writes through utility functions in QQmlProperty, which in turn will try to use accessors when available (and no interceptors have to be called). Change-Id: I60ecfc202b6024bfe4a33206a46299787b152546 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Split out creation of alias properties in the property cachesSimon Hausmann2016-07-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to the regular property cache creation code, this also has to become a template function so that it can be run on the compilation units loaded from disk in the future. What is shared between the code path of a fresh compilation vs. re-use of a unit from disk is the code to propagate the CompiledData::Alias entries into entries in the property cache. The code for iterating through the component spaces and resolving the alias references is not shared. Change-Id: I04c2a5575310400156b457ae7b709cffecb7455e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QML: QQmlPropertyCache: Allow for more inliningErik Verbruggen2016-07-131-0/+66
| | | | | | | | | | | | | | | | | | | | | These are simple and often-called methods. Change-Id: Id681c75e13ec262c17dc00ce9f3a0c30c9183991 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Clarify a parameter's usage in QQmlPropertyCacheErik Verbruggen2016-07-061-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Give the template type a fitting name, use a parameter name that is slightly more descriptive than "dummy", and pass it around by pointer like we do in other places. Change-Id: Ie7051a6053fc8d2f9c3ea92ee3ce18e57dc5e62a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Convert QQmlPropertyCacheCreator to a templateSimon Hausmann2016-06-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This will allow the use of it also against a QV4::CompilationUnit and assorted data structures loaded from the disk. Change-Id: I4f337d1fcf319e80e422448671476db907de6d9e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Clean up property cache array handlingSimon Hausmann2016-06-161-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QQmlPropertyCacheVector in the CompilationUnit encapsulates the property caches for the objects declared in the QML tree as well as the bits indicating whether a VME meta-object is needed. The ref-counting for the caches in that vector was done "manually" and thus error prone. This patch replaces the vector with a wrapper container that has explicit move semantics and takes care of the addref() and release() calls upon insertion, replacement and destruction. Change-Id: If805fe016f1a1c70e56f8a90909ab87b653ea026 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Add QJSEngine::newQMetaObjectCorentin Jabot2016-06-051-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QJSEngine::newQMetaObject let us expose QMetaObject to the QJSEngine, allowing to construct QObjects instance from javascript. Additionally, enums values are exposed as property of the QMetaObject wrapper. (The engine takes ownership of the created objects) Change-Id: I5428d4b7061cceacfa89f51e703dce3379b2c329 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-041-8/+8
|\| | | | | | | | | | | Change-Id: I694ac053b53b669ef5578fd0074de5ce109f7a09
| * | QQmlPropertyCache: Fix developer build with MinGW.Friedemann Kleint2016-04-191-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reorder inline functions so that QQmlPropertyCache::ensureResolved() is visible from where it is invoked (QQmlPropertyCache::property()), fixing error: qtdeclarative/src/qml/qml/qqmlpropertycache_p.h:559:26: error: 'QQmlPropertyData* QQmlPropertyCache::ensureResolved(QQmlPropertyData*) const' redeclared without dllimport attribute after being referenced with dll linkage [-Werror] inline QQmlPropertyData *QQmlPropertyCache::ensureResolved(QQmlPropertyData *p) const Change-Id: Id0f0b5b92d377c71f5950011ba993e53d783bfb8 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* | | QML: When available, use QQmlAccessors to read properties.Erik Verbruggen2016-04-121-0/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a property is read from a QObject or the QML scope object, and we can statically resolve the type to qreal/QObject/int/bool/QString, and the property has an accessor declared for it, then use that accessor to do the read. This collapses the path of e.g.: Runtime::getQmlScopeObjectProperty -> QObjectWrapper::getProperty -> QObjectWrapper::getProperty -> LoadProperty -> QQmlAccessor::read (all of which do various checks for all the stuff mentioned above) to: Runtime::accessQmlScopeObjectQRealProperty -> QQmlAccessor::read which is a simple 4-line function, and doesn't need to do any check. According to valgrind, this saves 170 instructions on x86 for the simple binding: Item { width: height } Change-Id: I0761d01e8f1a3c13ecbffe2d8e0317ce9c0a4db0 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | QML: allow more methods to get inlined.Erik Verbruggen2016-04-051-0/+20
| | | | | | | | | | | | | | | | Most of these methods are small, and all of them lie in the 'hot path' for simple bindings like 'width: parent.width'. Change-Id: I0071cec92b49437a352160b0283ed6c89a278a07 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QQuick: remove property index from the accessor functions.Erik Verbruggen2016-03-311-1/+0
| | | | | | | | | | | | | | This parameter was not used. Change-Id: I1e8c0994cad37fc24105e354a80a4fb0131d58ee Reviewed-by: Simon Hausmann <simon.hausmann@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>
* | Remove dead fwd-dclFrank Meerkoetter2015-12-151-1/+0
|/ | | | | Change-Id: Ifd9fe32b80cd1ebc8dc9fda7c252ecdaae42cb37 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Smaller cleanupsLars Knoll2015-09-251-4/+2
| | | | | Change-Id: Ib75bf9de898975dcbb98b411a1e98524754c0788 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Remove some unused codeLars Knoll2015-09-251-7/+0
| | | | | Change-Id: Iaa89515891624602cf63701364c77e49ea1e1bd9 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Cleanup code in the VMEMOLars Knoll2015-08-191-0/+2
| | | | | Change-Id: Idc1da41586161f1c824c608198e232ba52a0d9d7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Hold a pointer to the QV4::ExecutionEngine in the property cacheLars Knoll2015-08-191-3/+3
| | | | | | | This makes more sense than a pointer to the QQmlEngine. Change-Id: Ic6037b0df63b6cf1585539bc3ac78822f0e69d02 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Reorder members to save some bytesLars Knoll2015-04-251-1/+1
| | | | | Change-Id: I075cd56695c8d7fe7e46be2a2c4a575ca53fadaf 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>
* The property() calls in the proeprty cache only require a QJSEngine nowLars Knoll2015-01-081-2/+2
| | | | | Change-Id: Ic4a944b4f1dd02ad2f0284acad5f3135068f66df Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix property access and method invocation on value types that use inheritanceSimon Hausmann2015-01-071-0/+4
| | | | | | | | | | For gadgets/value types we use moc's static_metacall, which doesn't call the parent class implementation. Therefore before placing a static metacall we must resolve the indicies and find the right meta-object. Change-Id: I258e3d9ecfc704498c68772dc42b16134a3bfd83 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>