aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlbinding.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move createQmlCallableForFunction out of the binding wrapperLars Knoll2015-09-081-1/+1
| | | | | | | | | It's now QV4::FunctionObject::createQmlFunction, which I believe is a better place and name for the method, esp. as it has no real connnection to the binding wrapper anymore. Change-Id: I59e20e120db72e53735b3a986e0b91bc7c3347d7 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-1/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
* | Remove superfluous checkFrank Meerkoetter2015-07-311-5/+0
| | | | | | | | | | | | | | | | The same check is done ~3 lines above. Change-Id: I8e6aeff89a7b0f3805afdf453b133dc98da59066 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Smaller cleanup to QQmlJavaScriptExpressionLars Knoll2015-06-181-7/+4
| | | | | | | | | | | | | | Clean up some of the code to create binding expressions. Change-Id: I1cd826685713b44166c58b114fa91135a664591d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove a global read-write QQmlBinding::Invalid variableLars Knoll2015-06-101-2/+0
| | | | | | | | | | Change-Id: I3ca148ae021ffc349b943231cc749828b0b7816c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Save one more pointer on each bindingLars Knoll2015-06-101-1/+1
| | | | | | | | | | | | | | | | Fold the isAddedToObject flag into the nextBinding pointer. Reorder the members to avoid holes in the data. Change-Id: I0a216940f52020a5d48a6ed05cc236c248161b08 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Make bindings refcountedLars Knoll2015-06-101-1/+7
| | | | | | | | | | | | | | | | | | | | | | 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-5/+5
| | | | | | | | | | | | | | | | | | 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>
* | Move the writeBinding method into QQmlBindingLars Knoll2015-06-051-4/+152
| | | | | | | | | | | | | | | | It's only called from there; this simplifies the code and will allow some further optimizations. Change-Id: I1f0befe620beaa0bbf961fc829881ef7b5c2e435 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Fix resolving of nested alias propertiesLars Knoll2015-06-051-2/+2
| | | | | | | | | | | | | | | | | | When looping to resolve nested aliases, make sure we use the correct property index to determine the vme meta object that contains the next level of alias data. Change-Id: Id2077b164a4591c86ccb63e8ed3bb997d719731c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move the target property index into the common base classLars Knoll2015-06-051-10/+5
| | | | | | | | | | | | | | | | This unifies some more code between the different binding classes Change-Id: I891dc9358cf9598a0c1e21df8a62d6f8a4193985 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move the target object into the base classLars Knoll2015-06-051-5/+0
| | | | | | | | | | Change-Id: I912d7665b49c8e9b2d38e78bfcfc4b3d39ca7459 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove the QQmlPropertyData from the bindingLars Knoll2015-06-051-21/+59
| | | | | | | | | | | | | | Simply store the encoded property index instead. Change-Id: I235030c3d658df3e5df6efafc9c5b2c22200e0a8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Save one more pointer for every bindingLars Knoll2015-04-271-18/+8
| | | | | | | | | | Change-Id: I434fda86b8e06484548be416f92a3cde9df6b906 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Minor cleanupLars Knoll2015-04-271-33/+34
| | | | | | | | | | Change-Id: I10abb08d80abc210986b2a7f820b8118b38485dc Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Get rid of QQmlBinding::property()Lars Knoll2015-04-271-6/+1
| | | | | | | | | | | | | | The method is slow and not required anymore Change-Id: I8c2bc6eeedbd15b901b60aa08408fe8c32a81707 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move m_function into the base classLars Knoll2015-04-271-4/+3
| | | | | | | | | | Change-Id: I2ebc0ac8f5085157f5d1ec71a1b75559c6a46f8b Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Rename the v4function member variablesLars Knoll2015-04-271-10/+10
| | | | | | | | | | | | | | | | | | Name the functions consistently between all classes inheriting from QQmlJavascriptExpression to prepare the move of the member into the base class. Change-Id: I161e829e3921816e675b73b6c1f3ca06315b328f Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Directly resolve property aliases in QQmlBinding::setTargetLars Knoll2015-04-261-0/+37
| | | | | | | | | | | | | | | | Like this the target properties of the binding will always point to the correct resolved object and property. Change-Id: I400a265a17bc55de041c3df17f357e4b40f31c4d Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Get rid of QQmlBinding::retargetBinding()Lars Knoll2015-04-261-12/+4
| | | | | | | | | | | | | | | | Instead call setTarget directly and properly resolve the required QQmlPropertyData. Saves some memory for bindings to value types. Change-Id: I542b456685955add7d395764ff85cb3098b3f208 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | CleanupLars Knoll2015-04-261-4/+4
| | | | | | | | | | | | | | | | Rename QQmlAbstractBinding::object() and propertyIndex() to targetObject() and targetPropertyIndex() Change-Id: Ic50da69e7a7c6412b5abb36f433be046e6566763 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Cleanup: remove context argument from evaluate methodsLars Knoll2015-04-261-2/+2
| | | | | | | | | | | | | | | | We always called evaluate with our own context, so there's no need to pass it along as an argument. Change-Id: I3463165eb2947b230c7acf54e7c29dd5d3b8e17c Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove the manual vtable from QQmlAbstractBindingLars Knoll2015-04-261-41/+0
| | | | | | | | | | | | | | | | | | it's rather hard to maintain, and not really worth it. I believe we can more easily save the one pointer in other places with easier to maintain code. Change-Id: Iaba2d62b82ebe58947fa35b0812b4c70f318007a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Remove the QQmlContextData pointer from QQmlBindingLars Knoll2015-04-251-10/+23
| | | | | | | | | | | | | | | | 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>
* | Remove the manual vtable from QQmlJavaScriptExpressionLars Knoll2015-04-251-18/+10
| | | | | | | | | | | | | | | | Now that the class got unified with QQmlAbstractExpression, it has a vtable anyway, so we can just as well remove the old hack. Change-Id: Ifa095297e3d75564c4305ce3655eaa57436ef4a8 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Get rid of QQmlAbstractExpressionLars Knoll2015-04-241-6/+6
| | | | | | | | | | | | | | | | | | The class is always used together with QQmlJavaScriptExpression, so we can just as well fold the functionality together into one class and simplify our code. Change-Id: I23820e51efaaea16ae5db7e2153a827d7b22999e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-221-25/+4
|\| | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlbinding.cpp src/qml/jsruntime/qv4arraybuffer.cpp src/qml/jsruntime/qv4functionobject.cpp Change-Id: Ic752e9dfd69b282093651c9234c110a49762f06d
| * 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>
| * Speed up binding evaluationSimon Hausmann2015-04-161-23/+2
| | | | | | | | | | | | | | | | | | Don't spend any cycles of determining the location of the binding (file, line, column) unless we really need that information. That's the case when the profiler is active or an error happens. Change-Id: Iae97808d500b88fed6a813e8b224aa6ebe04d3b6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Get rid of asFunctionObject()Lars Knoll2015-04-211-2/+2
| | | | | | | | | | Change-Id: Ib4858376dc0ec57fa473c80696abc66a570c90ec Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | More cleanupsLars Knoll2015-04-211-1/+1
|/ | | | | | | | Get rid of Value::asObject(), and pass const Managed pointers into some more vtable methods. Change-Id: Ia4f427d5fd8868f77b4015d1ce5424d32bfc2115 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>
* 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-6/+10
| | | | | | | This prepares things for a rewrite of the internals of Persistent. Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of the bindingKeyFlagLars Knoll2015-01-121-1/+1
| | | | | | | | | Instead use the vtable to identify that we have a binding function. Change-Id: I794aebb6fb83f648ba36f2f15cad94d2af3cae91 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove QQmlTrace. We have a real profiler.Erik Verbruggen2015-01-091-8/+0
| | | | | Change-Id: I50d981b277187327c2c63f8372f64db1300ed9ef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup variant conversion codeLars Knoll2015-01-091-1/+1
| | | | | | | | Make public methods proper members of the ExecutionEngine, and move private methods into the .cpp file only. Change-Id: I3ca49e39bb1c4e559a2c63346e6ae6cfa446147d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the variant conversion methods from qv8engine to qv4::ExecutionEngineLars Knoll2015-01-091-1/+1
| | | | | Change-Id: Ibd529ae5cc3ba06f46152e9daa9119a4e7a2561c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove v8engine dependency in toVariant conversionsLars Knoll2015-01-021-1/+1
| | | | | Change-Id: I0f2f77c9cc268a0c5ca3ffe0cd66fc98bb1964b3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove most of the places where getPointer() is usedLars Knoll2014-12-201-1/+1
| | | | | | | This is no longer required, and simply uglifies the code Change-Id: Iba91a1d7735ebe23a43437f137a488423b6eb743 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of !this and similar constructsLars Knoll2014-10-311-1/+2
| | | | | | | | | The C++ standard doesn't allow calling member functions on a mull object. Fix all such places, by moving the checks to the caller where required. Change-Id: I10fb22acaf0324d8ffd3a6d8e19152e5d32f56bb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix QQmlExpression/QQmlScriptString/QQmlBinding crashesSimon Hausmann2014-10-091-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* Convert qqmlbuiltinfunctions to the new storage layoutLars Knoll2014-07-221-1/+1
| | | | | Change-Id: Idb075e97a5f62bbfe8086155d13a01d1dbc99c08 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move data of FunctionObject into an inner structLars Knoll2014-07-221-2/+2
| | | | | Change-Id: Ic00b1761565f9f8881b665a3fecca723239e2279 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Managed data into it's own subclassLars Knoll2014-07-221-1/+1
| | | | | | | | | This prepares for moving over to a d pointer scheme, where Managed subclasses don't hold any data directly. This is required to be able to move over to a modern GC. Change-Id: I3f59633ac07a7da461bd2d4f0f9f3a8e3b0baf02 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup: Get rid of the url and file name members in QQmlCompiledDataSimon Hausmann2014-06-051-1/+1
| | | | | | | | 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>
* Rework custom parser integrationSimon Hausmann2014-06-041-28/+0
| | | | | | | | | | | | | | | | | | | | | | | The custom parser design used to be so that the custom parser operates on the "AST", creates its own binary representation of the data it needs, stores it in a QByteArray and gets that at object instantiation time. That meant serializing everything necessary. With the introduction of the "binary" QML data structure, that process of serialization becomes obsolete and would require extra work in the custom parsers for example for QQuickStates to store the translation parameters. The clean solution is to eliminate this unnecessary serialization process and instead let the custom parsers do a verification pass at type compile time and then simply operate directly on the QV4::CompiledData::Bindings at object instantiation time. That simplifies the code, and allows for support of translations throughout all list model properties. Additionally this speeds up the creation of state objects and reduces memory consumption. Previously a text: qsTr("foo") binding in states would result in an actual java script binding. After this patch it is merely stored as a string and translated at object instantiation time. Change-Id: I7550274513f54abb09a0ab4de51c4c0bcdb23cae Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Avoid recompiling of signal handlers defined in QtQuick state changes and ↵Simon Hausmann2014-04-021-2/+2
| | | | | | | | | | Connection objects We can re-use the expression we've compiled at QML type compilation time, as long as we "inject" the signal parameters in the dynamic qml lookup chain. Change-Id: Icc417531c41dea06ff5d033011179af49b03f542 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix performance regression for bindings from QtQuick state changesSimon Hausmann2014-04-021-1/+1
| | | | | | | | | | | | | | | | This is a regression from the compiler change. We can and should try to use the binding as it was compiled in the loader thread for things like PropertyChanges { target: foo width: someExpresion + to + calculate * width; } It is already ensured that these expressions are compiled without type optimizations. Change-Id: Ib855d8a848fcab2524df008727eab436ac98514e Reviewed-by: Lars Knoll <lars.knoll@digia.com>