| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 EXPECT_EQ(1, deque.first()->get()); | 211 EXPECT_EQ(1, deque.first()->get()); |
| 212 EXPECT_EQ(1u, deque.size()); | 212 EXPECT_EQ(1u, deque.size()); |
| 213 EXPECT_EQ(1, destructNumber); | 213 EXPECT_EQ(1, destructNumber); |
| 214 | 214 |
| 215 OwnPtr<DestructCounter> ownCounter1 = std::move(deque.first()); | 215 OwnPtr<DestructCounter> ownCounter1 = std::move(deque.first()); |
| 216 deque.removeFirst(); | 216 deque.removeFirst(); |
| 217 EXPECT_EQ(counter1, ownCounter1->get()); | 217 EXPECT_EQ(counter1, ownCounter1->get()); |
| 218 EXPECT_EQ(0u, deque.size()); | 218 EXPECT_EQ(0u, deque.size()); |
| 219 EXPECT_EQ(1, destructNumber); | 219 EXPECT_EQ(1, destructNumber); |
| 220 | 220 |
| 221 ownCounter1.clear(); | 221 ownCounter1.reset(); |
| 222 EXPECT_EQ(2, destructNumber); | 222 EXPECT_EQ(2, destructNumber); |
| 223 | 223 |
| 224 size_t count = 1025; | 224 size_t count = 1025; |
| 225 destructNumber = 0; | 225 destructNumber = 0; |
| 226 for (size_t i = 0; i < count; ++i) | 226 for (size_t i = 0; i < count; ++i) |
| 227 deque.prepend(adoptPtr(new DestructCounter(i, &destructNumber))); | 227 deque.prepend(adoptPtr(new DestructCounter(i, &destructNumber))); |
| 228 | 228 |
| 229 // Deque relocation must not destruct OwnPtr element. | 229 // Deque relocation must not destruct OwnPtr element. |
| 230 EXPECT_EQ(0, destructNumber); | 230 EXPECT_EQ(0, destructNumber); |
| 231 EXPECT_EQ(count, deque.size()); | 231 EXPECT_EQ(count, deque.size()); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 EXPECT_EQ(0, counter); | 602 EXPECT_EQ(0, counter); |
| 603 | 603 |
| 604 counter = 0; | 604 counter = 0; |
| 605 Deque<CountCopy, 1> yetAnother(std::move(deque)); // Move construction. | 605 Deque<CountCopy, 1> yetAnother(std::move(deque)); // Move construction. |
| 606 EXPECT_EQ(0, counter); | 606 EXPECT_EQ(0, counter); |
| 607 } | 607 } |
| 608 | 608 |
| 609 } // anonymous namespace | 609 } // anonymous namespace |
| 610 | 610 |
| 611 } // namespace WTF | 611 } // namespace WTF |
| OLD | NEW |