* Move asset:// URL handling to DefaultFileSource. * AssetFileSource implements FileSource interface and follows familiar implementation patterns. * Move default implementation to platform/default, zip implementation to platform/android. * Don't bother with modified / expires / etag -- assets are not cached so it doesn't matter. * Don't bother with interleaving individual IO calls on the implementation thread. That adds a lot of complexity for very little benefit.
27 lines
567 B
C++
27 lines
567 B
C++
#ifndef MBGL_STORAGE_ASSET_FILE_SOURCE
|
|
#define MBGL_STORAGE_ASSET_FILE_SOURCE
|
|
|
|
#include <mbgl/storage/file_source.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
namespace util {
|
|
template <typename T> class Thread;
|
|
} // namespace util
|
|
|
|
class AssetFileSource : public FileSource {
|
|
public:
|
|
AssetFileSource(const std::string& assetRoot);
|
|
~AssetFileSource() override;
|
|
|
|
std::unique_ptr<FileRequest> request(const Resource&, Callback) override;
|
|
|
|
private:
|
|
class Impl;
|
|
std::unique_ptr<util::Thread<Impl>> thread;
|
|
};
|
|
|
|
} // namespace mbgl
|
|
|
|
#endif // MBGL_STORAGE_ASSET_FILE_SOURCE
|