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

Side by Side Diff: Source/wtf/RefPtrHashMap.h

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 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
« no previous file with comments | « Source/wtf/ListHashSet.h ('k') | Source/wtf/text/AtomicString.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, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return m_impl.template add<Translator>(key, mapped); 210 return m_impl.template add<Translator>(key, mapped);
211 } 211 }
212 212
213 template<typename T, typename U, typename V, typename W, typename X> 213 template<typename T, typename U, typename V, typename W, typename X>
214 typename HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::AddResult 214 typename HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::AddResult
215 HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::set(const KeyType& key, Ma ppedPassInType mapped) 215 HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::set(const KeyType& key, Ma ppedPassInType mapped)
216 { 216 {
217 AddResult result = inlineAdd(key, mapped); 217 AddResult result = inlineAdd(key, mapped);
218 if (!result.isNewEntry) { 218 if (!result.isNewEntry) {
219 // The inlineAdd call above found an existing hash table entry; we n eed to set the mapped value. 219 // The inlineAdd call above found an existing hash table entry; we n eed to set the mapped value.
220 MappedTraits::store(mapped, result.iterator->value); 220 MappedTraits::store(mapped, result.storedValue->value);
221 } 221 }
222 return result; 222 return result;
223 } 223 }
224 224
225 template<typename T, typename U, typename V, typename W, typename X> 225 template<typename T, typename U, typename V, typename W, typename X>
226 typename HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::AddResult 226 typename HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::AddResult
227 HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::set(RawKeyType key, Mapped PassInType mapped) 227 HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::set(RawKeyType key, Mapped PassInType mapped)
228 { 228 {
229 AddResult result = inlineAdd(key, mapped); 229 AddResult result = inlineAdd(key, mapped);
230 if (!result.isNewEntry) { 230 if (!result.isNewEntry) {
231 // The inlineAdd call above found an existing hash table entry; we n eed to set the mapped value. 231 // The inlineAdd call above found an existing hash table entry; we n eed to set the mapped value.
232 MappedTraits::store(mapped, result.iterator->value); 232 MappedTraits::store(mapped, result.storedValue->value);
233 } 233 }
234 return result; 234 return result;
235 } 235 }
236 236
237 template<typename T, typename U, typename V, typename W, typename X> 237 template<typename T, typename U, typename V, typename W, typename X>
238 typename HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::AddResult 238 typename HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::AddResult
239 HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::add(const KeyType& key, Ma ppedPassInType mapped) 239 HashMap<RefPtr<T>, U, V, W, X, DefaultAllocator>::add(const KeyType& key, Ma ppedPassInType mapped)
240 { 240 {
241 return inlineAdd(key, mapped); 241 return inlineAdd(key, mapped);
242 } 242 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 if (it == end()) 321 if (it == end())
322 return MappedTraits::passOut(MappedTraits::emptyValue()); 322 return MappedTraits::passOut(MappedTraits::emptyValue());
323 MappedPassOutType result = MappedTraits::passOut(it->value); 323 MappedPassOutType result = MappedTraits::passOut(it->value);
324 remove(it); 324 remove(it);
325 return result; 325 return result;
326 } 326 }
327 327
328 } // namespace WTF 328 } // namespace WTF
329 329
330 #endif // RefPtrHashMap_h 330 #endif // RefPtrHashMap_h
OLDNEW
« no previous file with comments | « Source/wtf/ListHashSet.h ('k') | Source/wtf/text/AtomicString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698