OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 6416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6427 EXPECT_FALSE(crossThreadWeakPersistent.get()); | 6427 EXPECT_FALSE(crossThreadWeakPersistent.get()); |
6428 { | 6428 { |
6429 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex()); | 6429 SafePointAwareMutexLocker recursiveMutexLocker(recursiveMutex()); |
6430 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls); | 6430 EXPECT_EQ(1, DestructorLockingObject::s_destructorCalls); |
6431 } | 6431 } |
6432 | 6432 |
6433 wakeWorkerThread(); | 6433 wakeWorkerThread(); |
6434 parkMainThread(); | 6434 parkMainThread(); |
6435 } | 6435 } |
6436 | 6436 |
| 6437 class TestPersistentHeapVectorWithUnusedSlots : public PersistentHeapVector<Vect
orObject, 16> { |
| 6438 public: |
| 6439 void checkUnused() |
| 6440 { |
| 6441 checkUnusedSlots(end(), end() + (capacity() - size())); |
| 6442 } |
| 6443 }; |
| 6444 |
| 6445 TEST(HeapTest, TestPersistentHeapVectorWithUnusedSlots) |
| 6446 { |
| 6447 TestPersistentHeapVectorWithUnusedSlots vector1; |
| 6448 TestPersistentHeapVectorWithUnusedSlots vector2(vector1); |
| 6449 |
| 6450 vector1.checkUnused(); |
| 6451 vector2.checkUnused(); |
| 6452 |
| 6453 vector2.append(VectorObject()); |
| 6454 vector2.checkUnused(); |
| 6455 |
| 6456 EXPECT_EQ(0u, vector1.size()); |
| 6457 |
| 6458 EXPECT_EQ(1u, vector2.size()); |
| 6459 // TODO(Oilpan): when Vector.h's contiguous container support no longer disables |
| 6460 // Vector<>s with inline capacity, remove. |
| 6461 #if !defined(ANNOTATE_CONTIGUOUS_CONTAINER) |
| 6462 EXPECT_EQ(16u, vector1.capacity()); |
| 6463 EXPECT_EQ(16u, vector2.capacity()); |
| 6464 #endif |
| 6465 } |
| 6466 |
6437 } // namespace blink | 6467 } // namespace blink |
OLD | NEW |