901 void
902 gfxPlatform::InitializeSkiaCaches()
903 {
904 #ifdef USE_SKIA_GPU
905 if (UseAcceleratedSkiaCanvas()) {
906 bool usingDynamicCache = Preferences::GetBool("gfx.canvas.skiagl.dynamic-cache", false);
907
908 int cacheItemLimit = Preferences::GetInt("gfx.canvas.skiagl.cache-items", 256);
909 int cacheSizeLimit = Preferences::GetInt("gfx.canvas.skiagl.cache-size", 96);
910
911
912 cacheSizeLimit *= 1024*1024;
913
914 if (usingDynamicCache) {
915 uint32_t totalMemory = mozilla::hal::GetTotalSystemMemory();
916
917 if (totalMemory <= 256*1024*1024) {
918
919 cacheSizeLimit = 2*1024*1024;
920 } else if (totalMemory > 0) {
921 cacheSizeLimit = totalMemory / 16;
922 }
923 }
924
925 #ifdef DEBUG
926 printf_stderr("Determined SkiaGL cache limits: Size %i, Items: %i\n", cacheSizeLimit, cacheItemLimit);
927 #endif
928
929 Factory::SetGlobalSkiaCacheLimits(cacheItemLimit, cacheSizeLimit);
930 }
931 #endif
932 }