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

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

Issue 1855763002: CL for perf tryjob on android Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringConcatenate.cpp ('k') | tools/run-perf-test.cfg » ('j') | 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) 2004, 2006, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 bytes[i * 2 + 1] = static_cast<char>(c); 159 bytes[i * 2 + 1] = static_cast<char>(c);
160 } 160 }
161 } 161 }
162 162
163 return result; 163 return result;
164 } 164 }
165 165
166 CString TextCodecUTF16::encode(const LChar* characters, size_t length, Unencodab leHandling) 166 CString TextCodecUTF16::encode(const LChar* characters, size_t length, Unencodab leHandling)
167 { 167 {
168 // In the LChar case, we do actually need to perform this check in release. :) 168 // In the LChar case, we do actually need to perform this check in release. :)
169 CHECK_LE(length, numeric_limits<size_t>::max() / 2); 169 RELEASE_ASSERT(length <= numeric_limits<size_t>::max() / 2);
170 170
171 char* bytes; 171 char* bytes;
172 CString result = CString::newUninitialized(length * 2, bytes); 172 CString result = CString::newUninitialized(length * 2, bytes);
173 173
174 if (m_littleEndian) { 174 if (m_littleEndian) {
175 for (size_t i = 0; i < length; ++i) { 175 for (size_t i = 0; i < length; ++i) {
176 bytes[i * 2] = characters[i]; 176 bytes[i * 2] = characters[i];
177 bytes[i * 2 + 1] = 0; 177 bytes[i * 2 + 1] = 0;
178 } 178 }
179 } else { 179 } else {
180 for (size_t i = 0; i < length; ++i) { 180 for (size_t i = 0; i < length; ++i) {
181 bytes[i * 2] = 0; 181 bytes[i * 2] = 0;
182 bytes[i * 2 + 1] = characters[i]; 182 bytes[i * 2 + 1] = characters[i];
183 } 183 }
184 } 184 }
185 185
186 return result; 186 return result;
187 } 187 }
188 188
189 } // namespace WTF 189 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringConcatenate.cpp ('k') | tools/run-perf-test.cfg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698