chromium/chrome/browser/font_family_cache.h

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_FONT_FAMILY_CACHE_H_
#define CHROME_BROWSER_FONT_FAMILY_CACHE_H_

#include <string>
#include <unordered_map>

#include "base/gtest_prod_util.h"
#include "base/memory/raw_ptr.h"
#include "base/supports_user_data.h"
#include "chrome/browser/font_pref_change_notifier.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"

class PrefService;
class Profile;

FORWARD_DECLARE_TEST(FontFamilyCacheTest, Caching);

// Caches font family preferences associated with a PrefService. This class
// relies on the assumption that each concatenation of map_name + '.' + script
// is a unique string. It also relies on the assumption that the (const char*)
// keys used in both inner and outer maps are compile time constants.
// This class caches the strings necessary to update
// "blink::web_pref::ScriptFontFamilyMap". This is necessary since Chrome
// attempts to update blink::web_pref::ScriptFontFamilyMap 20000 times at
// startup. See https://crbug.com/308095.
class FontFamilyCache : public base::SupportsUserData::Data {};

#endif  // CHROME_BROWSER_FONT_FAMILY_CACHE_H_