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

Side by Side Diff: trunk/Source/wtf/text/AtomicString.h

Issue 18196004: Revert 153294 "Remove AtomicStringImpl." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 7 years, 5 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 | « trunk/Source/wtf/HashTable.h ('k') | trunk/Source/wtf/text/AtomicString.cpp » ('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, 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 * 18 *
19 */ 19 */
20 20
21 #ifndef AtomicString_h 21 #ifndef AtomicString_h
22 #define AtomicString_h 22 #define AtomicString_h
23 23
24 #include "wtf/WTFExport.h" 24 #include "wtf/WTFExport.h"
25 #include "wtf/text/AtomicStringImpl.h"
25 #include "wtf/text/WTFString.h" 26 #include "wtf/text/WTFString.h"
26 27
27 // Define 'NO_IMPLICIT_ATOMICSTRING' before including this header, 28 // Define 'NO_IMPLICIT_ATOMICSTRING' before including this header,
28 // to disallow (expensive) implicit String-->AtomicString conversions. 29 // to disallow (expensive) implicit String-->AtomicString conversions.
29 #ifdef NO_IMPLICIT_ATOMICSTRING 30 #ifdef NO_IMPLICIT_ATOMICSTRING
30 #define ATOMICSTRING_CONVERSION explicit 31 #define ATOMICSTRING_CONVERSION explicit
31 #else 32 #else
32 #define ATOMICSTRING_CONVERSION 33 #define ATOMICSTRING_CONVERSION
33 #endif 34 #endif
34 35
(...skipping 14 matching lines...) Expand all
49 AtomicString(const UChar* s, unsigned length, unsigned existingHash) : m_str ing(add(s, length, existingHash)) { } 50 AtomicString(const UChar* s, unsigned length, unsigned existingHash) : m_str ing(add(s, length, existingHash)) { }
50 AtomicString(const UChar* s) : m_string(add(s)) { } 51 AtomicString(const UChar* s) : m_string(add(s)) { }
51 52
52 template<size_t inlineCapacity> 53 template<size_t inlineCapacity>
53 explicit AtomicString(const Vector<UChar, inlineCapacity>& characters) 54 explicit AtomicString(const Vector<UChar, inlineCapacity>& characters)
54 : m_string(add(characters.data(), characters.size())) 55 : m_string(add(characters.data(), characters.size()))
55 { 56 {
56 } 57 }
57 58
58 ATOMICSTRING_CONVERSION AtomicString(StringImpl* imp) : m_string(add(imp)) { } 59 ATOMICSTRING_CONVERSION AtomicString(StringImpl* imp) : m_string(add(imp)) { }
60 AtomicString(AtomicStringImpl* imp) : m_string(imp) { }
59 ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl( ))) { } 61 ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl( ))) { }
60 AtomicString(StringImpl* baseString, unsigned start, unsigned length) : m_st ring(add(baseString, start, length)) { } 62 AtomicString(StringImpl* baseString, unsigned start, unsigned length) : m_st ring(add(baseString, start, length)) { }
61 63
62 enum ConstructFromLiteralTag { ConstructFromLiteral }; 64 enum ConstructFromLiteralTag { ConstructFromLiteral };
63 AtomicString(const char* characters, unsigned length, ConstructFromLiteralTa g) 65 AtomicString(const char* characters, unsigned length, ConstructFromLiteralTa g)
64 : m_string(addFromLiteralData(characters, length)) 66 : m_string(addFromLiteralData(characters, length))
65 { 67 {
66 } 68 }
67 69
68 template<unsigned charactersCount> 70 template<unsigned charactersCount>
(...skipping 12 matching lines...) Expand all
81 AtomicString(const AtomicString& other) : m_string(other.m_string) { } 83 AtomicString(const AtomicString& other) : m_string(other.m_string) { }
82 AtomicString(AtomicString&& other) : m_string(static_cast<String&&>(other.m_ string)) { } 84 AtomicString(AtomicString&& other) : m_string(static_cast<String&&>(other.m_ string)) { }
83 AtomicString& operator=(const AtomicString& other) { m_string = other.m_stri ng; return *this; } 85 AtomicString& operator=(const AtomicString& other) { m_string = other.m_stri ng; return *this; }
84 AtomicString& operator=(AtomicString&& other) { m_string = static_cast<Strin g&&>(other.m_string); return *this; } 86 AtomicString& operator=(AtomicString&& other) { m_string = static_cast<Strin g&&>(other.m_string); return *this; }
85 #endif 87 #endif
86 88
87 // Hash table deleted values, which are only constructed and never copied or destroyed. 89 // Hash table deleted values, which are only constructed and never copied or destroyed.
88 AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDelete dValue) { } 90 AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDelete dValue) { }
89 bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedVal ue(); } 91 bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedVal ue(); }
90 92
91 static StringImpl* find(const StringImpl*); 93 static AtomicStringImpl* find(const StringImpl*);
92 94
93 operator const String&() const { return m_string; } 95 operator const String&() const { return m_string; }
94 const String& string() const { return m_string; }; 96 const String& string() const { return m_string; };
95 97
96 StringImpl* impl() const { return m_string.impl(); } 98 AtomicStringImpl* impl() const { return static_cast<AtomicStringImpl *>(m_st ring.impl()); }
97 99
98 bool is8Bit() const { return m_string.is8Bit(); } 100 bool is8Bit() const { return m_string.is8Bit(); }
99 const UChar* characters() const { return m_string.bloatedCharacters(); } 101 const UChar* characters() const { return m_string.bloatedCharacters(); }
100 const LChar* characters8() const { return m_string.characters8(); } 102 const LChar* characters8() const { return m_string.characters8(); }
101 const UChar* characters16() const { return m_string.characters16(); } 103 const UChar* characters16() const { return m_string.characters16(); }
102 unsigned length() const { return m_string.length(); } 104 unsigned length() const { return m_string.length(); }
103 105
104 UChar operator[](unsigned int i) const { return m_string[i]; } 106 UChar operator[](unsigned int i) const { return m_string[i]; }
105 107
106 bool contains(UChar c) const { return m_string.contains(c); } 108 bool contains(UChar c) const { return m_string.contains(c); }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 using WTF::textAtom; 263 using WTF::textAtom;
262 using WTF::commentAtom; 264 using WTF::commentAtom;
263 using WTF::starAtom; 265 using WTF::starAtom;
264 using WTF::xmlAtom; 266 using WTF::xmlAtom;
265 using WTF::xmlnsAtom; 267 using WTF::xmlnsAtom;
266 using WTF::xlinkAtom; 268 using WTF::xlinkAtom;
267 #endif 269 #endif
268 270
269 #include "wtf/text/StringConcatenate.h" 271 #include "wtf/text/StringConcatenate.h"
270 #endif // AtomicString_h 272 #endif // AtomicString_h
OLDNEW
« no previous file with comments | « trunk/Source/wtf/HashTable.h ('k') | trunk/Source/wtf/text/AtomicString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698