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

Unified Diff: content/child/font_warmup_win.cc

Issue 1691073002: Add plumbing in blink to allow overriding the skia font manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge to head Created 4 years, 10 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/child/font_warmup_win.cc
diff --git a/content/child/font_warmup_win.cc b/content/child/font_warmup_win.cc
index be532df2196d72111b7d2628ddbd310d81cc8fd6..076915588496c48182995c40bd8217f386cfe973 100644
--- a/content/child/font_warmup_win.cc
+++ b/content/child/font_warmup_win.cc
@@ -130,25 +130,6 @@ void CreateDirectWriteFactory(IDWriteFactory** factory) {
reinterpret_cast<IUnknown**>(factory))));
}
-HRESULT STDMETHODCALLTYPE StubFontCollection(IDWriteFactory* factory,
- IDWriteFontCollection** col,
- BOOL checkUpdates) {
- // We always return pre-created font collection from here.
- IDWriteFontCollection* custom_collection = GetCustomFontCollection(factory);
- DCHECK(custom_collection != nullptr);
- *col = custom_collection;
- return S_OK;
-}
-
-void PatchDWriteFactory(IDWriteFactory* factory) {
- const unsigned int kGetSystemFontCollectionVTableIndex = 3;
-
- PROC* vtable = *reinterpret_cast<PROC**>(factory);
- PROC* function_ptr = &vtable[kGetSystemFontCollectionVTableIndex];
- void* stub_function = &StubFontCollection;
- base::win::ModifyCode(function_ptr, &stub_function, sizeof(PROC));
-}
-
// Class to fake out a DC or a Font object. Maintains a reference to a
// SkTypeFace to emulate the simple operation of a DC and Font.
class FakeGdiObject : public base::RefCountedThreadSafe<FakeGdiObject> {
@@ -478,12 +459,9 @@ SkFontMgr* GetPreSandboxWarmupFontMgr() {
IDWriteFactory* factory;
CreateDirectWriteFactory(&factory);
- GetCustomFontCollection(factory);
-
- PatchDWriteFactory(factory);
-
- blink::WebFontRendering::setDirectWriteFactory(factory);
- g_warmup_fontmgr = SkFontMgr_New_DirectWrite(factory);
+ g_warmup_fontmgr =
+ SkFontMgr_New_DirectWrite(factory, GetCustomFontCollection(factory));
+ blink::WebFontRendering::setSkiaFontManager(g_warmup_fontmgr);
}
return g_warmup_fontmgr;
}

Powered by Google App Engine
This is Rietveld 408576698