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

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

Issue 1798913002: WTF HashSet: Implement move semantics for values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 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
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 112
113 void AtomicString::reserveTableCapacity(size_t size) 113 void AtomicString::reserveTableCapacity(size_t size)
114 { 114 {
115 atomicStringTable().table().reserveCapacityForSize(size); 115 atomicStringTable().table().reserveCapacityForSize(size);
116 } 116 }
117 117
118 template<typename T, typename HashTranslator> 118 template<typename T, typename HashTranslator>
119 static inline PassRefPtr<StringImpl> addToStringTable(const T& value) 119 static inline PassRefPtr<StringImpl> addToStringTable(const T& value)
120 { 120 {
121 HashSet<StringImpl*>::AddResult addResult = atomicStrings().add<HashTranslat or>(value); 121 HashSet<StringImpl*>::AddResult addResult = atomicStrings().addWithTranslato r<HashTranslator>(value);
122 122
123 // If the string is newly-translated, then we need to adopt it. 123 // If the string is newly-translated, then we need to adopt it.
124 // The boolean in the pair tells us if that is so. 124 // The boolean in the pair tells us if that is so.
125 return addResult.isNewEntry ? adoptRef(*addResult.storedValue) : *addResult. storedValue; 125 return addResult.isNewEntry ? adoptRef(*addResult.storedValue) : *addResult. storedValue;
126 } 126 }
127 127
128 PassRefPtr<StringImpl> AtomicString::add(const LChar* c) 128 PassRefPtr<StringImpl> AtomicString::add(const LChar* c)
129 { 129 {
130 if (!c) 130 if (!c)
131 return nullptr; 131 return nullptr;
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 531 }
532 532
533 #ifndef NDEBUG 533 #ifndef NDEBUG
534 void AtomicString::show() const 534 void AtomicString::show() const
535 { 535 {
536 m_string.show(); 536 m_string.show();
537 } 537 }
538 #endif 538 #endif
539 539
540 } // namespace WTF 540 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/HashTable.h ('k') | third_party/WebKit/Source/wtf/text/StringHash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698