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

Side by Side Diff: Source/WTF/wtf/text/AtomicString.cpp

Issue 13686020: Make HTMLNames threadsafe (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove extra assert Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/WTF/wtf/text/StringImpl.h » ('j') | Source/WTF/wtf/text/StringImpl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
4 * Copyright (C) 2012 Google Inc. All rights reserved. 4 * Copyright (C) 2012 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* r) 427 PassRefPtr<StringImpl> AtomicString::addSlowCase(StringImpl* r)
428 { 428 {
429 if (!r->length()) 429 if (!r->length())
430 return StringImpl::empty(); 430 return StringImpl::empty();
431 431
432 AtomicStringTableLocker locker; 432 AtomicStringTableLocker locker;
433 StringImpl* result = *stringTable().add(r).iterator; 433 StringImpl* result = *stringTable().add(r).iterator;
434 if (result == r) 434 if (result == r)
435 r->setIsAtomic(true); 435 r->setIsAtomic(true);
436 ASSERT(!r->isStatic() || result->isStatic());
436 return result; 437 return result;
437 } 438 }
438 439
439 template<typename CharacterType> 440 template<typename CharacterType>
440 static inline HashSet<StringImpl*>::iterator findString(const StringImpl* string Impl) 441 static inline HashSet<StringImpl*>::iterator findString(const StringImpl* string Impl)
441 { 442 {
442 HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stri ngImpl->getCharacters<CharacterType>(), stringImpl->length() }; 443 HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stri ngImpl->getCharacters<CharacterType>(), stringImpl->length() };
443 return stringTable().find<HashAndCharacters<CharacterType>, HashAndCharacter sTranslator<CharacterType> >(buffer); 444 return stringTable().find<HashAndCharacters<CharacterType>, HashAndCharacter sTranslator<CharacterType> >(buffer);
444 } 445 }
445 446
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 496 }
496 497
497 #ifndef NDEBUG 498 #ifndef NDEBUG
498 void AtomicString::show() const 499 void AtomicString::show() const
499 { 500 {
500 m_string.show(); 501 m_string.show();
501 } 502 }
502 #endif 503 #endif
503 504
504 } // namespace WTF 505 } // namespace WTF
OLDNEW
« no previous file with comments | « no previous file | Source/WTF/wtf/text/StringImpl.h » ('j') | Source/WTF/wtf/text/StringImpl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698