9 #ifndef hifi_OffscreenQmlSurfaceCache_h
10 #define hifi_OffscreenQmlSurfaceCahce_h
12 #include "DependencyManager.h"
14 #include <QtCore/QSharedPointer>
17 class OffscreenQmlSurface;
19 class OffscreenQmlSurfaceCache :
public Dependency {
23 OffscreenQmlSurfaceCache();
24 virtual ~OffscreenQmlSurfaceCache();
26 QSharedPointer<OffscreenQmlSurface> acquire(
const QString& rootSource);
27 void release(
const QString& rootSource,
const QSharedPointer<OffscreenQmlSurface>& surface);
28 void reserve(
const QString& rootSource,
int count = 1);
29 void setOnRootContextCreated(
const std::function<
void(
const QString& rootSource, QQmlContext* rootContext)> & onRootContextCreated);
32 QSharedPointer<OffscreenQmlSurface> buildSurface(
const QString& rootSource);
33 QHash<QString, QList<QSharedPointer<OffscreenQmlSurface>>> _cache;
34 std::function<void(
const QString& rootSource, QQmlContext* rootContext)> _onRootContextCreated;