Chromium Code Reviews| Index: content/zygote/zygote_main_linux.cc |
| diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc |
| index c30e1084a92c6eecaf07417f30c3d5464b9b0f8a..5b32a258125e36256ff45d3305e68503b8e93681 100644 |
| --- a/content/zygote/zygote_main_linux.cc |
| +++ b/content/zygote/zygote_main_linux.cc |
| @@ -46,6 +46,7 @@ |
| #include "sandbox/linux/services/namespace_sandbox.h" |
| #include "sandbox/linux/services/thread_helpers.h" |
| #include "sandbox/linux/suid/client/setuid_sandbox_client.h" |
| +#include "third_party/WebKit/public/web/linux/WebFontRendering.h" |
| #include "third_party/icu/source/i18n/unicode/timezone.h" |
| #include "third_party/skia/include/ports/SkFontConfigInterface.h" |
| @@ -67,6 +68,8 @@ |
| #include <sanitizer/coverage_interface.h> |
| #endif |
| +#include "third_party/skia/include/ports/SkFontMgr_android.h" |
|
rickyz (no longer on Chrome)
2016/02/25 23:56:56
Move this up with the other skia include
Khushal
2016/02/26 19:21:36
Done.
|
| + |
| namespace content { |
| namespace { |
| @@ -344,8 +347,32 @@ static void ZygotePreSandboxInit() { |
| #if defined(ENABLE_WEBRTC) |
| InitializeWebRtcModule(); |
| #endif |
| + |
| SkFontConfigInterface::SetGlobal( |
| new FontConfigIPC(GetSandboxFD()))->unref(); |
| + |
| + // Set the android SkFontMgr for blink. We need to ensure this is done |
| + // before the sandbox is initialized to allow the font manager to access |
| + // font configuration files on disk. |
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kAndroidFontsPath)) { |
|
rickyz (no longer on Chrome)
2016/02/25 23:56:56
nit: Indent extra 4 spaces here (unfortunately, th
Khushal
2016/02/26 19:21:36
Ran git cl format on this, looks like it was just
|
| + std::string android_fonts_dir = |
| + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| + switches::kAndroidFontsPath); |
| + |
| + if (android_fonts_dir.size() > 0 && android_fonts_dir.back() != '/') |
| + android_fonts_dir += '/'; |
| + std::string font_config = android_fonts_dir + "fonts.xml"; |
| + SkFontMgr_Android_CustomFonts custom = { |
|
rickyz (no longer on Chrome)
2016/02/25 23:56:56
Can you initialize each member individually, like
Khushal
2016/02/26 19:21:36
Done.
|
| + SkFontMgr_Android_CustomFonts::SystemFontUse::kOnlyCustom, |
| + android_fonts_dir.c_str(), |
| + font_config.c_str(), |
| + nullptr, |
| + true, |
| + }; |
| + |
| + blink::WebFontRendering::setSkiaFontManager(SkFontMgr_New_Android(&custom)); |
| + } |
| } |
| static bool CreateInitProcessReaper(base::Closure* post_fork_parent_callback) { |