Chromium Code Reviews| Index: content/common/font_warmup_win.cc |
| diff --git a/content/common/font_warmup_win.cc b/content/common/font_warmup_win.cc |
| index f9825fef0c734f36243cd7be4259db2e596b8a1f..73f5dbb06c424ca0d13774e8b0f9bd28a5139a68 100644 |
| --- a/content/common/font_warmup_win.cc |
| +++ b/content/common/font_warmup_win.cc |
| @@ -23,6 +23,7 @@ |
| #include "base/win/iat_patch_function.h" |
| #include "base/win/windows_version.h" |
| #include "content/public/common/dwrite_font_platform_win.h" |
| +#include "ppapi/shared_impl/proxy_lock.h" |
| #include "skia/ext/fontmgr_default_win.h" |
| #include "skia/ext/refptr.h" |
| #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
| @@ -255,6 +256,7 @@ skia::RefPtr<SkTypeface> GetTypefaceFromLOGFONT(const LOGFONTW* log_font) { |
| : SkFontStyle::kUpright_Slant); |
| std::string family_name = base::WideToUTF8(log_font->lfFaceName); |
| + ppapi::ProxyAutoLock lock; // Needed for DirectWrite font proxy. |
| return skia::AdoptRef( |
| g_warmup_fontmgr->matchFamilyStyle(family_name.c_str(), style)); |
| } |
| @@ -486,8 +488,12 @@ SkFontMgr* GetPreSandboxWarmupFontMgr() { |
| } |
| GdiFontPatchData* PatchGdiFontEnumeration(const base::FilePath& path) { |
| - // We assume the fontmgr is already warmed up before calling this. |
| - DCHECK(g_warmup_fontmgr); |
| + if (content::ShouldUseDirectWriteFontProxyFieldTrial()) { |
|
fdoray
2015/12/30 01:15:08
// If the font cache is used, |g_warmup_fontmgr| i
Ilya Kulshin
2015/12/30 01:59:46
Good point about the leak. From tracing the code i
|
| + g_warmup_fontmgr = SkFontMgr_New_DirectWrite(); |
| + } else { |
| + // We assume the fontmgr is already warmed up before calling this. |
| + DCHECK(g_warmup_fontmgr); |
| + } |
| return new GdiFontPatchDataImpl(path); |
| } |