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

Unified Diff: ui/gfx/win/direct_write.cc

Issue 667013003: 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@master
Patch Set: If it is hidpi then we will not use GDI irrespective of number of fonts. 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: ui/gfx/win/direct_write.cc
diff --git a/ui/gfx/win/direct_write.cc b/ui/gfx/win/direct_write.cc
index fcc185c433dc17acdd1151b34ed421d05e80c18b..7ca1f00c17ccf70ce0b4397f7cebadc08c2ecea1 100644
--- a/ui/gfx/win/direct_write.cc
+++ b/ui/gfx/win/direct_write.cc
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
+#include "base/win/registry.h"
#include "base/win/windows_version.h"
#include "ui/gfx/switches.h"
#include "ui/gfx/win/dpi.h"
@@ -38,6 +39,14 @@ bool ShouldUseDirectWrite() {
if (gfx::GetDPIScale() > 1.0f)
return true;
+ const wchar_t kWindowsFontsRegistryKey[] =
cpu_(ooo_6.6-7.5) 2014/10/20 20:01:10 lets add a comment here with the bug link.
Shrikant Kelkar 2014/10/20 20:14:48 Done.
+ 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