Index: Source/core/dom/QualifiedName.cpp |
diff --git a/Source/core/dom/QualifiedName.cpp b/Source/core/dom/QualifiedName.cpp |
index 0a9452295e1020a23707913d3519f2e713a3ba6e..c447e8db0a1c366609046b7ee8e2cef9faa4fddf 100644 |
--- a/Source/core/dom/QualifiedName.cpp |
+++ b/Source/core/dom/QualifiedName.cpp |
@@ -60,24 +60,34 @@ static QualifiedNameCache& qualifiedNameCache() |
} |
struct QNameComponentsTranslator { |
- static unsigned hash(const QualifiedNameComponents& components) |
+ static unsigned hash(const QualifiedNameData& data) |
{ |
- return hashComponents(components); |
+ return hashComponents(data.m_components); |
} |
- static bool equal(QualifiedName::QualifiedNameImpl* name, const QualifiedNameComponents& c) |
+ static bool equal(QualifiedName::QualifiedNameImpl* name, const QualifiedNameData& data) |
{ |
- return c.m_prefix == name->m_prefix.impl() && c.m_localName == name->m_localName.impl() && c.m_namespace == name->m_namespace.impl(); |
+ return data.m_components.m_prefix == name->m_prefix.impl() |
+ && data.m_components.m_localName == name->m_localName.impl() |
+ && data.m_components.m_namespace == name->m_namespace.impl(); |
} |
- static void translate(QualifiedName::QualifiedNameImpl*& location, const QualifiedNameComponents& components, unsigned) |
+ static void translate(QualifiedName::QualifiedNameImpl*& location, const QualifiedNameData& data, unsigned) |
{ |
- location = QualifiedName::QualifiedNameImpl::create(AtomicString(components.m_prefix), AtomicString(components.m_localName), AtomicString(components.m_namespace)).leakRef(); |
+ const QualifiedNameComponents& components = data.m_components; |
+ location = QualifiedName::QualifiedNameImpl::create(AtomicString(components.m_prefix), AtomicString(components.m_localName), AtomicString(components.m_namespace), data.m_isStatic).leakRef(); |
} |
}; |
QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n) |
{ |
- QualifiedNameComponents components = { p.impl(), l.impl(), n.isEmpty() ? nullAtom.impl() : n.impl() }; |
- QualifiedNameCache::AddResult addResult = qualifiedNameCache().add<QNameComponentsTranslator>(components); |
+ QualifiedNameData data = { { p.impl(), l.impl(), n.isEmpty() ? nullAtom.impl() : n.impl() }, false }; |
+ QualifiedNameCache::AddResult addResult = qualifiedNameCache().add<QNameComponentsTranslator>(data); |
+ m_impl = addResult.isNewEntry ? adoptRef(*addResult.storedValue) : *addResult.storedValue; |
+} |
+ |
+QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n, bool isStatic) |
+{ |
+ QualifiedNameData data = { { p.impl(), l.impl(), n.impl() }, isStatic }; |
+ QualifiedNameCache::AddResult addResult = qualifiedNameCache().add<QNameComponentsTranslator>(data); |
m_impl = addResult.isNewEntry ? adoptRef(*addResult.storedValue) : *addResult.storedValue; |
} |
@@ -104,12 +114,12 @@ DEFINE_GLOBAL(QualifiedName, anyName, nullAtom, starAtom, starAtom) |
void QualifiedName::init() |
{ |
ASSERT(starAtom.impl()); |
- new ((void*)&anyName) QualifiedName(nullAtom, starAtom, starAtom); |
+ new ((void*)&anyName) QualifiedName(nullAtom, starAtom, starAtom, true ); |
} |
-const QualifiedName& nullQName() |
+const QualifiedName& QualifiedName::null() |
{ |
- DEFINE_STATIC_LOCAL(QualifiedName, nullName, (nullAtom, nullAtom, nullAtom)); |
+ DEFINE_STATIC_LOCAL(QualifiedName, nullName, (nullAtom, nullAtom, nullAtom, true)); |
return nullName; |
} |
@@ -126,14 +136,14 @@ unsigned QualifiedName::QualifiedNameImpl::computeHash() const |
return hashComponents(components); |
} |
-void createQualifiedName(void* targetAddress, StringImpl* name, const AtomicString& nameNamespace) |
+void QualifiedName::createStatic(void* targetAddress, StringImpl* name, const AtomicString& nameNamespace) |
{ |
- new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nameNamespace); |
+ new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nameNamespace, true); |
} |
-void createQualifiedName(void* targetAddress, StringImpl* name) |
+void QualifiedName::createStatic(void* targetAddress, StringImpl* name) |
{ |
- new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nullAtom); |
+ new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nullAtom, true); |
} |
} |