X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fqml%2Fqml%2Fqqmlpropertycache_p.h;h=ad94ed46889940ed8f6e9b288f58ae86c142b18d;hb=7223f1861d3309d336123c90866665cfe2507d7f;hp=b14e2f4c1ff5a4592426b4130fe5070c09789cb3;hpb=0853343c33e394f35c31c161b019b2aed17f9256;p=profile%2Fivi%2Fqtdeclarative.git diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index b14e2f4..ad94ed4 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -72,6 +72,7 @@ class QQmlPropertyData; class QQmlAccessors; class QMetaObjectBuilder; class QQmlPropertyCacheMethodArguments; +class QQmlVMEMetaObject; // We have this somewhat awful split between RawData and Data so that RawData can be // used in unions. In normal code, you should always use Data which initializes RawData @@ -228,6 +229,8 @@ public: QString name(QObject *); QString name(const QMetaObject *); + void markAsOverrideOf(QQmlPropertyData *predecessor); + private: friend class QQmlPropertyCache; void lazyLoad(const QMetaProperty &, QQmlEngine *engine = 0); @@ -274,13 +277,15 @@ public: const QMetaObject *createMetaObject(); const QMetaObject *firstCppMetaObject() const; - inline QQmlPropertyData *property(const QHashedV8String &) const; - QQmlPropertyData *property(const QHashedStringRef &) const; - QQmlPropertyData *property(const QHashedCStringRef &) const; - QQmlPropertyData *property(const QString &) const; + template + QQmlPropertyData *property(const K &key, QObject *object, QQmlContextData *context) const + { + return findProperty(stringCache.find(key), object, context); + } + QQmlPropertyData *property(int) const; QQmlPropertyData *method(int) const; - QQmlPropertyData *signal(int) const; + QQmlPropertyData *signal(int index) const { return signal(index, 0); } int methodIndexToSignalIndex(int) const; QStringList propertyNames() const; @@ -293,9 +298,9 @@ public: inline QQmlEngine *qmlEngine() const; static QQmlPropertyData *property(QQmlEngine *, QObject *, const QString &, - QQmlPropertyData &); + QQmlContextData *, QQmlPropertyData &); static QQmlPropertyData *property(QQmlEngine *, QObject *, const QHashedV8String &, - QQmlPropertyData &); + QQmlContextData *, QQmlPropertyData &); static int *methodParameterTypes(QObject *, int index, QVarLengthArray &dummy, QByteArray *unknownTypeError); static int methodReturnType(QObject *, const QQmlPropertyData &data, @@ -340,13 +345,34 @@ private: // Implemented in v8/qv8qobjectwrapper.cpp v8::Local newQObject(QObject *, QV8Engine *); + QQmlPropertyData *signal(int, QQmlPropertyCache **) const; + typedef QVector IndexCache; - typedef QStringHash StringCache; + typedef QStringMultiHash > StringCache; typedef QVector AllowedRevisionCache; + QQmlPropertyData *findProperty(StringCache::ConstIterator it, QObject *, QQmlContextData *) const; + QQmlPropertyData *findProperty(StringCache::ConstIterator it, const QQmlVMEMetaObject *, QQmlContextData *) const; + + QQmlPropertyData *ensureResolved(QQmlPropertyData*) const; + void resolve(QQmlPropertyData *) const; void updateRecur(QQmlEngine *, const QMetaObject *); + template + QQmlPropertyData *findNamedProperty(const K &key) + { + StringCache::mapped_type *it = stringCache.value(key); + return it ? it->second : 0; + } + + template + void setNamedProperty(const K &key, int index, QQmlPropertyData *data, bool isOverride) + { + stringCache.insert(key, qMakePair(index, data)); + _hasPropertyOverrides |= isOverride; + } + QQmlEngine *engine; QQmlPropertyCache *_parent; @@ -361,7 +387,8 @@ private: AllowedRevisionCache allowedRevisionCache; v8::Persistent constructor; - bool _ownMetaObject; + bool _hasPropertyOverrides : 1; + bool _ownMetaObject : 1; const QMetaObject *_metaObject; QByteArray _dynamicClassName; QByteArray _dynamicStringData; @@ -465,13 +492,6 @@ QQmlEngine *QQmlPropertyCache::qmlEngine() const return engine; } -QQmlPropertyData *QQmlPropertyCache::property(const QHashedV8String &str) const -{ - QQmlPropertyData **rv = stringCache.value(str); - if (rv && (*rv)->notFullyResolved()) resolve(*rv); - return rv?*rv:0; -} - int QQmlPropertyCache::propertyCount() const { return propertyIndexCacheStart + propertyIndexCache.count();