Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 } | 62 } |
| 63 | 63 |
| 64 template<unsigned charactersCount> | 64 template<unsigned charactersCount> |
| 65 ALWAYS_INLINE AtomicString(const char (&characters)[charactersCount], Constr uctFromLiteralTag) | 65 ALWAYS_INLINE AtomicString(const char (&characters)[charactersCount], Constr uctFromLiteralTag) |
| 66 : m_string(addFromLiteralData(characters, charactersCount - 1)) | 66 : m_string(addFromLiteralData(characters, charactersCount - 1)) |
| 67 { | 67 { |
| 68 COMPILE_ASSERT(charactersCount > 1, AtomicStringFromLiteralNotEmpty); | 68 COMPILE_ASSERT(charactersCount > 1, AtomicStringFromLiteralNotEmpty); |
| 69 COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImp l)) / sizeof(LChar))), AtomicStringFromLiteralCannotOverflow); | 69 COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImp l)) / sizeof(LChar))), AtomicStringFromLiteralCannotOverflow); |
| 70 } | 70 } |
| 71 | 71 |
| 72 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) | |
| 73 // We have to declare the copy constructor and copy assignment operator as w ell, otherwise | |
| 74 // they'll be implicitly deleted by adding the move constructor and move ass ignment operator. | |
| 75 // FIXME: Instead of explicitly casting to String&& here, we should use std: :move, but that requires us to | |
| 76 // have a standard library that supports move semantics. | |
| 77 AtomicString(const AtomicString& other) : m_string(other.m_string) { } | |
|
Inactive
2014/06/26 15:08:28
Let me know if you'd prefer to specify explicitly
| |
| 78 AtomicString(AtomicString&& other) : m_string(static_cast<String&&>(other.m_ string)) { } | |
| 79 AtomicString& operator=(const AtomicString& other) { m_string = other.m_stri ng; return *this; } | |
| 80 AtomicString& operator=(AtomicString&& other) { m_string = static_cast<Strin g&&>(other.m_string); return *this; } | |
| 81 #endif | |
| 82 | |
| 83 // Hash table deleted values, which are only constructed and never copied or destroyed. | 72 // Hash table deleted values, which are only constructed and never copied or destroyed. |
| 84 AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDelete dValue) { } | 73 AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDelete dValue) { } |
| 85 bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedVal ue(); } | 74 bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedVal ue(); } |
| 86 | 75 |
| 87 static StringImpl* find(const StringImpl*); | 76 static StringImpl* find(const StringImpl*); |
| 88 | 77 |
| 89 operator const String&() const { return m_string; } | 78 operator const String&() const { return m_string; } |
| 90 const String& string() const { return m_string; }; | 79 const String& string() const { return m_string; }; |
| 91 | 80 |
| 92 StringImpl* impl() const { return m_string.impl(); } | 81 StringImpl* impl() const { return m_string.impl(); } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 using WTF::nullAtom; | 253 using WTF::nullAtom; |
| 265 using WTF::emptyAtom; | 254 using WTF::emptyAtom; |
| 266 using WTF::starAtom; | 255 using WTF::starAtom; |
| 267 using WTF::xmlAtom; | 256 using WTF::xmlAtom; |
| 268 using WTF::xmlnsAtom; | 257 using WTF::xmlnsAtom; |
| 269 using WTF::xlinkAtom; | 258 using WTF::xlinkAtom; |
| 270 #endif | 259 #endif |
| 271 | 260 |
| 272 #include "wtf/text/StringConcatenate.h" | 261 #include "wtf/text/StringConcatenate.h" |
| 273 #endif // AtomicString_h | 262 #endif // AtomicString_h |
| OLD | NEW |