diff options
author | Juha Alanen <juha.alanen@mapbox.com> | 2019-10-10 12:17:34 +0300 |
---|---|---|
committer | Juha Alanen <juha.alanen@mapbox.com> | 2019-10-16 14:14:46 +0300 |
commit | b53093b5221efb6f98f712f734b823ffce1400e1 (patch) | |
tree | 6050cda5c43b9c84c1273109f5c2e625e8464817 /render-test/file_source.hpp | |
parent | ee2b8033153bff0baeb5973dd400e5f867d86e03 (diff) | |
download | qtlocation-mapboxgl-b53093b5221efb6f98f712f734b823ffce1400e1.tar.gz |
[render-test] Add support for collecting network metrics
Diffstat (limited to 'render-test/file_source.hpp')
-rw-r--r-- | render-test/file_source.hpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/render-test/file_source.hpp b/render-test/file_source.hpp new file mode 100644 index 0000000000..58acf7b6ad --- /dev/null +++ b/render-test/file_source.hpp @@ -0,0 +1,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 |