aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvaluetypewrapper_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Speed up copying of value types in bindingsSimon Hausmann2015-04-161-0/+1
| | | | | | | | | When a binding results in a value type reference and the destination property is of the same time, then we can avoid a heap allocation and just allocate the value type memory on the stack, construct, copy and destruct. Change-Id: If71ef82b0ced85c1b962c5e44147d6c07edd1440 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up value type binding creationSimon Hausmann2015-04-161-4/+5
| | | | | | | | | | | * Avoid calling QMetaType::construct/destruct(typeId, ...) as that requires repeated lookups in the type registry. Instead cache the constructor/destructor/etc. function addresses in the QQmlValueType singletons as QMetaType * Allocate memory for the gadget pointer lazily, to accommodate the common case of a value type binding by property reference. Change-Id: I98a3ac73453b8f80027c06401b4f29a9707949d2 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>
* 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>
* Enable gadget wrapping for custom value typesSimon Hausmann2015-01-021-0/+1
| | | | | | | | | | | | | | | | | | [ChangeLog][QtQml] Custom C++ value types annotated with Q_GADGET are now fully accessible in the QML and QJSEngine JavaScript environment. QJSEngine::toScriptValue can be used for injection and fromScriptValue to extraction. The QML "built-in" gadget wrappers for QPoint and the gui types are not exposed this way, toScriptValue(point) will still return an opaque QVariant wrapper. We could expose the core types right away, but then we would be lacking an API to enable use of the Gui types that are registered in QtQuick. It would be better to make the core types in qtbase gadgets and thus enable them without the need for hooks and init functions to be called by the user. Task-number: QTBUG-29769 Change-Id: I8179cd599bdc1209ff61cfdbdda419cb400296bb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Removed usage of QQmlValueType in QQmlValueTypeWrapperSimon Hausmann2014-12-281-2/+7
| | | | | | | | | | | | | | | QQmlValueType doesn't have anything really necessary :). Some code it has, but that was only called from the wrapper, so it was moved there. This also reduces one level of memory allocation for the wrapper. In theory the allocation for the JavaScript wrapper could be changed to be the size of the wrapper _plus_ the size needed for the gadget. However in anticipation of wanting to be able to move objects, we can't do that as we can't memmove() gadgets around - they might contain pointers to memory areas within. Change-Id: Icb5a6f5513e3b2c87f6639f6f7b1fb572af08137 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Reduce dependencies on QQmlValueType being a QObjectSimon Hausmann2014-12-231-0/+1
| | | | | | | | Don't rely on caching the property cache in the QQmlData of the value type, instead we can cache is in the engine and store it in our object data. Change-Id: I5f31313c066cd7918caf33e3fabdf5aac71f1adb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Further value type wrapper cleanupsSimon Hausmann2014-12-231-4/+3
| | | | | | | Removed the QV8Engine * member in QQmlValueTypeWrapper. Change-Id: I37cc131a3ff0279240b227c11a6b74bfc7bf4960 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Begin cleaning up QQmlValueTypeWrapperSimon Hausmann2014-12-231-3/+1
| | | | | | | | | | | | | Get rid of the objectType member. Instead of checking for it and then static_cast'ing to the specific class, it's easier to use Managed's as<> template cast. Also elimiate the QVariant value member for ValueTypeWrapperCopy. In fact, the entire class is folded into ValueTypeWrapper itself as d()->type has the one copy of the data. Change-Id: I0d9c794400095830540d313187623b98b686f4cd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup: Fix value type wrapper class nameSimon Hausmann2014-12-231-4/+4
| | | | | | | | It's supposed to be QQmlFoo instead of QmlFoo. While all this code is being touched, we might as well fix the name. Change-Id: Ia8be0c6ec46e114f7559c1e7a07a9d368932999e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial work on gadget supportSimon Hausmann2014-12-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | Changed built-in QtQml value types to use gadgets. This is in preparation for supporting external gadgets. This replaces the mostly direct inheritance of the concrete value types with gadgets and "dynamic" inheritance through QQmlValueType being generic. Over time as some of the value types may become gadgets, we can remove the ones here. It's important that these "separate" gadgets have the same memory layout as the actual types (QPointF, etc.). Also while QQmlValueType remains practically a singleton, it's not required anymore to be one. Consequently the JS wrappers for value types keep their own instance of QQmlValueType. This allows eliminating the qobject_cast in various places that dealt with the singleton nature. This comes at a cost, making the JS wrappers slightly heavier. However that is meant to be a temporary situation and finally the value type wrapper should merely store the meta-object in addition to the data and the type. Change-Id: I15071ded0a1e54203f29ec1ecf7a9ab646d1168e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup destruction of heap objectsLars Knoll2014-11-211-1/+1
| | | | | | | | Generate the code from a macro instead of duplicating boiler plate code. Operate on Heap::Base instead of Managed. Change-Id: I84c5a705980899be3e5b931a093645e50d3923bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move data of some Qml related objects into Heap namespace.Lars Knoll2014-11-101-8/+13
| | | | | Change-Id: I6e6b24466de1e49efd5f3eaa67db82873170445b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Object::Data into the Heap namespaceLars Knoll2014-11-081-1/+1
| | | | | Change-Id: I9d30081f71b83bc86f5e5714e23396b18c4d54c5 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>
* Cleanup: Get rid of __data membersSimon Hausmann2014-07-221-6/+0
| | | | | | | These are not needed anymore Change-Id: Ib834aa294e84ca9fbdd5b6850d5bc172e8b54ba1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix Managed::as<>() methodLars Knoll2014-07-221-1/+1
| | | | | | | | | | | | | | | The as<> casting method was not doing the right thing in 100% of the cases. It only checked if the object in question was exactly of the type being asked for. It however didn't check if the object was derived from the type. This commit fixes this by adding a parent chain to the vtables, that is then being used to check this safely at runtime. Change-Id: I9e0b13adbda668aee8c7451e2bb71cd6d4e316d9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert TypeWrapper and ValueTypeWrapperLars Knoll2014-07-221-3/+1
| | | | | Change-Id: Ib1debebda1cc6dbfaf9c6dca40cde72800a2769b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of StringRefLars Knoll2014-07-221-3/+3
| | | | | | | | Remove the Ref classes, as they won't be required anymore once Managed and Managed::Data are separated. Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename V4_OBJECT_NEW back to V4_OBJECTLars Knoll2014-07-221-1/+1
| | | | | | | | The _NEW variant was there only temporarily to aid converting to the new data layout. Change-Id: I1d126ee0999c8f0a49f5a08c2e8c090497dd6dd5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert QQmlValueTypeWrapper to the new storage schemeLars Knoll2014-07-221-7/+13
| | | | | Change-Id: Ibbba8652e2d3db8569f5fa69015c6e13fa2ae4c3 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>
* Split ManagedVTable into two classesLars Knoll2014-01-211-1/+1
| | | | | | | | Keep the basic methods in ManagedVTable, but have the Object related stuff in an ObjectVTable class. Change-Id: I9b068acf3caef813686227b8d935e7df1a7d1a6e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify & speed up function callingLars Knoll2013-11-091-1/+1
| | | | | | | | | Get rid of the SimpleCallContext, instead simply use the CallContext data structure, but don't initialize the unused variables. Change-Id: I11b311986da180c62c815b516a2c55844156d0ab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert the remaining vtable methods to be GC safeLars Knoll2013-09-221-1/+1
| | | | | Change-Id: I679d1833609c41d71e8436ec0ba8a4624f0c4dd0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* convert Managed::put() API to be GC safeLars Knoll2013-09-221-1/+1
| | | | | Change-Id: I09198ce372fa545372db389fac26828d21ad5731 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a StringRef for Managed::get()Lars Knoll2013-09-221-1/+1
| | | | | | | | | also store "toString" and "valueOf" as identifiers in the engine and fix two places where we compared strings the wrong way. Change-Id: I70612221e72d43ed0e3c496e4209681bf254cded Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-2/+2
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert builtin methods to return a ReturnedValueLars Knoll2013-09-181-1/+1
| | | | | Change-Id: I6b75adbf53a5be0deab023d2eed98ce2a7915551 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use ReturnedValue for Managed::get().Lars Knoll2013-09-181-1/+1
| | | | | Change-Id: Ia8f35d227b69d32e1f6a041283abbbd083aa34ca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix hasOwnProperty on various types wrapped in QMLSimon Hausmann2013-08-081-0/+1
| | | | | | | | | | | | * Change semantics of Object::query to not walk the prototype chain but let the caller do that where needed (__hasProperty__) * Re-implement query in various places * Implement method_hasOwnProperty to fall back to query() if getOwnProperty failed * Fix missing prototype initialization in some qml wrappers, as well as missing base class calls to ::get() Change-Id: Ic2a702fd5ff3be2ff3c8317a8a24f99940a9594f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove context parameter from Manged::put.Lars Knoll2013-06-221-1/+1
| | | | | Change-Id: Ib99e726ffbb20463d45a8444b4fbdfe32cd6dbef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove context parameter from Managed::get()Lars Knoll2013-06-221-1/+1
| | | | | Change-Id: I61837e4b17d7475dcda2f31b8a293c0020930d52 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix qqmlvaluetypewrapper auto-testsSimon Hausmann2013-06-201-1/+0
| | | | | | | | | | QQmlValueTypeWrapper stores its prototype in a global variable (PersistentValue), which doesn't work when using multiple engines. Instead this patch introduces the QML extensions structure to hold things like prototypes for type extensions to JS that are specific to QML. Change-Id: I41a71029edb6ce895eb80db7aa0809aab86b31db Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Start converting casting of Managed to subtypes to a better schemeLars Knoll2013-05-311-3/+1
| | | | | | | | | | | There is now a template based as<Foo>() method available in Managed, that'll allow casting to the proper subclass. It uses the pointer to the vtable and compares it to the classes static vtable for type checking. Like this we can avoid that Managed has to know about all subclasses. Change-Id: Ic966bbe00d85224b8d96cc0ff00f69a6ac67129e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of v8::UserObjectComparisonCallbackLars Knoll2013-05-311-0/+1
| | | | | | | | Add a isEqualTo Method to the Managed's vtable, that will be used for comparing. Change-Id: I4d253db93851c16a57aa1412fa7142913d1744e6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Port the value type wrapper over to use V4Lars Knoll2013-05-301-0/+108
Change-Id: I0c566d0ab8cdd0ddbc688b7a1462c4b21084b30a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>