| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 EXPECT_TRUE(isDeleted); | 201 EXPECT_TRUE(isDeleted); |
| 202 EXPECT_TRUE(set.isEmpty()); | 202 EXPECT_TRUE(set.isEmpty()); |
| 203 EXPECT_EQ(1, DummyRefCounted::s_refInvokesCount); | 203 EXPECT_EQ(1, DummyRefCounted::s_refInvokesCount); |
| 204 } | 204 } |
| 205 | 205 |
| 206 class CountCopy final { | 206 class CountCopy final { |
| 207 public: | 207 public: |
| 208 static int* const kDeletedValue; | 208 static int* const kDeletedValue; |
| 209 | 209 |
| 210 explicit CountCopy(int* counter = nullptr) : m_counter(counter) { } | 210 explicit CountCopy(int* counter = nullptr) : m_counter(counter) { } |
| 211 CountCopy(const CountCopy& other) : m_counter(other.m_counter) | 211 CountCopy(const CountCopy& other) |
| 212 : m_counter(other.m_counter) |
| 212 { | 213 { |
| 213 if (m_counter && m_counter != kDeletedValue) | 214 if (m_counter && m_counter != kDeletedValue) |
| 214 ++*m_counter; | 215 ++*m_counter; |
| 215 } | 216 } |
| 217 CountCopy& operator=(const CountCopy& other) |
| 218 { |
| 219 m_counter = other.m_counter; |
| 220 if (m_counter && m_counter != kDeletedValue) |
| 221 ++*m_counter; |
| 222 return *this; |
| 223 } |
| 216 const int* counter() const { return m_counter; } | 224 const int* counter() const { return m_counter; } |
| 217 | 225 |
| 218 private: | 226 private: |
| 219 int* m_counter; | 227 int* m_counter; |
| 220 }; | 228 }; |
| 221 | 229 |
| 222 int* const CountCopy::kDeletedValue = reinterpret_cast<int*>(static_cast<uintptr
_t>(-1)); | 230 int* const CountCopy::kDeletedValue = reinterpret_cast<int*>(static_cast<uintptr
_t>(-1)); |
| 223 | 231 |
| 224 struct CountCopyHashTraits : public GenericHashTraits<CountCopy> { | 232 struct CountCopyHashTraits : public GenericHashTraits<CountCopy> { |
| 225 static const bool emptyValueIsZero = false; | 233 static const bool emptyValueIsZero = false; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 EXPECT_EQ(13, thirteen.id()); | 393 EXPECT_EQ(13, thirteen.id()); |
| 386 iter = set.find(MoveOnly(13)); | 394 iter = set.find(MoveOnly(13)); |
| 387 EXPECT_TRUE(iter == set.end()); | 395 EXPECT_TRUE(iter == set.end()); |
| 388 | 396 |
| 389 set.clear(); | 397 set.clear(); |
| 390 } | 398 } |
| 391 | 399 |
| 392 } // anonymous namespace | 400 } // anonymous namespace |
| 393 | 401 |
| 394 } // namespace WTF | 402 } // namespace WTF |
| OLD | NEW |