Commit 0b55e949 authored by Olivier Yiptong's avatar Olivier Yiptong Committed by Commit Bot

FontAccess: Measure enumeration timing on Mac

This change logs the time it takes to enumerate fonts on Mac using a UMA histogram.

Bug: 1043306
Change-Id: I9bbed21d4004d6c2c30184bf6770360e7cb7c5ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2403589
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Auto-Submit: Olivier Yiptong <oyiptong@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805845}
parent 3e085ec3
......@@ -36,6 +36,8 @@
#include "base/location.h"
#include "base/mac/foundation_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/timer/elapsed_timer.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/font_family_names.h"
#include "third_party/blink/renderer/platform/fonts/font_description.h"
......@@ -327,6 +329,7 @@ std::unique_ptr<FontPlatformData> FontCache::CreateFontPlatformData(
std::vector<FontEnumerationEntry> FontCache::EnumeratePlatformAvailableFonts() {
@autoreleasepool {
base::ElapsedTimer timer;
std::vector<FontEnumerationEntry> output;
CFTypeRef values[1] = {kCFBooleanTrue};
......@@ -351,6 +354,9 @@ std::vector<FontEnumerationEntry> FontCache::EnumeratePlatformAvailableFonts() {
output.push_back(FontEnumerationEntry{String(postscript_name),
String(full_name), String(family)});
}
UMA_HISTOGRAM_MEDIUM_TIMES("Fonts.AccessAPI.EnumerationTime",
timer.Elapsed());
return output;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment