OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed. |
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 template <typename FirstTraitsArg, typename SecondTraitsArg> | 238 template <typename FirstTraitsArg, typename SecondTraitsArg> |
239 struct PairHashTraits : GenericHashTraits<std::pair<typename FirstTraitsArg::Tra itType, typename SecondTraitsArg::TraitType>> { | 239 struct PairHashTraits : GenericHashTraits<std::pair<typename FirstTraitsArg::Tra itType, typename SecondTraitsArg::TraitType>> { |
240 typedef FirstTraitsArg FirstTraits; | 240 typedef FirstTraitsArg FirstTraits; |
241 typedef SecondTraitsArg SecondTraits; | 241 typedef SecondTraitsArg SecondTraits; |
242 typedef std::pair<typename FirstTraits::TraitType, typename SecondTraits::Tr aitType> TraitType; | 242 typedef std::pair<typename FirstTraits::TraitType, typename SecondTraits::Tr aitType> TraitType; |
243 typedef std::pair<typename FirstTraits::EmptyValueType, typename SecondTrait s::EmptyValueType> EmptyValueType; | 243 typedef std::pair<typename FirstTraits::EmptyValueType, typename SecondTrait s::EmptyValueType> EmptyValueType; |
244 | 244 |
245 static const bool emptyValueIsZero = FirstTraits::emptyValueIsZero && Second Traits::emptyValueIsZero; | 245 static const bool emptyValueIsZero = FirstTraits::emptyValueIsZero && Second Traits::emptyValueIsZero; |
246 static EmptyValueType emptyValue() { return std::make_pair(FirstTraits::empt yValue(), SecondTraits::emptyValue()); } | 246 static EmptyValueType emptyValue() { return std::make_pair(FirstTraits::empt yValue(), SecondTraits::emptyValue()); } |
247 | 247 |
248 static const bool hasIsEmptyValueFunction = FirstTraits::hasIsEmptyValueFunc tion || SecondTraits::hasIsEmptyValueFunction; | |
haraken
2016/06/02 04:23:41
Would you elaborate why you need this change? Is t
Marijn Kruisselbrink
2016/06/02 18:33:30
Yes, I'd say this is an existing bug of the std::p
haraken
2016/06/03 05:33:03
Would you make the change in a separate CL?
Marijn Kruisselbrink
2016/06/03 20:37:04
Split off into https://codereview.chromium.org/204
| |
249 static bool isEmptyValue(const TraitType& value) { return isHashTraitsEmptyV alue<FirstTraits>(value.first) && isHashTraitsEmptyValue<SecondTraits>(value.sec ond); } | |
250 | |
248 static const unsigned minimumTableSize = FirstTraits::minimumTableSize; | 251 static const unsigned minimumTableSize = FirstTraits::minimumTableSize; |
249 | 252 |
250 static void constructDeletedValue(TraitType& slot, bool zeroValue) | 253 static void constructDeletedValue(TraitType& slot, bool zeroValue) |
251 { | 254 { |
252 FirstTraits::constructDeletedValue(slot.first, zeroValue); | 255 FirstTraits::constructDeletedValue(slot.first, zeroValue); |
253 // For GC collections the memory for the backing is zeroed when it is | 256 // For GC collections the memory for the backing is zeroed when it is |
254 // allocated, and the constructors may take advantage of that, | 257 // allocated, and the constructors may take advantage of that, |
255 // especially if a GC occurs during insertion of an entry into the | 258 // especially if a GC occurs during insertion of an entry into the |
256 // table. This slot is being marked deleted, but If the slot is reused | 259 // table. This slot is being marked deleted, but If the slot is reused |
257 // at a later point, the same assumptions around memory zeroing must | 260 // at a later point, the same assumptions around memory zeroing must |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 struct TraceInCollectionTrait; | 345 struct TraceInCollectionTrait; |
343 | 346 |
344 } // namespace WTF | 347 } // namespace WTF |
345 | 348 |
346 using WTF::HashTraits; | 349 using WTF::HashTraits; |
347 using WTF::PairHashTraits; | 350 using WTF::PairHashTraits; |
348 using WTF::NullableHashTraits; | 351 using WTF::NullableHashTraits; |
349 using WTF::SimpleClassHashTraits; | 352 using WTF::SimpleClassHashTraits; |
350 | 353 |
351 #endif // WTF_HashTraits_h | 354 #endif // WTF_HashTraits_h |
OLD | NEW |