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

Side by Side Diff: third_party/WebKit/Source/wtf/text/TextEncodingRegistry.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
« no previous file with comments | « third_party/WebKit/Source/wtf/HashMapTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2007-2009 Torch Mobile, Inc. 3 * Copyright (C) 2007-2009 Torch Mobile, Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 static void addToTextEncodingNameMap(const char* alias, const char* name) { 162 static void addToTextEncodingNameMap(const char* alias, const char* name) {
163 DCHECK_LE(strlen(alias), maxEncodingNameLength); 163 DCHECK_LE(strlen(alias), maxEncodingNameLength);
164 if (isUndesiredAlias(alias)) 164 if (isUndesiredAlias(alias))
165 return; 165 return;
166 const char* atomicName = textEncodingNameMap->get(name); 166 const char* atomicName = textEncodingNameMap->get(name);
167 DCHECK(strcmp(alias, name) == 0 || atomicName); 167 DCHECK(strcmp(alias, name) == 0 || atomicName);
168 if (!atomicName) 168 if (!atomicName)
169 atomicName = name; 169 atomicName = name;
170 checkExistingName(alias, atomicName); 170 checkExistingName(alias, atomicName);
171 textEncodingNameMap->add(alias, atomicName); 171 textEncodingNameMap->insert(alias, atomicName);
172 } 172 }
173 173
174 static void addToTextCodecMap(const char* name, 174 static void addToTextCodecMap(const char* name,
175 NewTextCodecFunction function, 175 NewTextCodecFunction function,
176 const void* additionalData) { 176 const void* additionalData) {
177 const char* atomicName = textEncodingNameMap->get(name); 177 const char* atomicName = textEncodingNameMap->get(name);
178 DCHECK(atomicName); 178 DCHECK(atomicName);
179 textCodecMap->add(atomicName, TextCodecFactory(function, additionalData)); 179 textCodecMap->insert(atomicName, TextCodecFactory(function, additionalData));
180 } 180 }
181 181
182 static void pruneBlacklistedCodecs() { 182 static void pruneBlacklistedCodecs() {
183 for (size_t i = 0; i < WTF_ARRAY_LENGTH(textEncodingNameBlacklist); ++i) { 183 for (size_t i = 0; i < WTF_ARRAY_LENGTH(textEncodingNameBlacklist); ++i) {
184 const char* atomicName = 184 const char* atomicName =
185 textEncodingNameMap->get(textEncodingNameBlacklist[i]); 185 textEncodingNameMap->get(textEncodingNameBlacklist[i]);
186 if (!atomicName) 186 if (!atomicName)
187 continue; 187 continue;
188 188
189 Vector<const char*> names; 189 Vector<const char*> names;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 MutexLocker lock(encodingRegistryMutex()); 307 MutexLocker lock(encodingRegistryMutex());
308 308
309 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); 309 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin();
310 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); 310 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end();
311 for (; it != end; ++it) 311 for (; it != end; ++it)
312 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value); 312 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value);
313 } 313 }
314 #endif 314 #endif
315 315
316 } // namespace WTF 316 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/HashMapTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698