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

Side by Side Diff: third_party/WebKit/Source/wtf/text/StringImpl.h

Issue 2232083002: Fix incorrect usage of StringImpl::sizeInBytes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: size_teeee 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Google Inc. All rights reserved. 4 * Copyright (C) 2009 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 unsigned length() const { return m_length; } 222 unsigned length() const { return m_length; }
223 bool is8Bit() const { return m_is8Bit; } 223 bool is8Bit() const { return m_is8Bit; }
224 224
225 ALWAYS_INLINE const LChar* characters8() const { ASSERT(is8Bit()); return re interpret_cast<const LChar*>(this + 1); } 225 ALWAYS_INLINE const LChar* characters8() const { ASSERT(is8Bit()); return re interpret_cast<const LChar*>(this + 1); }
226 ALWAYS_INLINE const UChar* characters16() const { ASSERT(!is8Bit()); return reinterpret_cast<const UChar*>(this + 1); } 226 ALWAYS_INLINE const UChar* characters16() const { ASSERT(!is8Bit()); return reinterpret_cast<const UChar*>(this + 1); }
227 ALWAYS_INLINE const void* bytes() const { return reinterpret_cast<const void *>(this + 1); } 227 ALWAYS_INLINE const void* bytes() const { return reinterpret_cast<const void *>(this + 1); }
228 228
229 template <typename CharType> 229 template <typename CharType>
230 ALWAYS_INLINE const CharType * getCharacters() const; 230 ALWAYS_INLINE const CharType * getCharacters() const;
231 231
232 size_t sizeInBytes() const; 232 size_t charactersSizeInBytes() const
233 {
234 return length() * (is8Bit() ? sizeof(LChar) : sizeof(UChar));
235 }
233 236
234 bool isAtomic() const { return m_isAtomic; } 237 bool isAtomic() const { return m_isAtomic; }
235 void setIsAtomic(bool isAtomic) { m_isAtomic = isAtomic; } 238 void setIsAtomic(bool isAtomic) { m_isAtomic = isAtomic; }
236 239
237 bool isStatic() const { return m_isStatic; } 240 bool isStatic() const { return m_isStatic; }
238 241
239 private: 242 private:
240 // The high bits of 'hash' are always empty, but we prefer to store our 243 // The high bits of 'hash' are always empty, but we prefer to store our
241 // flags in the low bits because it makes them slightly more efficient to 244 // flags in the low bits because it makes them slightly more efficient to
242 // access. So, we shift left and right when setting and getting our hash 245 // access. So, we shift left and right when setting and getting our hash
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 using WTF::TextCaseASCIIInsensitive; 715 using WTF::TextCaseASCIIInsensitive;
713 using WTF::TextCaseInsensitive; 716 using WTF::TextCaseInsensitive;
714 using WTF::TextCaseSensitive; 717 using WTF::TextCaseSensitive;
715 using WTF::TextCaseSensitivity; 718 using WTF::TextCaseSensitivity;
716 using WTF::equal; 719 using WTF::equal;
717 using WTF::equalNonNull; 720 using WTF::equalNonNull;
718 using WTF::lengthOfNullTerminatedString; 721 using WTF::lengthOfNullTerminatedString;
719 using WTF::reverseFind; 722 using WTF::reverseFind;
720 723
721 #endif 724 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/AtomicString.h ('k') | third_party/WebKit/Source/wtf/text/StringImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698