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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights 3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2009 Google Inc. All rights reserved. 5 * Copyright (C) 2009 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 bool isSafeToSendToAnotherThread() const; 278 bool isSafeToSendToAnotherThread() const;
279 279
280 // The high bits of 'hash' are always empty, but we prefer to store our 280 // The high bits of 'hash' are always empty, but we prefer to store our
281 // flags in the low bits because it makes them slightly more efficient to 281 // flags in the low bits because it makes them slightly more efficient to
282 // access. So, we shift left and right when setting and getting our hash 282 // access. So, we shift left and right when setting and getting our hash
283 // code. 283 // code.
284 void setHash(unsigned hash) const { 284 void setHash(unsigned hash) const {
285 DCHECK(!hasHash()); 285 DCHECK(!hasHash());
286 // Multiple clients assume that StringHasher is the canonical string 286 // Multiple clients assume that StringHasher is the canonical string
287 // hash function. 287 // hash function.
288 DCHECK(hash == (is8Bit() ? StringHasher::computeHashAndMaskTop8Bits( 288 DCHECK(hash ==
289 characters8(), m_length) 289 (is8Bit() ? StringHasher::computeHashAndMaskTop8Bits(characters8(),
290 : StringHasher::computeHashAndMaskTop8Bits( 290 m_length)
291 characters16(), m_length))); 291 : StringHasher::computeHashAndMaskTop8Bits(characters16(),
292 m_length)));
292 m_hash = hash; 293 m_hash = hash;
293 DCHECK(hash); // Verify that 0 is a valid sentinel hash value. 294 DCHECK(hash); // Verify that 0 is a valid sentinel hash value.
294 } 295 }
295 296
296 bool hasHash() const { return m_hash != 0; } 297 bool hasHash() const { return m_hash != 0; }
297 298
298 unsigned existingHash() const { 299 unsigned existingHash() const {
299 DCHECK(hasHash()); 300 DCHECK(hasHash());
300 return m_hash; 301 return m_hash;
301 } 302 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 517
517 #ifdef STRING_STATS 518 #ifdef STRING_STATS
518 static StringStats m_stringStats; 519 static StringStats m_stringStats;
519 #endif 520 #endif
520 521
521 static unsigned m_highestStaticStringLength; 522 static unsigned m_highestStaticStringLength;
522 523
523 #if DCHECK_IS_ON() 524 #if DCHECK_IS_ON()
524 void assertHashIsCorrect() { 525 void assertHashIsCorrect() {
525 DCHECK(hasHash()); 526 DCHECK(hasHash());
526 DCHECK_EQ(existingHash(), StringHasher::computeHashAndMaskTop8Bits( 527 DCHECK_EQ(
527 characters8(), length())); 528 existingHash(),
529 StringHasher::computeHashAndMaskTop8Bits(characters8(), length()));
528 } 530 }
529 #endif 531 #endif
530 532
531 private: 533 private:
532 #if DCHECK_IS_ON() 534 #if DCHECK_IS_ON()
533 mutable ThreadRestrictionVerifier m_verifier; 535 mutable ThreadRestrictionVerifier m_verifier;
534 #endif 536 #endif
535 mutable unsigned m_refCount; 537 mutable unsigned m_refCount;
536 const unsigned m_length; 538 const unsigned m_length;
537 mutable unsigned m_hash : 24; 539 mutable unsigned m_hash : 24;
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 using WTF::TextCaseASCIIInsensitive; 889 using WTF::TextCaseASCIIInsensitive;
888 using WTF::TextCaseUnicodeInsensitive; 890 using WTF::TextCaseUnicodeInsensitive;
889 using WTF::TextCaseSensitive; 891 using WTF::TextCaseSensitive;
890 using WTF::TextCaseSensitivity; 892 using WTF::TextCaseSensitivity;
891 using WTF::equal; 893 using WTF::equal;
892 using WTF::equalNonNull; 894 using WTF::equalNonNull;
893 using WTF::lengthOfNullTerminatedString; 895 using WTF::lengthOfNullTerminatedString;
894 using WTF::reverseFind; 896 using WTF::reverseFind;
895 897
896 #endif 898 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/Vector.h ('k') | third_party/WebKit/Source/wtf/text/StringImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698