summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshrikant <shrikant@chromium.org>2014-09-03 22:00:24 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-04 05:02:54 +0000
commit2d514327ee39f1fecc5a993a7884bcb2b58dea0c (patch)
tree65559d63aa29939304e521fa0028781f8d0ad0cd
parent4ff79fa7b6477808bdff2bb7589da312269d8ec2 (diff)
downloadchromium_src-2d514327ee39f1fecc5a993a7884bcb2b58dea0c.zip
chromium_src-2d514327ee39f1fecc5a993a7884bcb2b58dea0c.tar.gz
chromium_src-2d514327ee39f1fecc5a993a7884bcb2b58dea0c.tar.bz2
Code to take into account font path specified in registry which matches system font folder. Also adding UMA to measure font load times.
R=scottmg,cpu,ananta BUG=408393 Review URL: https://codereview.chromium.org/541543002 Cr-Commit-Position: refs/heads/master@{#293261}
-rw-r--r--content/renderer/renderer_font_platform_win.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/content/renderer/renderer_font_platform_win.cc b/content/renderer/renderer_font_platform_win.cc
index b125fe7..4812a4e 100644
--- a/content/renderer/renderer_font_platform_win.cc
+++ b/content/renderer/renderer_font_platform_win.cc
@@ -17,6 +17,7 @@
#include "base/files/memory_mapped_file.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
+#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
@@ -266,6 +267,9 @@ bool FontCollectionLoader::LoadFontListFromRegistry() {
return false;
}
+ base::FilePath system_font_path;
+ PathService::Get(base::DIR_WINDOWS_FONTS, &system_font_path);
+
std::wstring name;
std::wstring value;
for (DWORD idx = 0; idx < regkey.GetValueCount(); idx++) {
@@ -276,11 +280,16 @@ bool FontCollectionLoader::LoadFontListFromRegistry() {
// we will ignore all other registry entries.
std::vector<base::FilePath::StringType> components;
path.GetComponents(&components);
- if (components.size() == 1) {
- reg_fonts_.push_back(value.c_str());
+ if (components.size() == 1 ||
+ base::FilePath::CompareEqualIgnoreCase(system_font_path.value(),
+ path.DirName().value())) {
+ reg_fonts_.push_back(path.BaseName().value());
}
}
}
+ UMA_HISTOGRAM_COUNTS("DirectWrite.Fonts.Loaded", reg_fonts_.size());
+ UMA_HISTOGRAM_COUNTS("DirectWrite.Fonts.Ignored",
+ regkey.GetValueCount() - reg_fonts_.size());
return true;
}
@@ -366,6 +375,8 @@ IDWriteFontCollection* GetCustomFontCollection(IDWriteFactory* factory) {
CHECK(SUCCEEDED(hr));
CHECK(g_font_collection.Get() != NULL);
+ UMA_HISTOGRAM_TIMES("DirectWrite.Fonts.LoadTime", time_delta);
+
base::debug::ClearCrashKey(kFontKeyName);
return g_font_collection.Get();