From 0344ce36c483dbbcf770ac7f2615a233b22c4452 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Fri, 3 May 2019 14:31:11 +0300 Subject: [PATCH] [core] Define max cache size for ImageManager --- include/mbgl/util/constants.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/mbgl/util/constants.hpp b/include/mbgl/util/constants.hpp index f7799a953..97a87eda6 100644 --- a/include/mbgl/util/constants.hpp +++ b/include/mbgl/util/constants.hpp @@ -48,6 +48,10 @@ constexpr uint8_t DEFAULT_PREFETCH_ZOOM_DELTA = 4; constexpr uint64_t DEFAULT_MAX_CACHE_SIZE = 50 * 1024 * 1024; +// Default ImageManager's cache size for images added via onStyleImageMissing API. +// Average sprite size with 1.0 pixel ratio is ~2kB, 8kB for pixel ratio of 2.0. +constexpr std::size_t DEFAULT_ON_DEMAND_IMAGES_CACHE_SIZE = 100 * 8192; + constexpr Duration DEFAULT_TRANSITION_DURATION = Milliseconds(300); constexpr Seconds CLOCK_SKEW_RETRY_TIMEOUT { 30 };