diff options
author | Qt by Nokia <qt-info@nokia.com> | 2011-04-27 14:13:26 +0200 |
---|---|---|
committer | axis <qt-info@nokia.com> | 2011-04-27 14:40:44 +0200 |
commit | a129444bb0156c936900dbd2f12bd9f427ff366c (patch) | |
tree | e2e8e77f185d5a5ac32ea0a96cd9945c742e8663 /src/declarative/qml/qdeclarativeengine_p.h | |
parent | 885735d011472bcfbb96e688d9e64553d7fe9d4b (diff) |
Initial import from qtquick2.
Branched from the monolithic repo, Qt qtquick2 branch, at commit
a4a585d2ee907746682846ae6e8a48e19deef469
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine_p.h')
-rw-r--r-- | src/declarative/qml/qdeclarativeengine_p.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 88b4e800f8..fadedf41dd 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -67,6 +67,7 @@ #include "private/qdeclarativeproperty_p.h" #include "private/qdeclarativepropertycache_p.h" #include "private/qdeclarativeobjectscriptclass_p.h" +#include "private/qdeclarativescarceresourcescriptclass_p.h" #include "private/qdeclarativecontextscriptclass_p.h" #include "private/qdeclarativevaluetypescriptclass_p.h" #include "private/qdeclarativemetatype_p.h" @@ -93,6 +94,8 @@ class QDeclarativeExpression; class QDeclarativeContextScriptClass; class QDeclarativeImportDatabase; class QDeclarativeObjectScriptClass; +class QDeclarativeScarceResourceScriptClass; +class ScarceResourceData; class QDeclarativeTypeNameScriptClass; class QDeclarativeValueTypeScriptClass; class QScriptEngineDebugger; @@ -110,6 +113,8 @@ class QDeclarativeDelayedError; class QDeclarativeWorkerScriptEngine; class QDeclarativeGlobalScriptClass; class QDir; +class QSGTexture; +class QSGContext; class QDeclarativeScriptEngine : public QScriptEngine { @@ -169,6 +174,7 @@ public: QDeclarativeContextData *sharedContext; QObject *sharedScope; QDeclarativeObjectScriptClass *objectClass; + QDeclarativeScarceResourceScriptClass *scarceResourceClass; QDeclarativeValueTypeScriptClass *valueTypeClass; QDeclarativeTypeNameScriptClass *typeNameClass; QDeclarativeListScriptClass *listClass; @@ -233,9 +239,22 @@ public: QHash<QString,QSharedPointer<QDeclarativeImageProvider> > imageProviders; QDeclarativeImageProvider::ImageType getImageProviderType(const QUrl &url); + QSGTexture *getTextureFromProvider(const QUrl &url, QSize *size, const QSize& req_size); QImage getImageFromProvider(const QUrl &url, QSize *size, const QSize& req_size); QPixmap getPixmapFromProvider(const QUrl &url, QSize *size, const QSize& req_size); + /* + A scarce resource (like a large pixmap or texture) will be cached in a + JavaScript wrapper object when accessed in a binding or other js expression. + We need some way to automatically release that scarce resource prior to normal + garbage collection (unless the user explicitly preserves the resource). + */ + ScarceResourceData* scarceResources; + int scarceResourcesRefCount; + static bool variantIsScarceResource(const QVariant& val); + void referenceScarceResources(); + void dereferenceScarceResources(); + mutable QMutex mutex; QDeclarativeTypeLoader typeLoader; @@ -250,6 +269,8 @@ public: QDeclarativeValueTypeFactory valueTypes; + QHash<QDeclarativeMetaType::ModuleApi, QDeclarativeMetaType::ModuleApiInstance *> moduleApiInstances; + QHash<const QMetaObject *, QDeclarativePropertyCache *> propertyCache; QHash<QPair<QDeclarativeType *, int>, QDeclarativePropertyCache *> typePropertyCache; inline QDeclarativePropertyCache *cache(QObject *obj); @@ -270,8 +291,6 @@ public: QHash<int, int> m_qmlLists; QHash<int, QDeclarativeCompiledData *> m_compositeTypes; - QHash<QString, QScriptValue> m_sharedScriptImports; - QScriptValue scriptValueFromVariant(const QVariant &); QVariant scriptValueToVariant(const QScriptValue &, int hint = QVariant::Invalid); @@ -327,6 +346,8 @@ public: static void defineModule(); static bool qml_debugging_enabled; + + QSGContext *sgContext; }; /*! |