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

Side by Side Diff: third_party/WebKit/Source/core/dom/QualifiedName.cpp

Issue 2702403013: Make HashTraits<QualifiedName>::emptyValue return a const reference (Closed)
Patch Set: Default inline null() Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/QualifiedName.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 DEFINE_GLOBAL(QualifiedName, nullName); 113 DEFINE_GLOBAL(QualifiedName, nullName);
114 114
115 void QualifiedName::initAndReserveCapacityForSize(unsigned size) { 115 void QualifiedName::initAndReserveCapacityForSize(unsigned size) {
116 DCHECK(starAtom.impl()); 116 DCHECK(starAtom.impl());
117 qualifiedNameCache().reserveCapacityForSize(size + 117 qualifiedNameCache().reserveCapacityForSize(size +
118 2 /*starAtom and nullAtom */); 118 2 /*starAtom and nullAtom */);
119 new ((void*)&anyName) QualifiedName(nullAtom, starAtom, starAtom, true); 119 new ((void*)&anyName) QualifiedName(nullAtom, starAtom, starAtom, true);
120 new ((void*)&nullName) QualifiedName(nullAtom, nullAtom, nullAtom, true); 120 new ((void*)&nullName) QualifiedName(nullAtom, nullAtom, nullAtom, true);
121 } 121 }
122 122
123 const QualifiedName& QualifiedName::null() {
124 return nullName;
125 }
126
127 const AtomicString& QualifiedName::localNameUpper() const { 123 const AtomicString& QualifiedName::localNameUpper() const {
128 if (!m_impl->m_localNameUpper) 124 if (!m_impl->m_localNameUpper)
129 m_impl->m_localNameUpper = m_impl->m_localName.upperASCII(); 125 m_impl->m_localNameUpper = m_impl->m_localName.upperASCII();
130 return m_impl->m_localNameUpper; 126 return m_impl->m_localNameUpper;
131 } 127 }
132 128
133 unsigned QualifiedName::QualifiedNameImpl::computeHash() const { 129 unsigned QualifiedName::QualifiedNameImpl::computeHash() const {
134 QualifiedNameComponents components = {m_prefix.impl(), m_localName.impl(), 130 QualifiedNameComponents components = {m_prefix.impl(), m_localName.impl(),
135 m_namespace.impl()}; 131 m_namespace.impl()};
136 return hashComponents(components); 132 return hashComponents(components);
137 } 133 }
138 134
139 void QualifiedName::createStatic(void* targetAddress, 135 void QualifiedName::createStatic(void* targetAddress,
140 StringImpl* name, 136 StringImpl* name,
141 const AtomicString& nameNamespace) { 137 const AtomicString& nameNamespace) {
142 new (targetAddress) 138 new (targetAddress)
143 QualifiedName(nullAtom, AtomicString(name), nameNamespace, true); 139 QualifiedName(nullAtom, AtomicString(name), nameNamespace, true);
144 } 140 }
145 141
146 void QualifiedName::createStatic(void* targetAddress, StringImpl* name) { 142 void QualifiedName::createStatic(void* targetAddress, StringImpl* name) {
147 new (targetAddress) 143 new (targetAddress)
148 QualifiedName(nullAtom, AtomicString(name), nullAtom, true); 144 QualifiedName(nullAtom, AtomicString(name), nullAtom, true);
149 } 145 }
150 146
151 } // namespace blink 147 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/QualifiedName.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698