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

Unified Diff: content/child/dwrite_font_proxy/font_fallback_win.h

Issue 1906633003: Implement fallback cache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blinkfontfallback
Patch Set: Add some checks and comments Created 4 years, 8 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 | content/child/dwrite_font_proxy/font_fallback_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/dwrite_font_proxy/font_fallback_win.h
diff --git a/content/child/dwrite_font_proxy/font_fallback_win.h b/content/child/dwrite_font_proxy/font_fallback_win.h
index 925ebb0641ffe3cfa5b07a447bb7d26e6d3c9563..4554c9328734f716ef1ea96a1da59e15f98eb1a9 100644
--- a/content/child/dwrite_font_proxy/font_fallback_win.h
+++ b/content/child/dwrite_font_proxy/font_fallback_win.h
@@ -9,6 +9,9 @@
#include <dwrite_2.h>
#include <wrl.h>
+#include <list>
+#include <map>
+
#include "content/child/dwrite_font_proxy/dwrite_font_proxy_win.h"
#include "content/common/content_export.h"
#include "ipc/ipc_sender.h"
@@ -44,10 +47,28 @@ class CONTENT_EXPORT FontFallback
protected:
~FontFallback() override;
+ bool GetCachedFont(const base::string16& text,
+ const wchar_t* base_family_name,
+ DWRITE_FONT_WEIGHT base_weight,
+ DWRITE_FONT_STYLE base_style,
+ DWRITE_FONT_STRETCH base_stretch,
+ IDWriteFont** mapped_font,
+ uint32_t* mapped_length);
+
+ void AddCachedFamily(Microsoft::WRL::ComPtr<IDWriteFontFamily> family,
+ const wchar_t* base_family_name);
+
private:
IPC::Sender* sender_override_;
Microsoft::WRL::ComPtr<DWriteFontCollectionProxy> collection_;
+ // |fallback_family_cache_| keeps a mapping from base family name to a list
+ // of font families that matched a character on a previous call. The list is
+ // capped in size and maintained in MRU order. This gives us a good chance of
+ // returning a suitable fallback font without having to do an IPC.
+ std::map<base::string16, std::list<Microsoft::WRL::ComPtr<IDWriteFontFamily>>>
+ fallback_family_cache_;
+
DISALLOW_ASSIGN(FontFallback);
};
« no previous file with comments | « no previous file | content/child/dwrite_font_proxy/font_fallback_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698