| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2009 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 static void translate(QualifiedName::QualifiedNameImpl*& location, const Qua
lifiedNameComponents& components, unsigned) | 70 static void translate(QualifiedName::QualifiedNameImpl*& location, const Qua
lifiedNameComponents& components, unsigned) |
| 71 { | 71 { |
| 72 location = QualifiedName::QualifiedNameImpl::create(AtomicString(compone
nts.m_prefix), AtomicString(components.m_localName), AtomicString(components.m_n
amespace)).leakRef(); | 72 location = QualifiedName::QualifiedNameImpl::create(AtomicString(compone
nts.m_prefix), AtomicString(components.m_localName), AtomicString(components.m_n
amespace)).leakRef(); |
| 73 } | 73 } |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const
AtomicString& n) | 76 QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const
AtomicString& n) |
| 77 { | 77 { |
| 78 QualifiedNameComponents components = { p.impl(), l.impl(), n.isEmpty() ? nul
lAtom.impl() : n.impl() }; | 78 QualifiedNameComponents components = { p.impl(), l.impl(), n.isEmpty() ? nul
lAtom.impl() : n.impl() }; |
| 79 QualifiedNameCache::AddResult addResult = qualifiedNameCache().add<QNameComp
onentsTranslator>(components); | 79 QualifiedNameCache::AddResult addResult = qualifiedNameCache().add<QNameComp
onentsTranslator>(components); |
| 80 m_impl = *addResult.iterator; | 80 m_impl = addResult.isNewEntry ? adoptRef(*addResult.iterator) : *addResult.i
terator; |
| 81 if (!addResult.isNewEntry) | |
| 82 m_impl->ref(); | |
| 83 } | 81 } |
| 84 | 82 |
| 85 QualifiedName::~QualifiedName() | 83 QualifiedName::~QualifiedName() |
| 86 { | 84 { |
| 87 deref(); | |
| 88 } | |
| 89 | |
| 90 void QualifiedName::deref() | |
| 91 { | |
| 92 #ifdef QNAME_DEFAULT_CONSTRUCTOR | |
| 93 if (!m_impl) | |
| 94 return; | |
| 95 #endif | |
| 96 ASSERT(!isHashTableDeletedValue()); | |
| 97 m_impl->deref(); | |
| 98 } | 85 } |
| 99 | 86 |
| 100 QualifiedName::QualifiedNameImpl::~QualifiedNameImpl() | 87 QualifiedName::QualifiedNameImpl::~QualifiedNameImpl() |
| 101 { | 88 { |
| 102 qualifiedNameCache().remove(this); | 89 qualifiedNameCache().remove(this); |
| 103 } | 90 } |
| 104 | 91 |
| 105 String QualifiedName::toString() const | 92 String QualifiedName::toString() const |
| 106 { | 93 { |
| 107 String local = localName(); | 94 String local = localName(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 { | 129 { |
| 143 new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nameNamespac
e); | 130 new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nameNamespac
e); |
| 144 } | 131 } |
| 145 | 132 |
| 146 void createQualifiedName(void* targetAddress, StringImpl* name) | 133 void createQualifiedName(void* targetAddress, StringImpl* name) |
| 147 { | 134 { |
| 148 new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nullAtom); | 135 new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nullAtom); |
| 149 } | 136 } |
| 150 | 137 |
| 151 } | 138 } |
| OLD | NEW |