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

Unified Diff: content/common/font_warmup_win.cc

Issue 1557513002: Add logic to switch to DirectWrite font proxy via field trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extraneous namespace qualification Created 4 years, 11 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/dwrite_font_platform_win.cc ('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 f9825fef0c734f36243cd7be4259db2e596b8a1f..2968218c231a88281bdca074aa94eafc8bb30dbe 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"
@@ -35,6 +36,7 @@ namespace content {
namespace {
+// The Skia font manager, used for the life of the process (leaked at the end).
SkFontMgr* g_warmup_fontmgr = nullptr;
base::win::IATPatchFunction g_iat_patch_open_sc_manager;
@@ -255,6 +257,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,7 +489,10 @@ SkFontMgr* GetPreSandboxWarmupFontMgr() {
}
GdiFontPatchData* PatchGdiFontEnumeration(const base::FilePath& path) {
- // We assume the fontmgr is already warmed up before calling this.
+ if (ShouldUseDirectWriteFontProxyFieldTrial() && !g_warmup_fontmgr)
+ g_warmup_fontmgr = SkFontMgr_New_DirectWrite();
+ // If not using the font proxy, we assume |g_warmup_fontmgr| is already
+ // initialized before this function is called.
DCHECK(g_warmup_fontmgr);
return new GdiFontPatchDataImpl(path);
}
« no previous file with comments | « content/common/dwrite_font_platform_win.cc ('k') | content/common/sandbox_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698