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

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

Issue 143943017: Added Base64 support in TextEncoder and TextDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 18 matching lines...) Expand all
29 29
30 #include "wtf/ASCIICType.h" 30 #include "wtf/ASCIICType.h"
31 #include "wtf/CurrentTime.h" 31 #include "wtf/CurrentTime.h"
32 #include "wtf/HashMap.h" 32 #include "wtf/HashMap.h"
33 #include "wtf/HashSet.h" 33 #include "wtf/HashSet.h"
34 #include "wtf/MainThread.h" 34 #include "wtf/MainThread.h"
35 #include "wtf/StdLibExtras.h" 35 #include "wtf/StdLibExtras.h"
36 #include "wtf/StringExtras.h" 36 #include "wtf/StringExtras.h"
37 #include "wtf/ThreadingPrimitives.h" 37 #include "wtf/ThreadingPrimitives.h"
38 #include "wtf/text/CString.h" 38 #include "wtf/text/CString.h"
39 #include "wtf/text/TextCodecBase64.h"
39 #include "wtf/text/TextCodecICU.h" 40 #include "wtf/text/TextCodecICU.h"
40 #include "wtf/text/TextCodecLatin1.h" 41 #include "wtf/text/TextCodecLatin1.h"
41 #include "wtf/text/TextCodecUTF16.h" 42 #include "wtf/text/TextCodecUTF16.h"
42 #include "wtf/text/TextCodecUTF8.h" 43 #include "wtf/text/TextCodecUTF8.h"
43 #include "wtf/text/TextCodecUserDefined.h" 44 #include "wtf/text/TextCodecUserDefined.h"
44 #include "wtf/text/TextEncoding.h" 45 #include "wtf/text/TextEncoding.h"
45 46
46 namespace WTF { 47 namespace WTF {
47 48
48 const size_t maxEncodingNameLength = 63; 49 const size_t maxEncodingNameLength = 63;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName) 274 bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName)
274 { 275 {
275 return canonicalEncodingName && nonBackslashEncodings && nonBackslashEncodin gs->contains(canonicalEncodingName); 276 return canonicalEncodingName && nonBackslashEncodings && nonBackslashEncodin gs->contains(canonicalEncodingName);
276 } 277 }
277 278
278 static void extendTextCodecMaps() 279 static void extendTextCodecMaps()
279 { 280 {
280 TextCodecICU::registerEncodingNames(addToTextEncodingNameMap); 281 TextCodecICU::registerEncodingNames(addToTextEncodingNameMap);
281 TextCodecICU::registerCodecs(addToTextCodecMap); 282 TextCodecICU::registerCodecs(addToTextCodecMap);
282 283
284 TextCodecBase64::registerEncodingNames(addToTextEncodingNameMap);
285 TextCodecBase64::registerCodecs(addToTextCodecMap);
286
283 pruneBlacklistedCodecs(); 287 pruneBlacklistedCodecs();
284 buildQuirksSets(); 288 buildQuirksSets();
285 } 289 }
286 290
287 PassOwnPtr<TextCodec> newTextCodec(const TextEncoding& encoding) 291 PassOwnPtr<TextCodec> newTextCodec(const TextEncoding& encoding)
288 { 292 {
289 MutexLocker lock(encodingRegistryMutex()); 293 MutexLocker lock(encodingRegistryMutex());
290 294
291 ASSERT(textCodecMap); 295 ASSERT(textCodecMap);
292 TextCodecFactory factory = textCodecMap->get(encoding.name()); 296 TextCodecFactory factory = textCodecMap->get(encoding.name());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 MutexLocker lock(encodingRegistryMutex()); 357 MutexLocker lock(encodingRegistryMutex());
354 358
355 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin(); 359 TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin();
356 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end(); 360 TextEncodingNameMap::const_iterator end = textEncodingNameMap->end();
357 for (; it != end; ++it) 361 for (; it != end; ++it)
358 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value); 362 fprintf(stderr, "'%s' => '%s'\n", it->key, it->value);
359 } 363 }
360 #endif 364 #endif
361 365
362 } // namespace WTF 366 } // namespace WTF
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698