#include "third_party/blink/renderer/core/frame/font_matching_metrics.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/single_thread_task_runner.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h"
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_token.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/dactyloscoper.h"
#include "third_party/blink/renderer/platform/fonts/font_global_context.h"
#include "third_party/blink/renderer/platform/privacy_budget/identifiability_digest_helpers.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
namespace {
template <typename T>
HashSet<T> SetIntersection(const HashSet<T>& a, const HashSet<T>& b) { … }
}
namespace blink {
namespace {
bool IdentifiabilityStudyShouldSampleFonts() { … }
}
FontMatchingMetrics::FontMatchingMetrics(
ExecutionContext* execution_context,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
void FontMatchingMetrics::ReportSuccessfulFontFamilyMatch(
const AtomicString& font_family_name) { … }
void FontMatchingMetrics::ReportFailedFontFamilyMatch(
const AtomicString& font_family_name) { … }
void FontMatchingMetrics::ReportSuccessfulLocalFontMatch(
const AtomicString& font_name) { … }
void FontMatchingMetrics::ReportFailedLocalFontMatch(
const AtomicString& font_name) { … }
void FontMatchingMetrics::ReportLocalFontExistenceByUniqueOrFamilyName(
const AtomicString& font_name,
bool font_exists) { … }
void FontMatchingMetrics::ReportLocalFontExistenceByUniqueNameOnly(
const AtomicString& font_name,
bool font_exists) { … }
void FontMatchingMetrics::InsertFontHashIntoMap(IdentifiableTokenKey input_key,
const SimpleFontData* font_data,
TokenToTokenHashMap& hash_map) { … }
IdentifiableTokenBuilder
FontMatchingMetrics::GetTokenBuilderWithFontSelectionRequest(
const FontDescription& font_description) { … }
void FontMatchingMetrics::ReportFontLookupByUniqueOrFamilyName(
const AtomicString& name,
const FontDescription& font_description,
const SimpleFontData* resulting_font_data) { … }
void FontMatchingMetrics::ReportFontLookupByUniqueNameOnly(
const AtomicString& name,
const FontDescription& font_description,
const SimpleFontData* resulting_font_data,
bool is_loading_fallback) { … }
void FontMatchingMetrics::ReportFontLookupByFallbackCharacter(
UChar32 fallback_character,
FontFallbackPriority fallback_priority,
const FontDescription& font_description,
const SimpleFontData* resulting_font_data) { … }
void FontMatchingMetrics::ReportLastResortFallbackFontLookup(
const FontDescription& font_description,
const SimpleFontData* resulting_font_data) { … }
void FontMatchingMetrics::ReportFontFamilyLookupByGenericFamily(
const AtomicString& generic_font_family_name,
UScriptCode script,
FontDescription::GenericFamilyType generic_family_type,
const AtomicString& resulting_font_name) { … }
void FontMatchingMetrics::ReportEmojiSegmentGlyphCoverage(
unsigned num_clusters,
unsigned num_broken_clusters) { … }
void FontMatchingMetrics::PublishIdentifiabilityMetrics() { … }
void FontMatchingMetrics::PublishEmojiGlyphMetrics() { … }
void FontMatchingMetrics::OnFontLookup() { … }
void FontMatchingMetrics::IdentifiabilityMetricsTimerFired(TimerBase*) { … }
void FontMatchingMetrics::PublishAllMetrics() { … }
int64_t FontMatchingMetrics::GetHashForFontData(
const SimpleFontData* font_data) { … }
IdentifiableToken FontMatchingMetrics::GetPostScriptNameTokenForFontData(
const SimpleFontData* font_data) { … }
}