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

Unified Diff: content/common/font_warmup_win.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: Removed init check. 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
« no previous file with comments | « content/common/font_warmup_win.h ('k') | content/common/sandbox_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..081d9b877dd85b4a02888788024b75382aa9bdbf 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,19 @@ SkFontMgr* GetPreSandboxWarmupFontMgr() {
return g_warmup_fontmgr;
}
+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);
+}
+
} // namespace content
« no previous file with comments | « content/common/font_warmup_win.h ('k') | content/common/sandbox_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698