| Index: chrome/browser/chrome_content_browser_client.cc
|
| diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
| index 87b4810c84496bca98e654eca78011517dbd2d77..38d2e17099c0027dd43e406f45e7b92cc74b04ff 100644
|
| --- a/chrome/browser/chrome_content_browser_client.cc
|
| +++ b/chrome/browser/chrome_content_browser_client.cc
|
| @@ -39,6 +39,7 @@
|
| #include "chrome/browser/extensions/extension_web_ui.h"
|
| #include "chrome/browser/extensions/extension_webkit_preferences.h"
|
| #include "chrome/browser/extensions/suggest_permission_util.h"
|
| +#include "chrome/browser/font_family_cache.h"
|
| #include "chrome/browser/geolocation/chrome_access_token_store.h"
|
| #include "chrome/browser/geolocation/geolocation_permission_context.h"
|
| #include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
|
| @@ -502,19 +503,24 @@ bool CertMatchesFilter(const net::X509Certificate& cert,
|
| }
|
|
|
| #if !defined(OS_ANDROID)
|
| -// Fills |map| with the per-script font prefs under path |map_name|.
|
| -void FillFontFamilyMap(const PrefService* prefs,
|
| +void FillFontFamilyMap(PrefService* prefs,
|
| const char* map_name,
|
| content::ScriptFontFamilyMap* map) {
|
| - // TODO(falken): Get rid of the brute-force scan over possible
|
| - // (font family / script) combinations - see http://crbug.com/308095.
|
| - for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) {
|
| - const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i];
|
| - std::string pref_name = base::StringPrintf("%s.%s", map_name, script);
|
| - std::string font_family = prefs->GetString(pref_name.c_str());
|
| - if (!font_family.empty())
|
| - (*map)[script] = base::UTF8ToUTF16(font_family);
|
| + typedef base::ScopedPtrHashMap<const char*, PrefServiceCache>
|
| + PrefServiceCacheMap;
|
| + PrefServiceCacheMap* caches = prefs->GetPrefsCaches();
|
| + chrome::FontFamilyCache* cache;
|
| + PrefServiceCacheMap::const_iterator it =
|
| + caches->find(chrome::kFontFamilyCacheKey);
|
| + if (it == caches->end()) {
|
| + scoped_ptr<PrefServiceCache> new_cache(new chrome::FontFamilyCache(prefs));
|
| + cache = static_cast<chrome::FontFamilyCache*>(new_cache.get());
|
| + caches->add(chrome::kFontFamilyCacheKey, new_cache.Pass());
|
| + } else {
|
| + cache = static_cast<chrome::FontFamilyCache*>(it->second);
|
| }
|
| +
|
| + cache->FillFontFamilyMap(map_name, map);
|
| }
|
|
|
| #if defined(OS_POSIX) && !defined(OS_MACOSX)
|
|
|