Commit 1399f24c authored by scottmg@chromium.org's avatar scottmg@chromium.org

Customize SkFontMgr::Factory to control DirectWrite vs. GDI selection

Move SkFontMgr::Factory to skia/ext so that we can use the warmed-up
sandbox version when using DirectWrite that's created by content/. This
avoids the previous default behaviour of creating a GDI SkFontMgr which
is always wrong when DirectWrite is being used (and causes crashes
when --enable_win32k_renderer_lockdown is enabled).

R=jamesr@chromium.org,bungeman@google.com
BUG=385926,356950,385717
TEST=http://www.effectgames.com/demos/canvascycle/ http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_canvas_filltext and enabling FPS in about:flags with both --enable_win32k_renderer_lockdown and --disable-direct-write

Review URL: https://codereview.chromium.org/344653002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278222 0039d316-1c4b-4281-b951-d872f2087c98
parent f1b75a3d
......@@ -18,6 +18,7 @@
#include "content/public/renderer/render_thread.h"
#include "content/renderer/render_thread_impl.h"
#include "sandbox/win/src/sandbox.h"
#include "skia/ext/fontmgr_default_win.h"
#include "skia/ext/vector_platform_device_emf_win.h"
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
#include "third_party/WebKit/public/web/win/WebFontRendering.h"
......@@ -60,6 +61,7 @@ void WarmupDirectWrite() {
SkTypeface* typeface =
GetPreSandboxWarmupFontMgr()->legacyCreateTypeface("Times New Roman", 0);
DoPreSandboxWarmupForTypeface(typeface);
SetDefaultSkiaFactory(GetPreSandboxWarmupFontMgr());
}
} // namespace
......
......@@ -260,6 +260,8 @@ component("skia") {
"ext/convolver.h",
"ext/event_tracer_impl.cc",
"ext/event_tracer_impl.h",
"ext/fontmgr_default_win.cc",
"ext/fontmgr_default_win.h",
"ext/google_logging.cc",
"ext/image_operations.cc",
"ext/image_operations.h",
......@@ -425,7 +427,6 @@ component("skia") {
} else {
sources -= [
"//third_party/skia/src/ports/SkFontHost_win.cpp",
"//third_party/skia/src/ports/SkFontMgr_default_gdi.cpp",
"//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
"//third_party/skia/src/ports/SkOSFile_win.cpp",
"//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp",
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "skia/ext/fontmgr_default_win.h"
#include "third_party/skia/include/ports/SkFontMgr.h"
#include "third_party/skia/include/ports/SkTypeface_win.h"
namespace {
SkFontMgr* g_default_fontmgr;
} // namespace
void SetDefaultSkiaFactory(SkFontMgr* fontmgr) {
g_default_fontmgr = fontmgr;
}
SK_API SkFontMgr* SkFontMgr::Factory() {
// This will be set when DirectWrite is in use, and an SkFontMgr has been
// created with the pre-sandbox warmed up one. Otherwise, we fallback to a
// GDI SkFontMgr which is used in the browser.
if (g_default_fontmgr)
return SkRef(g_default_fontmgr);
return SkFontMgr_New_GDI();
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKIA_EXT_FONTMGR_DEFAULT_WIN_H_
#define SKIA_EXT_FONTMGR_DEFAULT_WIN_H_
#include "third_party/skia/include/core/SkTypes.h"
class SkFontMgr;
void SK_API SetDefaultSkiaFactory(SkFontMgr* fontmgr);
#endif // SKIA_EXT_FONTMGR_DEFAULT_WIN_H_
......@@ -38,6 +38,8 @@
'ext/convolver.h',
'ext/event_tracer_impl.cc',
'ext/event_tracer_impl.h',
'ext/fontmgr_default_win.cc',
'ext/fontmgr_default_win.h',
'ext/google_logging.cc',
'ext/image_operations.cc',
'ext/image_operations.h',
......
......@@ -22,7 +22,6 @@
'<(skia_src_path)/ports/SkFontHost_FreeType.cpp',
'<(skia_src_path)/ports/SkFontHost_mac.cpp',
'<(skia_src_path)/ports/SkFontHost_win.cpp',
'<(skia_src_path)/ports/SkFontMgr_default_gdi.cpp',
'<(skia_src_path)/ports/SkFontMgr_win_dw.cpp',
'<(skia_src_path)/ports/SkGlobalInitialization_chromium.cpp',
'<(skia_src_path)/ports/SkImageDecoder_empty.cpp',
......
......@@ -52,7 +52,6 @@
'../third_party/skia/src/ports/SkFontConfigParser_android.cpp',
'../third_party/skia/src/ports/SkFontHost_mac.cpp',
'../third_party/skia/src/ports/SkFontHost_win.cpp',
'../third_party/skia/src/ports/SkFontMgr_default_gdi.cpp',
'../third_party/skia/src/ports/SkFontMgr_win_dw.cpp',
'../third_party/skia/src/ports/SkGlobalInitialization_chromium.cpp',
'../third_party/skia/src/ports/SkOSFile_posix.cpp',
......@@ -342,7 +341,6 @@
],
},{ # not 'OS == "win"'
'sources!': [
'../third_party/skia/src/ports/SkFontMgr_default_gdi.cpp',
'../third_party/skia/src/ports/SkFontMgr_win_dw.cpp',
'../third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp',
'../third_party/skia/src/ports/SkScalerContext_win_dw.cpp',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment