| 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 25 matching lines...) Expand all Loading... |
| 36 void* pointers[4]; | 36 void* pointers[4]; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 static_assert(sizeof(QualifiedName::QualifiedNameImpl) == sizeof(SameSizeAsQuali
fiedNameImpl), "QualifiedNameImpl should stay small"); | 39 static_assert(sizeof(QualifiedName::QualifiedNameImpl) == sizeof(SameSizeAsQuali
fiedNameImpl), "QualifiedNameImpl should stay small"); |
| 40 | 40 |
| 41 using QualifiedNameCache = HashSet<QualifiedName::QualifiedNameImpl*, QualifiedN
ameHash>; | 41 using QualifiedNameCache = HashSet<QualifiedName::QualifiedNameImpl*, QualifiedN
ameHash>; |
| 42 | 42 |
| 43 static QualifiedNameCache& qualifiedNameCache() | 43 static QualifiedNameCache& qualifiedNameCache() |
| 44 { | 44 { |
| 45 // This code is lockless and thus assumes it all runs on one thread! | 45 // This code is lockless and thus assumes it all runs on one thread! |
| 46 ASSERT(isMainThread()); | 46 DCHECK(isMainThread()); |
| 47 static QualifiedNameCache* gNameCache = new QualifiedNameCache; | 47 static QualifiedNameCache* gNameCache = new QualifiedNameCache; |
| 48 return *gNameCache; | 48 return *gNameCache; |
| 49 } | 49 } |
| 50 | 50 |
| 51 struct QNameComponentsTranslator { | 51 struct QNameComponentsTranslator { |
| 52 static unsigned hash(const QualifiedNameData& data) | 52 static unsigned hash(const QualifiedNameData& data) |
| 53 { | 53 { |
| 54 return hashComponents(data.m_components); | 54 return hashComponents(data.m_components); |
| 55 } | 55 } |
| 56 static bool equal(QualifiedName::QualifiedNameImpl* name, const QualifiedNam
eData& data) | 56 static bool equal(QualifiedName::QualifiedNameImpl* name, const QualifiedNam
eData& data) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return prefix().getString() + ":" + local; | 96 return prefix().getString() + ":" + local; |
| 97 return local; | 97 return local; |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Global init routines | 100 // Global init routines |
| 101 DEFINE_GLOBAL(QualifiedName, anyName, nullAtom, starAtom, starAtom) | 101 DEFINE_GLOBAL(QualifiedName, anyName, nullAtom, starAtom, starAtom) |
| 102 DEFINE_GLOBAL(QualifiedName, nullName, nullAtom, nullAtom, nullAtom) | 102 DEFINE_GLOBAL(QualifiedName, nullName, nullAtom, nullAtom, nullAtom) |
| 103 | 103 |
| 104 void QualifiedName::initAndReserveCapacityForSize(unsigned size) | 104 void QualifiedName::initAndReserveCapacityForSize(unsigned size) |
| 105 { | 105 { |
| 106 ASSERT(starAtom.impl()); | 106 DCHECK(starAtom.impl()); |
| 107 qualifiedNameCache().reserveCapacityForSize(size + 2 /*starAtom and nullAtom
*/); | 107 qualifiedNameCache().reserveCapacityForSize(size + 2 /*starAtom and nullAtom
*/); |
| 108 new ((void*)&anyName) QualifiedName(nullAtom, starAtom, starAtom, true ); | 108 new ((void*)&anyName) QualifiedName(nullAtom, starAtom, starAtom, true ); |
| 109 new ((void*)&nullName) QualifiedName(nullAtom, nullAtom, nullAtom, true ); | 109 new ((void*)&nullName) QualifiedName(nullAtom, nullAtom, nullAtom, true ); |
| 110 } | 110 } |
| 111 | 111 |
| 112 const QualifiedName& QualifiedName::null() | 112 const QualifiedName& QualifiedName::null() |
| 113 { | 113 { |
| 114 return nullName; | 114 return nullName; |
| 115 } | 115 } |
| 116 | 116 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 131 { | 131 { |
| 132 new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nameNamespac
e, true); | 132 new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nameNamespac
e, true); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void QualifiedName::createStatic(void* targetAddress, StringImpl* name) | 135 void QualifiedName::createStatic(void* targetAddress, StringImpl* name) |
| 136 { | 136 { |
| 137 new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nullAtom, tr
ue); | 137 new (targetAddress) QualifiedName(nullAtom, AtomicString(name), nullAtom, tr
ue); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace blink | 140 } // namespace blink |
| OLD | NEW |