Index: Source/core/dom/QualifiedName.h |
diff --git a/Source/core/dom/QualifiedName.h b/Source/core/dom/QualifiedName.h |
index b589440d942e0125885430a010aa8ffbec6b18c9..9706da834453a6c0cfb59b51d871ff9e7f0bd9bb 100644 |
--- a/Source/core/dom/QualifiedName.h |
+++ b/Source/core/dom/QualifiedName.h |
@@ -67,9 +67,7 @@ public: |
QualifiedName(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI); |
~QualifiedName(); |
-#ifdef QNAME_DEFAULT_CONSTRUCTOR |
- QualifiedName() { } |
-#endif |
+ QualifiedName() : m_impl(nullptr) { } |
QualifiedName(const QualifiedName& other) : m_impl(other.m_impl) { } |
const QualifiedName& operator=(const QualifiedName& other) { m_impl = other.m_impl; return *this; } |
@@ -85,19 +83,20 @@ public: |
bool matchesPossiblyIgnoringCase(const QualifiedName& other, bool shouldIgnoreCase) const { return m_impl == other.m_impl || (equalPossiblyIgnoringCase(localName(), other.localName(), shouldIgnoreCase) && namespaceURI() == other.namespaceURI()); } |
- bool hasPrefix() const { return m_impl->m_prefix != nullAtom; } |
+ bool hasPrefix() const { return m_impl ? (m_impl->m_prefix != nullAtom) : false; } |
esprehn
2014/06/05 00:58:44
Don't use a ternary, use &&.
return m_impl && m_i
|
void setPrefix(const AtomicString& prefix) { *this = QualifiedName(prefix, localName(), namespaceURI()); } |
- const AtomicString& prefix() const { return m_impl->m_prefix; } |
- const AtomicString& localName() const { return m_impl->m_localName; } |
- const AtomicString& namespaceURI() const { return m_impl->m_namespace; } |
+ const AtomicString& prefix() const { return m_impl ? m_impl->m_prefix : nullAtom; } |
+ const AtomicString& localName() const { return m_impl ? m_impl->m_localName : nullAtom; } |
+ const AtomicString& namespaceURI() const { return m_impl ? m_impl->m_namespace : nullAtom; } |
esprehn
2014/06/05 00:58:44
This code can all be really hot, we call into it a
|
// Uppercased localName, cached for efficiency |
const AtomicString& localNameUpper() const; |
String toString() const; |
- QualifiedNameImpl* impl() const { return m_impl.get(); } |
+ QualifiedNameImpl* impl() const { return m_impl ? m_impl.get() : 0; } |
esprehn
2014/06/05 00:58:44
The ternary is not needed here.
|
+ bool isNull() const { return !m_impl; } |
// Init routine for globals |
static void init(); |
@@ -153,8 +152,8 @@ namespace WTF { |
}; |
template<> struct HashTraits<WebCore::QualifiedName> : SimpleClassHashTraits<WebCore::QualifiedName> { |
- static const bool emptyValueIsZero = false; |
- static WebCore::QualifiedName emptyValue() { return WebCore::nullQName(); } |
+ static const bool hasIsEmptyValueFunction = true; |
+ static bool isEmptyValue(const WebCore::QualifiedName& q) { return q.isNull(); } |
}; |
} |