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

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

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 | « no previous file | third_party/WebKit/Source/core/dom/QualifiedName.cpp » ('j') | 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 28 matching lines...) Expand all
39 39
40 // This struct is used to pass data between QualifiedName and the 40 // This struct is used to pass data between QualifiedName and the
41 // QNameTranslator. For hashing and equality only the QualifiedNameComponents 41 // QNameTranslator. For hashing and equality only the QualifiedNameComponents
42 // fields are used. 42 // fields are used.
43 struct QualifiedNameData { 43 struct QualifiedNameData {
44 DISALLOW_NEW(); 44 DISALLOW_NEW();
45 QualifiedNameComponents m_components; 45 QualifiedNameComponents m_components;
46 bool m_isStatic; 46 bool m_isStatic;
47 }; 47 };
48 48
49 CORE_EXPORT extern const class QualifiedName& nullName;
50
49 class CORE_EXPORT QualifiedName { 51 class CORE_EXPORT QualifiedName {
50 USING_FAST_MALLOC(QualifiedName); 52 USING_FAST_MALLOC(QualifiedName);
51 53
52 public: 54 public:
53 class QualifiedNameImpl : public RefCounted<QualifiedNameImpl> { 55 class QualifiedNameImpl : public RefCounted<QualifiedNameImpl> {
54 public: 56 public:
55 static PassRefPtr<QualifiedNameImpl> create( 57 static PassRefPtr<QualifiedNameImpl> create(
56 const AtomicString& prefix, 58 const AtomicString& prefix,
57 const AtomicString& localName, 59 const AtomicString& localName,
58 const AtomicString& namespaceURI, 60 const AtomicString& namespaceURI,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Uppercased localName, cached for efficiency 155 // Uppercased localName, cached for efficiency
154 const AtomicString& localNameUpper() const; 156 const AtomicString& localNameUpper() const;
155 157
156 String toString() const; 158 String toString() const;
157 159
158 QualifiedNameImpl* impl() const { return m_impl.get(); } 160 QualifiedNameImpl* impl() const { return m_impl.get(); }
159 161
160 // Init routine for globals 162 // Init routine for globals
161 static void initAndReserveCapacityForSize(unsigned size); 163 static void initAndReserveCapacityForSize(unsigned size);
162 164
163 static const QualifiedName& null(); 165 static const QualifiedName& null() { return nullName; }
164 166
165 // The below methods are only for creating static global QNames that need no 167 // The below methods are only for creating static global QNames that need no
166 // ref counting. 168 // ref counting.
167 static void createStatic(void* targetAddress, StringImpl* name); 169 static void createStatic(void* targetAddress, StringImpl* name);
168 static void createStatic(void* targetAddress, 170 static void createStatic(void* targetAddress,
169 StringImpl* name, 171 StringImpl* name,
170 const AtomicString& nameNamespace); 172 const AtomicString& nameNamespace);
171 173
172 private: 174 private:
173 // This constructor is used only to create global/static QNames that don't 175 // This constructor is used only to create global/static QNames that don't
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 231
230 template <> 232 template <>
231 struct DefaultHash<blink::QualifiedName> { 233 struct DefaultHash<blink::QualifiedName> {
232 typedef blink::QualifiedNameHash Hash; 234 typedef blink::QualifiedNameHash Hash;
233 }; 235 };
234 236
235 template <> 237 template <>
236 struct HashTraits<blink::QualifiedName> 238 struct HashTraits<blink::QualifiedName>
237 : SimpleClassHashTraits<blink::QualifiedName> { 239 : SimpleClassHashTraits<blink::QualifiedName> {
238 static const bool emptyValueIsZero = false; 240 static const bool emptyValueIsZero = false;
239 static blink::QualifiedName emptyValue() { 241 static const blink::QualifiedName& emptyValue() {
240 return blink::QualifiedName::null(); 242 return blink::QualifiedName::null();
241 } 243 }
242 }; 244 };
243 } // namespace WTF 245 } // namespace WTF
244 246
245 #endif 247 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/QualifiedName.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698