summaryrefslogtreecommitdiff
path: root/render-test/file_source.hpp
blob: 58acf7b6ad996f7c9307c5bb0a5f05878bb2ef03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include <mbgl/storage/default_file_source.hpp>

namespace mbgl {

class ProxyFileSource : public DefaultFileSource {
public:
    ProxyFileSource(const std::string& cachePath, const std::string& assetPath, bool supportCacheOnlyRequests = true);
    ProxyFileSource(const std::string& cachePath,
                    std::unique_ptr<FileSource>&& assetFileSource,
                    bool supportCacheOnlyRequests = true);
    ~ProxyFileSource();

    std::unique_ptr<AsyncRequest> request(const Resource&, Callback);

    /**
     * @brief Starts/stops metrics tracking.
     */
    static void setTrackingActive(bool);
    /**
     * @brief Returns metrics tracking status.
     */
    static bool isTrackingActive();
    /**
     * @brief Returns the total amount of requests.
     *
     * @return size_t
     */
    static size_t getRequestCount();

    /**
     * @brief Returns the size of transferred data (in bytes).
     *
     * @return size_t
     */
    static size_t getTransferredSize();
};

} // namespace mbgl