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

Side by Side Diff: Source/wtf/text/TextEncodingRegistry.cpp

Issue 256743005: Add removeAll method to sets and maps and use them (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moved implementation of removeAll to HashTable.h and shared it. Also added it to LinkedHashSet Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/ListHashSet.h ('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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 continue; 185 continue;
186 186
187 Vector<const char*> names; 187 Vector<const char*> names;
188 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); 188 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin();
189 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); 189 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end();
190 for (; it != end; ++it) { 190 for (; it != end; ++it) {
191 if (it->value == atomicName) 191 if (it->value == atomicName)
192 names.append(it->key); 192 names.append(it->key);
193 } 193 }
194 194
195 size_t length = names.size(); 195 textEncodingNameMap->removeAll(names);
196 for (size_t j = 0; j < length; ++j)
197 textEncodingNameMap->remove(names[j]);
198 196
199 textCodecMap->remove(atomicName); 197 textCodecMap->remove(atomicName);
200 } 198 }
201 } 199 }
202 200
203 static void buildBaseTextCodecMaps() 201 static void buildBaseTextCodecMaps()
204 { 202 {
205 ASSERT(isMainThread()); 203 ASSERT(isMainThread());
206 ASSERT(!textCodecMap); 204 ASSERT(!textCodecMap);
207 ASSERT(!textEncodingNameMap); 205 ASSERT(!textEncodingNameMap);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 MutexLocker lock(encodingRegistryMutex()); 351 MutexLocker lock(encodingRegistryMutex());
354 352
355 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); 353 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin();
356 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); 354 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end();
357 for (; it != end; ++it) 355 for (; it != end; ++it)
358 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value); 356 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value);
359 } 357 }
360 #endif 358 #endif
361 359
362 } // namespace WTF 360 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/wtf/ListHashSet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698