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

Side by Side Diff: Source/wtf/HashMap.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/HashCountedSet.h ('k') | Source/wtf/HashTable.h » ('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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 return m_impl.template add<HashMapTranslator<ValueTraits, HashFunctions> >(key, mapped); 369 return m_impl.template add<HashMapTranslator<ValueTraits, HashFunctions> >(key, mapped);
370 } 370 }
371 371
372 template<typename T, typename U, typename V, typename W, typename X, typenam e Y> 372 template<typename T, typename U, typename V, typename W, typename X, typenam e Y>
373 typename HashMap<T, U, V, W, X, Y>::AddResult 373 typename HashMap<T, U, V, W, X, Y>::AddResult
374 HashMap<T, U, V, W, X, Y>::set(KeyPeekInType key, MappedPassInType mapped) 374 HashMap<T, U, V, W, X, Y>::set(KeyPeekInType key, MappedPassInType mapped)
375 { 375 {
376 AddResult result = inlineAdd(key, mapped); 376 AddResult result = inlineAdd(key, mapped);
377 if (!result.isNewEntry) { 377 if (!result.isNewEntry) {
378 // The inlineAdd call above found an existing hash table entry; we n eed to set the mapped value. 378 // The inlineAdd call above found an existing hash table entry; we n eed to set the mapped value.
379 MappedTraits::store(mapped, result.iterator->value); 379 MappedTraits::store(mapped, result.storedValue->value);
380 } 380 }
381 return result; 381 return result;
382 } 382 }
383 383
384 template<typename T, typename U, typename V, typename W, typename X, typenam e Y> 384 template<typename T, typename U, typename V, typename W, typename X, typenam e Y>
385 template<typename HashTranslator, typename TYPE> 385 template<typename HashTranslator, typename TYPE>
386 typename HashMap<T, U, V, W, X, Y>::AddResult 386 typename HashMap<T, U, V, W, X, Y>::AddResult
387 HashMap<T, U, V, W, X, Y>::add(const TYPE& key, MappedPassInType value) 387 HashMap<T, U, V, W, X, Y>::add(const TYPE& key, MappedPassInType value)
388 { 388 {
389 return m_impl.template addPassingHashCode<HashMapTranslatorAdapter<Value Traits, HashTranslator> >(key, value); 389 return m_impl.template addPassingHashCode<HashMapTranslatorAdapter<Value Traits, HashTranslator> >(key, value);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 vector[i] = *it; 522 vector[i] = *it;
523 } 523 }
524 524
525 } // namespace WTF 525 } // namespace WTF
526 526
527 using WTF::HashMap; 527 using WTF::HashMap;
528 528
529 #include "wtf/RefPtrHashMap.h" 529 #include "wtf/RefPtrHashMap.h"
530 530
531 #endif /* WTF_HashMap_h */ 531 #endif /* WTF_HashMap_h */
OLDNEW
« no previous file with comments | « Source/wtf/HashCountedSet.h ('k') | Source/wtf/HashTable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698