// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FONT_MATCHING_METRICS_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FONT_MATCHING_METRICS_H_ #include "base/task/single_thread_task_runner.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "third_party/blink/public/common/privacy_budget/identifiable_token.h" #include "third_party/blink/public/common/privacy_budget/identifiable_token_builder.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/platform/fonts/font_description.h" #include "third_party/blink/renderer/platform/fonts/font_fallback_priority.h" #include "third_party/blink/renderer/platform/fonts/simple_font_data.h" #include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/wtf/hash_functions.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" namespace blink { // A (generic) wrapper around IdentifiableToken to enable its use as a HashMap // key. The |token| represents the parameters by which a font was looked up. // However, if |is_deleted_value| or |is_empty_value|, this key represents an // object for HashMap's internal use only. In that case, |token| is left as a // default value. struct IdentifiableTokenKey { … }; // A helper that defines the hash function and the invalid 'empty value' that // HashMap should use internally. struct IdentifiableTokenKeyHashTraits : WTF::SimpleClassHashTraits<IdentifiableTokenKey> { … }; // Tracks and reports UKM metrics of attempted font family match attempts (both // successful and not successful) by the current frame. // // Each local font lookup is also reported as is each mapping of generic font // family name to its corresponding actual font family names. Local font lookups // are deduped according to the family name looked up in the FontCache and the // FontSelectionRequest parameters (i.e. weight, width and slope). Generic font // family lookups are de-duped according to the generic name, the // GenericFamilyType and the script. Both types of lookup events are reported // regularly. class FontMatchingMetrics { … }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_FONT_MATCHING_METRICS_H_