diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-06-07 16:54:09 +1000 |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-06-07 17:00:11 +1000 |
commit | 1325c549744346154a915115e9787b97427fad81 (patch) | |
tree | e566a9e5ddc957cf6ccc3e91bbca3544da312964 /src/declarative/qml/qdeclarativepropertycache.cpp | |
parent | 53085399f56714db27cbdebe554146528d13c94e (diff) |
Implement ListModel in V8
Diffstat (limited to 'src/declarative/qml/qdeclarativepropertycache.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativepropertycache.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/declarative/qml/qdeclarativepropertycache.cpp b/src/declarative/qml/qdeclarativepropertycache.cpp index e48a8495d2..b2aad7b7bc 100644 --- a/src/declarative/qml/qdeclarativepropertycache.cpp +++ b/src/declarative/qml/qdeclarativepropertycache.cpp @@ -168,8 +168,8 @@ void QDeclarativePropertyCache::clear() indexCache.clear(); methodIndexCache.clear(); stringCache.clear(); - constructor.Dispose(); - constructor = v8::Persistent<v8::Function>(); + constructor.Dispose(); + constructor.Clear(); } QDeclarativePropertyCache::Data QDeclarativePropertyCache::create(const QMetaObject *metaObject, @@ -252,7 +252,7 @@ void QDeclarativePropertyCache::append(QDeclarativeEngine *engine, const QMetaOb Q_UNUSED(revision); constructor.Dispose(); // Now invalid - constructor = v8::Persistent<v8::Function>(); + constructor.Clear(); allowedRevisionCache.append(0); @@ -416,16 +416,18 @@ QDeclarativePropertyCache::Data * QDeclarativePropertyCache::property(QDeclarativeEngine *engine, QObject *obj, v8::Handle<v8::String> name, Data &local) { - Q_ASSERT(engine); - QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); - + // XXX Optimize for worker script case where engine isn't available QDeclarativePropertyCache *cache = 0; - QDeclarativeData *ddata = QDeclarativeData::get(obj); - if (ddata && ddata->propertyCache && ddata->propertyCache->qmlEngine() == engine) // XXX aakenend - cache = ddata->propertyCache; - if (!cache) { - cache = ep->cache(obj); - if (cache && ddata && !ddata->propertyCache) { cache->addref(); ddata->propertyCache = cache; } + if (engine) { + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + + QDeclarativeData *ddata = QDeclarativeData::get(obj); + if (ddata && ddata->propertyCache && ddata->propertyCache->qmlEngine() == engine) // XXX aakenend + cache = ddata->propertyCache; + if (!cache) { + cache = ep->cache(obj); + if (cache && ddata && !ddata->propertyCache) { cache->addref(); ddata->propertyCache = cache; } + } } QDeclarativePropertyCache::Data *rv = 0; @@ -433,7 +435,8 @@ QDeclarativePropertyCache::property(QDeclarativeEngine *engine, QObject *obj, if (cache) { rv = cache->property(name); } else { - QString strname = ep->v8engine.toString(name); + QString strname = QV8Engine::toStringStatic(name); + // QString strname = ep->v8engine.toString(name); local = QDeclarativePropertyCache::create(obj->metaObject(), strname); if (local.isValid()) rv = &local; |