perf: avoid unnecessary base value clone (#38537)

This commit is contained in:
Charles Kerr 2023-06-02 08:38:29 -05:00 committed by GitHub
parent d818f35ad4
commit f247ca3f62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 28 deletions

View file

@ -329,10 +329,8 @@ void ElectronBrowserContext::InitPrefs() {
#endif
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
base::Value::List current_dictionaries =
prefs()->GetList(spellcheck::prefs::kSpellCheckDictionaries).Clone();
// No configured dictionaries, the default will be en-US
if (current_dictionaries.empty()) {
if (prefs()->GetList(spellcheck::prefs::kSpellCheckDictionaries).empty()) {
std::string default_code = spellcheck::GetCorrespondingSpellCheckLanguage(
base::i18n::GetConfiguredLocale());
if (!default_code.empty()) {