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 d848db39000f8f72fae757e1f49307b62399d213..4cd583831ecf3010729206f882b8c505c9781b78 100644 |
| --- a/content/common/font_warmup_win.cc |
| +++ b/content/common/font_warmup_win.cc |
| @@ -11,10 +11,13 @@ |
| #include "base/win/iat_patch_function.h" |
| #include "base/win/windows_version.h" |
| #include "content/public/common/dwrite_font_platform_win.h" |
| +#include "skia/ext/fontmgr_default_win.h" |
| +#include "skia/ext/refptr.h" |
| #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
| #include "third_party/skia/include/core/SkPaint.h" |
| #include "third_party/skia/include/ports/SkFontMgr.h" |
| #include "third_party/skia/include/ports/SkTypeface_win.h" |
| +#include "ui/gfx/hud_font.h" |
| namespace content { |
| @@ -206,4 +209,23 @@ SkFontMgr* GetPreSandboxWarmupFontMgr() { |
| return g_warmup_fontmgr; |
| } |
| +void WarmupDirectWrite() { |
| + static bool warmup_initialized = false; |
| + if (warmup_initialized) |
| + return; |
| + warmup_initialized = true; |
|
jam
2015/09/21 21:26:26
I don't see why these first four lines are needed?
|
| + // The objects used here are intentionally not freed as we want the Skia |
| + // code to use these objects after warmup. |
| + SetDefaultSkiaFactory(GetPreSandboxWarmupFontMgr()); |
| + |
| + // We need to warm up *some* font for DirectWrite. We also need to pass one |
| + // down for the CC HUD code, so use the same one here. Note that we don't use |
| + // a monospace as would be nice in an attempt to avoid a small startup time |
| + // regression, see http://crbug.com/463613. |
| + skia::RefPtr<SkTypeface> hud_typeface = skia::AdoptRef( |
| + GetPreSandboxWarmupFontMgr()->legacyCreateTypeface("Times New Roman", 0)); |
| + DoPreSandboxWarmupForTypeface(hud_typeface.get()); |
| + gfx::SetHudTypeface(hud_typeface); |
| +} |
| + |
| } // namespace content |