Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

make Resource a variant type #3374

Closed
jfirebaugh opened this issue Dec 21, 2015 · 1 comment
Closed

make Resource a variant type #3374

jfirebaugh opened this issue Dec 21, 2015 · 1 comment
Labels

Comments

@jfirebaugh
Copy link
Contributor

class FileSource : private util::noncopyable {
public:
    virtual std::unique_ptr<FileRequest> requestSource(const std::string& url, Callback) = 0;
    virtual std::unique_ptr<FileRequest> requestSprite(const std::string& url, Callback) = 0;
    virtual std::unique_ptr<FileRequest> requestGlyphs(const std::string& template, const std::string& fontstack, const GlyphRange&, Callback) = 0;
    virtual std::unique_ptr<FileRequest> requestTile(const std::string& template, const TileID&, Callback) = 0;
    // etc
};

This is necessary for offline: the OfflineFileSource needs access to actual z/x/y tile coordinates. It shouldn't try to guess them from the URL because there's no way to do that with 100% reliability.

@jfirebaugh jfirebaugh self-assigned this Dec 22, 2015
jfirebaugh added a commit that referenced this issue Dec 23, 2015
It's going to be exposed in the public core API as part of #3374.
jfirebaugh added a commit that referenced this issue Jan 5, 2016
Resource is going away as part of #3374.

The only place that Resource#kind was used was to bypass an attempt
at compression for sprite images. But it's fine for that path to just do
the compression and use it if it works -- even if not optimal, sprite
images account for a relatively small portion of cache rows.
jfirebaugh added a commit that referenced this issue Jan 5, 2016
Resource is going away as part of #3374.

The only place that Resource#kind was used was to bypass an attempt
at compression for sprite images. But it's fine for that path to just do
the compression and use it if it works -- even if not optimal, sprite
images account for a relatively small portion of cache rows.
jfirebaugh added a commit that referenced this issue Jan 8, 2016
Resource is going away as part of #3374.

The only place that Resource#kind was used was to bypass an attempt
at compression for sprite images. But it's fine for that path to just do
the compression and use it if it works -- even if not optimal, sprite
images account for a relatively small portion of cache rows.
@jfirebaugh jfirebaugh changed the title replace Resource::Kind with FileSource methods for each kind of resource make Resource a variant type Feb 11, 2016
@jfirebaugh
Copy link
Contributor Author

Retitled: we should do this with a variant, not with a ton of virtual methods.

@jfirebaugh jfirebaugh removed their assignment Feb 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant