summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/wtf/text/AtomicString.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/wtf/text/AtomicString.h')
-rw-r--r--chromium/third_party/WebKit/Source/wtf/text/AtomicString.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/chromium/third_party/WebKit/Source/wtf/text/AtomicString.h b/chromium/third_party/WebKit/Source/wtf/text/AtomicString.h
index 3b25e4eaf2d..8983dcdced2 100644
--- a/chromium/third_party/WebKit/Source/wtf/text/AtomicString.h
+++ b/chromium/third_party/WebKit/Source/wtf/text/AtomicString.h
@@ -23,16 +23,9 @@
#include "wtf/HashTableDeletedValueType.h"
#include "wtf/WTFExport.h"
+#include "wtf/text/CString.h"
#include "wtf/text/WTFString.h"
-// Define 'NO_IMPLICIT_ATOMICSTRING' before including this header,
-// to disallow (expensive) implicit String-->AtomicString conversions.
-#ifdef NO_IMPLICIT_ATOMICSTRING
-#define ATOMICSTRING_CONVERSION explicit
-#else
-#define ATOMICSTRING_CONVERSION
-#endif
-
namespace WTF {
struct AtomicStringHash;
@@ -55,8 +48,11 @@ public:
{
}
- explicit AtomicString(StringImpl* imp) : m_string(add(imp)) { }
- ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl())) { }
+ // Constructing an AtomicString from a String / StringImpl can be expensive if
+ // the StringImpl is not already atomic.
+ explicit AtomicString(StringImpl* impl) : m_string(add(impl)) { }
+ explicit AtomicString(const String& s) : m_string(add(s.impl())) { }
+
AtomicString(StringImpl* baseString, unsigned start, unsigned length) : m_string(add(baseString, start, length)) { }
enum ConstructFromLiteralTag { ConstructFromLiteral };
@@ -100,7 +96,7 @@ public:
const UChar* characters16() const { return m_string.characters16(); }
unsigned length() const { return m_string.length(); }
- UChar operator[](unsigned int i) const { return m_string[i]; }
+ UChar operator[](unsigned i) const { return m_string[i]; }
bool contains(UChar c) const { return m_string.contains(c); }
bool contains(const LChar* s, bool caseSensitive = true) const
@@ -164,6 +160,10 @@ public:
static AtomicString fromUTF8(const char*, size_t);
static AtomicString fromUTF8(const char*);
+ CString ascii() const { return m_string.ascii(); }
+ CString latin1() const { return m_string.latin1(); }
+ CString utf8(UTF8ConversionMode mode = LenientUTF8Conversion) const { return m_string.utf8(mode); }
+
#ifndef NDEBUG
void show() const;
#endif
@@ -257,6 +257,8 @@ template<> struct DefaultHash<AtomicString> {
} // namespace WTF
+WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(AtomicString);
+
#ifndef ATOMICSTRING_HIDE_GLOBALS
using WTF::AtomicString;
using WTF::nullAtom;