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

Unified Diff: Source/core/dom/QualifiedName.h

Issue 311803003: [oilpan]: Avoid refcounting QualifiedName's nullQName when tracing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: New QName hash trait Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl ('k') | Source/core/dom/QualifiedName.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(); }
};
}
« no previous file with comments | « Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl ('k') | Source/core/dom/QualifiedName.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698