| Index: content/common/sandbox_win.cc
|
| diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
|
| index c311dfd234d585c2ab426890d1e453d97b604657..2fa4b469a96767de9dacaabfdb01174846dc89bc 100644
|
| --- a/content/common/sandbox_win.cc
|
| +++ b/content/common/sandbox_win.cc
|
| @@ -18,6 +18,7 @@
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/win/iat_patch_function.h"
|
| +#include "base/win/registry.h"
|
| #include "base/win/scoped_handle.h"
|
| #include "base/win/scoped_process_information.h"
|
| #include "base/win/windows_version.h"
|
| @@ -603,6 +604,20 @@ bool ShouldUseDirectWrite() {
|
| return true;
|
| #endif
|
|
|
| + // We have logic in renderer_font_platform_win.cc for falling back to safe
|
| + // font list if machine has more than 1750 fonts installed. Users have
|
| + // complained about this as safe font list is usually not sufficient.
|
| + // We now disable direct write (gdi) if we encounter more number
|
| + // of fonts than a threshold (currently 1750).
|
| + // Refer: crbug.com/421305
|
| + const wchar_t kWindowsFontsRegistryKey[] =
|
| + L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
|
| + base::win::RegistryValueIterator reg_iterator(HKEY_LOCAL_MACHINE,
|
| + kWindowsFontsRegistryKey);
|
| + const DWORD kMaxAllowedFontsBeforeFallbackToGDI = 1750;
|
| + if (reg_iterator.ValueCount() >= kMaxAllowedFontsBeforeFallbackToGDI)
|
| + return false;
|
| +
|
| // Otherwise, check the field trial.
|
| const std::string group_name =
|
| base::FieldTrialList::FindFullName("DirectWrite");
|
|
|