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

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

Issue 13973026: remove memoryinstrumentation Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove the rest part of MemoryInstrumentation Created 7 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/text/AtomicString.h ('k') | Source/wtf/text/WTFString.h » ('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) 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 28 matching lines...) Expand all
39 @class NSString; 39 @class NSString;
40 #endif 40 #endif
41 41
42 namespace WTF { 42 namespace WTF {
43 43
44 struct CStringTranslator; 44 struct CStringTranslator;
45 template<typename CharacterType> struct HashAndCharactersTranslator; 45 template<typename CharacterType> struct HashAndCharactersTranslator;
46 struct HashAndUTF8CharactersTranslator; 46 struct HashAndUTF8CharactersTranslator;
47 struct LCharBufferTranslator; 47 struct LCharBufferTranslator;
48 struct CharBufferFromLiteralDataTranslator; 48 struct CharBufferFromLiteralDataTranslator;
49 class MemoryObjectInfo;
50 struct SubstringTranslator; 49 struct SubstringTranslator;
51 struct UCharBufferTranslator; 50 struct UCharBufferTranslator;
52 template<typename> class RetainPtr; 51 template<typename> class RetainPtr;
53 52
54 enum TextCaseSensitivity { TextCaseSensitive, TextCaseInsensitive }; 53 enum TextCaseSensitivity { TextCaseSensitive, TextCaseInsensitive };
55 54
56 typedef bool (*CharacterMatchFunctionPtr)(UChar); 55 typedef bool (*CharacterMatchFunctionPtr)(UChar);
57 typedef bool (*IsWhiteSpaceFunctionPtr)(UChar); 56 typedef bool (*IsWhiteSpaceFunctionPtr)(UChar);
58 57
59 // Define STRING_STATS to turn on run time statistics of string sizes and memory usage 58 // Define STRING_STATS to turn on run time statistics of string sizes and memory usage
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 return adoptRef(new StringImpl(vector.releaseBuffer(), size)); 402 return adoptRef(new StringImpl(vector.releaseBuffer(), size));
404 } 403 }
405 return empty(); 404 return empty();
406 } 405 }
407 406
408 WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> adopt(StringBuffer<UChar >&); 407 WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> adopt(StringBuffer<UChar >&);
409 WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> adopt(StringBuffer<LChar >&); 408 WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> adopt(StringBuffer<LChar >&);
410 409
411 unsigned length() const { return m_length; } 410 unsigned length() const { return m_length; }
412 bool is8Bit() const { return m_hashAndFlags & s_hashFlag8BitBuffer; } 411 bool is8Bit() const { return m_hashAndFlags & s_hashFlag8BitBuffer; }
413 bool hasInternalBuffer() const { return bufferOwnership() == BufferInternal; }
414 bool hasOwnedBuffer() const { return bufferOwnership() == BufferOwned; }
415 StringImpl* baseString() const { return bufferOwnership() == BufferSubstring ? m_substringBuffer : 0; }
416 412
417 // FIXME: Remove all unnecessary usages of characters() 413 // FIXME: Remove all unnecessary usages of characters()
418 ALWAYS_INLINE const LChar* characters8() const { ASSERT(is8Bit()); return m_ data8; } 414 ALWAYS_INLINE const LChar* characters8() const { ASSERT(is8Bit()); return m_ data8; }
419 ALWAYS_INLINE const UChar* characters16() const { ASSERT(!is8Bit()); return m_data16; } 415 ALWAYS_INLINE const UChar* characters16() const { ASSERT(!is8Bit()); return m_data16; }
420 ALWAYS_INLINE const UChar* characters() const 416 ALWAYS_INLINE const UChar* characters() const
421 { 417 {
422 if (!is8Bit()) 418 if (!is8Bit())
423 return m_data16; 419 return m_data16;
424 420
425 return getData16SlowCase(); 421 return getData16SlowCase();
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 #endif 671 #endif
676 672
677 #ifdef STRING_STATS 673 #ifdef STRING_STATS
678 ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; } 674 ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; }
679 #endif 675 #endif
680 676
681 private: 677 private:
682 678
683 bool isASCIILiteral() const 679 bool isASCIILiteral() const
684 { 680 {
685 return is8Bit() && hasInternalBuffer() && reinterpret_cast<const void*>( m_data8) != reinterpret_cast<const void*>(this + 1); 681 return is8Bit() && bufferOwnership() == BufferInternal && reinterpret_ca st<const void*>(m_data8) != reinterpret_cast<const void*>(this + 1);
686 } 682 }
687 683
688 // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings. 684 // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings.
689 static const unsigned s_copyCharsInlineCutOff = 20; 685 static const unsigned s_copyCharsInlineCutOff = 20;
690 686
691 BufferOwnership bufferOwnership() const { return static_cast<BufferOwnership >(m_hashAndFlags & s_hashMaskBufferOwnership); } 687 BufferOwnership bufferOwnership() const { return static_cast<BufferOwnership >(m_hashAndFlags & s_hashMaskBufferOwnership); }
692 template <class UCharPredicate> PassRefPtr<StringImpl> stripMatchedCharacter s(UCharPredicate); 688 template <class UCharPredicate> PassRefPtr<StringImpl> stripMatchedCharacter s(UCharPredicate);
693 template <typename CharType, class UCharPredicate> PassRefPtr<StringImpl> si mplifyMatchedCharactersToSpace(UCharPredicate); 689 template <typename CharType, class UCharPredicate> PassRefPtr<StringImpl> si mplifyMatchedCharactersToSpace(UCharPredicate);
694 WTF_EXPORT_STRING_API NEVER_INLINE const UChar* getData16SlowCase() const; 690 WTF_EXPORT_STRING_API NEVER_INLINE const UChar* getData16SlowCase() const;
695 WTF_EXPORT_PRIVATE NEVER_INLINE unsigned hashSlowCase() const; 691 WTF_EXPORT_PRIVATE NEVER_INLINE unsigned hashSlowCase() const;
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 } 1183 }
1188 1184
1189 using WTF::StringImpl; 1185 using WTF::StringImpl;
1190 using WTF::equal; 1186 using WTF::equal;
1191 using WTF::equalNonNull; 1187 using WTF::equalNonNull;
1192 using WTF::TextCaseSensitivity; 1188 using WTF::TextCaseSensitivity;
1193 using WTF::TextCaseSensitive; 1189 using WTF::TextCaseSensitive;
1194 using WTF::TextCaseInsensitive; 1190 using WTF::TextCaseInsensitive;
1195 1191
1196 #endif 1192 #endif
OLDNEW
« no previous file with comments | « Source/wtf/text/AtomicString.h ('k') | Source/wtf/text/WTFString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698