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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 RefCounted<QualifiedNameImpl>::ref(); | 67 RefCounted<QualifiedNameImpl>::ref(); |
68 } | 68 } |
69 | 69 |
70 void deref() | 70 void deref() |
71 { | 71 { |
72 if (m_isStatic) | 72 if (m_isStatic) |
73 return; | 73 return; |
74 RefCounted<QualifiedNameImpl>::deref(); | 74 RefCounted<QualifiedNameImpl>::deref(); |
75 } | 75 } |
76 | 76 |
| 77 // We rely on StringHasher's hashMemory clearing out the top 8 bits when |
| 78 // doing hashing and use one of the bits for the m_isStatic value. |
| 79 mutable unsigned m_existingHash : 24; |
| 80 unsigned m_isStatic : 1; |
77 const AtomicString m_prefix; | 81 const AtomicString m_prefix; |
78 const AtomicString m_localName; | 82 const AtomicString m_localName; |
79 const AtomicString m_namespace; | 83 const AtomicString m_namespace; |
80 mutable AtomicString m_localNameUpper; | 84 mutable AtomicString m_localNameUpper; |
81 // We rely on StringHasher's hashMemory clearing out the top 8 bits when | |
82 // doing hashing and use one of the bits for the m_isStatic value. | |
83 mutable unsigned m_existingHash : 24; | |
84 unsigned m_isStatic : 1; | |
85 | 85 |
86 private: | 86 private: |
87 QualifiedNameImpl(const AtomicString& prefix, const AtomicString& localN
ame, const AtomicString& namespaceURI, bool isStatic) | 87 QualifiedNameImpl(const AtomicString& prefix, const AtomicString& localN
ame, const AtomicString& namespaceURI, bool isStatic) |
88 : m_prefix(prefix) | 88 : m_existingHash(0) |
| 89 , m_isStatic(isStatic) |
| 90 , m_prefix(prefix) |
89 , m_localName(localName) | 91 , m_localName(localName) |
90 , m_namespace(namespaceURI) | 92 , m_namespace(namespaceURI) |
91 , m_existingHash(0) | |
92 , m_isStatic(isStatic) | |
93 | 93 |
94 { | 94 { |
95 ASSERT(!namespaceURI.isEmpty() || namespaceURI.isNull()); | 95 ASSERT(!namespaceURI.isEmpty() || namespaceURI.isNull()); |
96 } | 96 } |
97 }; | 97 }; |
98 | 98 |
99 QualifiedName(const AtomicString& prefix, const AtomicString& localName, con
st AtomicString& namespaceURI); | 99 QualifiedName(const AtomicString& prefix, const AtomicString& localName, con
st AtomicString& namespaceURI); |
100 ~QualifiedName(); | 100 ~QualifiedName(); |
101 | 101 |
102 QualifiedName(const QualifiedName& other) : m_impl(other.m_impl) { } | 102 QualifiedName(const QualifiedName& other) : m_impl(other.m_impl) { } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 typedef blink::QualifiedNameHash Hash; | 182 typedef blink::QualifiedNameHash Hash; |
183 }; | 183 }; |
184 | 184 |
185 template<> struct HashTraits<blink::QualifiedName> : SimpleClassHashTraits<b
link::QualifiedName> { | 185 template<> struct HashTraits<blink::QualifiedName> : SimpleClassHashTraits<b
link::QualifiedName> { |
186 static const bool emptyValueIsZero = false; | 186 static const bool emptyValueIsZero = false; |
187 static blink::QualifiedName emptyValue() { return blink::QualifiedName::
null(); } | 187 static blink::QualifiedName emptyValue() { return blink::QualifiedName::
null(); } |
188 }; | 188 }; |
189 } | 189 } |
190 | 190 |
191 #endif | 191 #endif |
OLD | NEW |