Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1029)

Side by Side Diff: third_party/WebKit/Source/platform/LayoutLocale.cpp

Issue 2671933002: Migrate WTF::HashMap::add() to ::insert() (Closed)
Patch Set: rebase, add TODOs Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/LayoutLocale.h" 5 #include "platform/LayoutLocale.h"
6 6
7 #include "platform/Language.h" 7 #include "platform/Language.h"
8 #include "platform/fonts/AcceptLanguagesResolver.h" 8 #include "platform/fonts/AcceptLanguagesResolver.h"
9 #include "platform/text/LocaleToScriptMapping.h" 9 #include "platform/text/LocaleToScriptMapping.h"
10 #include "wtf/HashMap.h" 10 #include "wtf/HashMap.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 static LayoutLocaleMap& getLocaleMap() { 121 static LayoutLocaleMap& getLocaleMap() {
122 DEFINE_STATIC_LOCAL(LayoutLocaleMap, localeMap, ()); 122 DEFINE_STATIC_LOCAL(LayoutLocaleMap, localeMap, ());
123 return localeMap; 123 return localeMap;
124 } 124 }
125 125
126 const LayoutLocale* LayoutLocale::get(const AtomicString& locale) { 126 const LayoutLocale* LayoutLocale::get(const AtomicString& locale) {
127 if (locale.isNull()) 127 if (locale.isNull())
128 return nullptr; 128 return nullptr;
129 129
130 auto result = getLocaleMap().add(locale, nullptr); 130 auto result = getLocaleMap().insert(locale, nullptr);
131 if (result.isNewEntry) 131 if (result.isNewEntry)
132 result.storedValue->value = adoptRef(new LayoutLocale(locale)); 132 result.storedValue->value = adoptRef(new LayoutLocale(locale));
133 return result.storedValue->value.get(); 133 return result.storedValue->value.get();
134 } 134 }
135 135
136 const LayoutLocale& LayoutLocale::getDefault() { 136 const LayoutLocale& LayoutLocale::getDefault() {
137 if (s_default) 137 if (s_default)
138 return *s_default; 138 return *s_default;
139 139
140 AtomicString locale = defaultLanguage(); 140 AtomicString locale = defaultLanguage();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 void LayoutLocale::setHyphenationForTesting( 178 void LayoutLocale::setHyphenationForTesting(
179 const AtomicString& localeString, 179 const AtomicString& localeString,
180 PassRefPtr<Hyphenation> hyphenation) { 180 PassRefPtr<Hyphenation> hyphenation) {
181 const LayoutLocale& locale = valueOrDefault(get(localeString)); 181 const LayoutLocale& locale = valueOrDefault(get(localeString));
182 locale.m_hyphenationComputed = true; 182 locale.m_hyphenationComputed = true;
183 locale.m_hyphenation = hyphenation; 183 locale.m_hyphenation = hyphenation;
184 } 184 }
185 185
186 } // namespace blink 186 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USB.cpp ('k') | third_party/WebKit/Source/platform/audio/HRTFDatabaseLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698