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

Side by Side Diff: third_party/WebKit/Source/wtf/text/AtomicString.h

Issue 2614123002: Use StringView for String and AtomicString operator==. (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2008 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 static PassRefPtr<StringImpl> addSlowCase(StringImpl*); 226 static PassRefPtr<StringImpl> addSlowCase(StringImpl*);
227 #if OS(MACOSX) 227 #if OS(MACOSX)
228 static PassRefPtr<StringImpl> add(CFStringRef); 228 static PassRefPtr<StringImpl> add(CFStringRef);
229 #endif 229 #endif
230 }; 230 };
231 231
232 inline bool operator==(const AtomicString& a, const AtomicString& b) { 232 inline bool operator==(const AtomicString& a, const AtomicString& b) {
233 return a.impl() == b.impl(); 233 return a.impl() == b.impl();
234 } 234 }
235 WTF_EXPORT bool operator==(const AtomicString&, const LChar*);
236 inline bool operator==(const AtomicString& a, const char* b) {
237 return WTF::equal(a.impl(), reinterpret_cast<const LChar*>(b));
238 }
239 inline bool operator==(const AtomicString& a, const Vector<UChar>& b) {
240 return a.impl() && equal(a.impl(), b.data(), b.size());
241 }
242 inline bool operator==(const AtomicString& a, const String& b) { 235 inline bool operator==(const AtomicString& a, const String& b) {
236 // We don't use equalStringView so we get the isAtomic() optimization inside
237 // WTF::equal.
243 return equal(a.impl(), b.impl()); 238 return equal(a.impl(), b.impl());
244 } 239 }
245 inline bool operator==(const LChar* a, const AtomicString& b) { 240 inline bool operator==(const String& a, const AtomicString& b) {
246 return b == a; 241 return b == a;
247 } 242 }
243 inline bool operator==(const AtomicString& a, const char* b) {
244 return equalStringView(a, b);
245 }
248 inline bool operator==(const char* a, const AtomicString& b) { 246 inline bool operator==(const char* a, const AtomicString& b) {
249 return b == a; 247 return b == a;
250 } 248 }
251 inline bool operator==(const String& a, const AtomicString& b) {
252 return equal(a.impl(), b.impl());
253 }
254 inline bool operator==(const Vector<UChar>& a, const AtomicString& b) {
255 return b == a;
256 }
257 249
258 inline bool operator!=(const AtomicString& a, const AtomicString& b) { 250 inline bool operator!=(const AtomicString& a, const AtomicString& b) {
259 return a.impl() != b.impl(); 251 return a.impl() != b.impl();
260 } 252 }
261 inline bool operator!=(const AtomicString& a, const LChar* b) { 253 inline bool operator!=(const AtomicString& a, const String& b) {
254 return !(a == b);
255 }
256 inline bool operator!=(const String& a, const AtomicString& b) {
262 return !(a == b); 257 return !(a == b);
263 } 258 }
264 inline bool operator!=(const AtomicString& a, const char* b) { 259 inline bool operator!=(const AtomicString& a, const char* b) {
265 return !(a == b); 260 return !(a == b);
266 } 261 }
267 inline bool operator!=(const AtomicString& a, const String& b) {
268 return !equal(a.impl(), b.impl());
269 }
270 inline bool operator!=(const AtomicString& a, const Vector<UChar>& b) {
271 return !(a == b);
272 }
273 inline bool operator!=(const LChar* a, const AtomicString& b) {
274 return !(b == a);
275 }
276 inline bool operator!=(const char* a, const AtomicString& b) { 262 inline bool operator!=(const char* a, const AtomicString& b) {
277 return !(b == a);
278 }
279 inline bool operator!=(const String& a, const AtomicString& b) {
280 return !equal(a.impl(), b.impl());
281 }
282 inline bool operator!=(const Vector<UChar>& a, const AtomicString& b) {
283 return !(a == b); 263 return !(a == b);
284 } 264 }
285 265
286 // Define external global variables for the commonly used atomic strings. 266 // Define external global variables for the commonly used atomic strings.
287 // These are only usable from the main thread. 267 // These are only usable from the main thread.
288 WTF_EXPORT extern const AtomicString& nullAtom; 268 WTF_EXPORT extern const AtomicString& nullAtom;
289 WTF_EXPORT extern const AtomicString& emptyAtom; 269 WTF_EXPORT extern const AtomicString& emptyAtom;
290 WTF_EXPORT extern const AtomicString& starAtom; 270 WTF_EXPORT extern const AtomicString& starAtom;
291 WTF_EXPORT extern const AtomicString& xmlAtom; 271 WTF_EXPORT extern const AtomicString& xmlAtom;
292 WTF_EXPORT extern const AtomicString& xmlnsAtom; 272 WTF_EXPORT extern const AtomicString& xmlnsAtom;
(...skipping 29 matching lines...) Expand all
322 using WTF::AtomicString; 302 using WTF::AtomicString;
323 using WTF::nullAtom; 303 using WTF::nullAtom;
324 using WTF::emptyAtom; 304 using WTF::emptyAtom;
325 using WTF::starAtom; 305 using WTF::starAtom;
326 using WTF::xmlAtom; 306 using WTF::xmlAtom;
327 using WTF::xmlnsAtom; 307 using WTF::xmlnsAtom;
328 using WTF::xlinkAtom; 308 using WTF::xlinkAtom;
329 309
330 #include "wtf/text/StringConcatenate.h" 310 #include "wtf/text/StringConcatenate.h"
331 #endif // AtomicString_h 311 #endif // AtomicString_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp ('k') | third_party/WebKit/Source/wtf/text/WTFString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698