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

Unified Diff: content/ppapi_plugin/ppapi_plugin_main.cc

Issue 1325843002: Added directwrite warmup for PPAPI processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_win32k_enable_policy
Patch Set: Moved duplicated code to shared location. Created 5 years, 3 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
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..ed0588721d5fe3a03ff47760d5976f3560de979a 100644
--- a/content/ppapi_plugin/ppapi_plugin_main.cc
+++ b/content/ppapi_plugin/ppapi_plugin_main.cc
@@ -25,8 +25,14 @@
#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/font_warmup_win.h"
#include "sandbox/win/src/sandbox.h"
+#include "third_party/WebKit/public/web/win/WebFontRendering.h"
#include "third_party/skia/include/ports/SkTypeface_win.h"
+#include "ui/gfx/win/direct_write.h"
+#include "ui/gfx/win/dpi.h"
#endif
#if defined(OS_CHROMEOS)
@@ -57,6 +63,7 @@ void SkiaPreCacheFont(const LOGFONT& logfont) {
ppapi::proxy::PluginGlobals::Get()->PreCacheFontForFlash(
reinterpret_cast<const void*>(&logfont));
}
+
jam 2015/09/21 21:26:26 undo
#endif
} // namespace
@@ -135,7 +142,17 @@ int PpapiPluginMain(const MainFunctionParams& parameters) {
new PpapiThread(parameters.command_line, false)); // Not a broker.
#if defined(OS_WIN)
- SkTypeface_SetEnsureLOGFONTAccessibleProc(SkiaPreCacheFont);
+ if (!base::win::IsUser32AndGdi32Available())
+ 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();

Powered by Google App Engine
This is Rietveld 408576698