Make ResourceCache::prefetch private and comment

This commit is contained in:
Zach Pomerantz 2016-04-21 10:33:35 -07:00
parent 713fc44ec5
commit cba5bff89e
2 changed files with 12 additions and 6 deletions

View file

@ -100,9 +100,6 @@ class TextureCache : public ResourceCache, public Dependency {
using Type = NetworkTexture::Type;
public:
// Overload ResourceCache::prefetch to allow specifying texture type for loads
Q_INVOKABLE ScriptableResource* prefetch(const QUrl& url, int type);
/// Returns the ID of the permutation/normal texture used for Perlin noise shader programs. This texture
/// has two lines: the first, a set of random numbers in [0, 255] to be used as permutation offsets, and
/// the second, a set of random unit vectors to be used as noise gradients.
@ -131,6 +128,8 @@ public:
const QByteArray& content = QByteArray());
protected:
// Overload ResourceCache::prefetch to allow specifying texture type for loads
Q_INVOKABLE ScriptableResource* prefetch(const QUrl& url, int type);
virtual QSharedPointer<Resource> createResource(const QUrl& url,
const QSharedPointer<Resource>& fallback, bool delayLoad, const void* extra);

View file

@ -141,9 +141,6 @@ public:
Q_INVOKABLE QVariantList getResourceList();
// This must be exposed as a ptr so the ScriptEngine may take ownership
Q_INVOKABLE ScriptableResource* prefetch(const QUrl& url) { return prefetch(url, nullptr); }
static void setRequestLimit(int limit);
static int getRequestLimit() { return _requestLimit; }
@ -175,6 +172,16 @@ private slots:
void clearATPAssets();
protected:
// Prefetches a resource to be held by the QScriptEngine.
// Pointers created through this method should be owned by the caller,
// which should be a QScriptEngine with ScriptableResource registered, so that
// the QScriptEngine will delete the pointer when it is garbage collected.
Q_INVOKABLE ScriptableResource* prefetch(const QUrl& url) { return prefetch(url, nullptr); }
// Prefetches a resource to be held by the QScriptEngine.
// Left as a protected member so subclasses can overload prefetch
// and delegate to it (see TextureCache::prefetch(const QUrl&, int).
ScriptableResource* prefetch(const QUrl& url, void* extra);
/// Loads a resource from the specified URL.