| Index: content/ppapi_plugin/ppapi_plugin_main.cc
|
| diff --git a/content/ppapi_plugin/ppapi_plugin_main.cc b/content/ppapi_plugin/ppapi_plugin_main.cc
|
| index b20bdd934ec7c8c252494e409ae833b47dc72f46..761ebf31ffd24c8012de51531278721a06f230dd 100644
|
| --- a/content/ppapi_plugin/ppapi_plugin_main.cc
|
| +++ b/content/ppapi_plugin/ppapi_plugin_main.cc
|
| @@ -25,8 +25,18 @@
|
| #include "ui/base/ui_base_switches.h"
|
|
|
| #if defined(OS_WIN)
|
| +#include "base/win/win_util.h"
|
| +#include "base/win/windows_version.h"
|
| +#include "content/common/render_font_warmup_win.h"
|
| #include "sandbox/win/src/sandbox.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/ports/SkFontMgr.h"
|
| #include "third_party/skia/include/ports/SkTypeface_win.h"
|
| +#include "ui/gfx/hud_font.h"
|
| +#include "ui/gfx/win/direct_write.h"
|
| +#include "ui/gfx/win/dpi.h"
|
| #endif
|
|
|
| #if defined(OS_CHROMEOS)
|
| @@ -57,6 +67,22 @@ void SkiaPreCacheFont(const LOGFONT& logfont) {
|
| ppapi::proxy::PluginGlobals::Get()->PreCacheFontForFlash(
|
| reinterpret_cast<const void*>(&logfont));
|
| }
|
| +
|
| +void WarmupDirectWrite() {
|
| + // 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);
|
| +}
|
| +
|
| #endif
|
|
|
| } // namespace
|
| @@ -135,7 +161,17 @@ int PpapiPluginMain(const MainFunctionParams& parameters) {
|
| new PpapiThread(parameters.command_line, false)); // Not a broker.
|
|
|
| #if defined(OS_WIN)
|
| - SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont);
|
| + if (IsWin32kLockdownEnabled())
|
| + gfx::win::MaybeInitializeDirectWrite();
|
| + bool use_direct_write = gfx::win::IsDirectWriteEnabled();
|
| + if (use_direct_write) {
|
| + WarmupDirectWrite();
|
| + } else {
|
| + SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont);
|
| + }
|
| +
|
| + blink::WebFontRendering::setUseDirectWrite(use_direct_write);
|
| + blink::WebFontRendering::setDeviceScaleFactor(gfx::GetDPIScale());
|
| #endif
|
|
|
| main_message_loop.Run();
|
|
|