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

Unified Diff: content/common/sandbox_win.cc

Issue 671743002: Disable direct write if font count in registry is greater than or equal to threshold (currently 175… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_win.cc
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc
index 1f13fb8f7afd07c64d15f3bb61135b4cbb93e3f3..ed61bfa555958d0d9e15185c4df80c2128a207ff 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");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698