Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp

Issue 2907843002: Reduce Canvas FontCache size on low end devices (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp
index b5c526018e836751b1ff0dbe79afe6ce776bf5d5..6bdcd59fcd2d2fdd6f9be91b7244d8e41bad5d22 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp
@@ -15,7 +15,9 @@
namespace {
const unsigned CanvasFontCacheMaxFonts = 50;
+const unsigned CanvasFontCacheMaxFontsLowEnd = 5;
const unsigned CanvasFontCacheHardMaxFonts = 250;
+const unsigned CanvasFontCacheHardMaxFontsLowEnd = 20;
const unsigned CanvasFontCacheHiddenMaxFonts = 1;
const int defaultFontSize = 10;
const char defaultFontFamily[] = "sans-serif";
@@ -45,12 +47,15 @@ CanvasFontCache::~CanvasFontCache() {
}
unsigned CanvasFontCache::MaxFonts() {
- return CanvasFontCacheMaxFonts;
+ return MemoryCoordinator::IsLowEndDevice() ? CanvasFontCacheMaxFontsLowEnd
+ : CanvasFontCacheMaxFonts;
}
unsigned CanvasFontCache::HardMaxFonts() {
return document_->hidden() ? CanvasFontCacheHiddenMaxFonts
- : CanvasFontCacheHardMaxFonts;
+ : (MemoryCoordinator::IsLowEndDevice()
+ ? CanvasFontCacheHardMaxFontsLowEnd
+ : CanvasFontCacheHardMaxFonts);
}
bool CanvasFontCache::GetFontUsingDefaultStyle(const String& font_string,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698