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

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

Issue 2227903002: String::contains should use StringView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 /* 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 286 }
287 buffer[j] = 0; 287 buffer[j] = 0;
288 return atomicCanonicalTextEncodingName(buffer); 288 return atomicCanonicalTextEncodingName(buffer);
289 } 289 }
290 290
291 const char* atomicCanonicalTextEncodingName(const String& alias) 291 const char* atomicCanonicalTextEncodingName(const String& alias)
292 { 292 {
293 if (!alias.length()) 293 if (!alias.length())
294 return 0; 294 return 0;
295 295
296 if (alias.contains(static_cast<UChar>('\0'))) 296 if (alias.contains('\0'))
297 return 0; 297 return 0;
298 298
299 if (alias.is8Bit()) 299 if (alias.is8Bit())
300 return atomicCanonicalTextEncodingName<LChar>(alias.characters8(), alias .length()); 300 return atomicCanonicalTextEncodingName<LChar>(alias.characters8(), alias .length());
301 301
302 return atomicCanonicalTextEncodingName<UChar>(alias.characters16(), alias.le ngth()); 302 return atomicCanonicalTextEncodingName<UChar>(alias.characters16(), alias.le ngth());
303 } 303 }
304 304
305 bool noExtendedTextEncodingNameUsed() 305 bool noExtendedTextEncodingNameUsed()
306 { 306 {
307 return !atomicDidExtendTextCodecMaps(); 307 return !atomicDidExtendTextCodecMaps();
308 } 308 }
309 309
310 #ifndef NDEBUG 310 #ifndef NDEBUG
311 void dumpTextEncodingNameMap() 311 void dumpTextEncodingNameMap()
312 { 312 {
313 unsigned size = textEncodingNameMap->size(); 313 unsigned size = textEncodingNameMap->size();
314 fprintf(stderr, "Dumping %u entries in WTF::TextEncodingNameMap...\n", size) ; 314 fprintf(stderr, "Dumping %u entries in WTF::TextEncodingNameMap...\n", size) ;
315 315
316 MutexLocker lock(encodingRegistryMutex()); 316 MutexLocker lock(encodingRegistryMutex());
317 317
318 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); 318 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin();
319 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); 319 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end();
320 for (; it != end; ++it) 320 for (; it != end; ++it)
321 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value); 321 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value);
322 } 322 }
323 #endif 323 #endif
324 324
325 } // namespace WTF 325 } // namespace WTF
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698