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

Unified Diff: content/child/font_warmup_win.cc

Issue 1847173002: Revert "Revert of Remove font cache code (patchset #3 id:40001 of https://codereview.chromium.org/1… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test expectations to rebaseline tests on Win10 Created 4 years, 9 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/child/font_warmup_win.h ('k') | content/common/dwrite_font_platform_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/font_warmup_win.cc
diff --git a/content/child/font_warmup_win.cc b/content/child/font_warmup_win.cc
index 33d18075f642e518a148ade4e5808f83d791a259..e3c07115ff09b669a0a3fd07e27a72823efea13c 100644
--- a/content/child/font_warmup_win.cc
+++ b/content/child/font_warmup_win.cc
@@ -22,12 +22,9 @@
#include "base/trace_event/trace_event.h"
#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"
-#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"
@@ -99,36 +96,6 @@ NTSTATUS WINAPI NtALpcConnectPortPatch(HANDLE* port_handle,
return STATUS_ACCESS_DENIED;
}
-// Windows-only DirectWrite support. These warm up the DirectWrite paths
-// before sandbox lock down to allow Skia access to the Font Manager service.
-void CreateDirectWriteFactory(IDWriteFactory** factory) {
- typedef decltype(DWriteCreateFactory)* DWriteCreateFactoryProc;
- HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll");
- // TODO(scottmg): Temporary code to track crash in http://crbug.com/387867.
- if (!dwrite_dll) {
- DWORD load_library_get_last_error = GetLastError();
- base::debug::Alias(&dwrite_dll);
- base::debug::Alias(&load_library_get_last_error);
- CHECK(false);
- }
-
- PatchServiceManagerCalls();
-
- DWriteCreateFactoryProc dwrite_create_factory_proc =
- reinterpret_cast<DWriteCreateFactoryProc>(
- GetProcAddress(dwrite_dll, "DWriteCreateFactory"));
- // TODO(scottmg): Temporary code to track crash in http://crbug.com/387867.
- if (!dwrite_create_factory_proc) {
- DWORD get_proc_address_get_last_error = GetLastError();
- base::debug::Alias(&dwrite_create_factory_proc);
- base::debug::Alias(&get_proc_address_get_last_error);
- CHECK(false);
- }
- CHECK(SUCCEEDED(dwrite_create_factory_proc(
- DWRITE_FACTORY_TYPE_ISOLATED, __uuidof(IDWriteFactory),
- reinterpret_cast<IUnknown**>(factory))));
-}
-
// 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> {
@@ -446,30 +413,9 @@ void PatchServiceManagerCalls() {
DCHECK(patched == 0);
}
-void DoPreSandboxWarmupForTypeface(SkTypeface* typeface) {
- SkPaint paint_warmup;
- paint_warmup.setTypeface(typeface);
- wchar_t glyph = L'S';
- paint_warmup.measureText(&glyph, 2);
-}
-
-SkFontMgr* GetPreSandboxWarmupFontMgr() {
- if (!g_warmup_fontmgr) {
- IDWriteFactory* factory;
- CreateDirectWriteFactory(&factory);
-
- g_warmup_fontmgr =
- SkFontMgr_New_DirectWrite(factory, GetCustomFontCollection(factory));
- blink::WebFontRendering::setSkiaFontManager(g_warmup_fontmgr);
- }
- return g_warmup_fontmgr;
-}
-
GdiFontPatchData* PatchGdiFontEnumeration(const base::FilePath& path) {
- if (ShouldUseDirectWriteFontProxyFieldTrial() && !g_warmup_fontmgr)
+ if (!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);
}
@@ -486,19 +432,4 @@ void SetPreSandboxWarmupFontMgrForTesting(SkFontMgr* fontmgr) {
g_warmup_fontmgr = fontmgr;
}
-void WarmupDirectWrite() {
- TRACE_EVENT0("startup", "content::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. 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());
-}
-
} // namespace content
« no previous file with comments | « content/child/font_warmup_win.h ('k') | content/common/dwrite_font_platform_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698