| 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 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2602 VectorObjectNoTrace n1, n2; | 2602 VectorObjectNoTrace n1, n2; |
| 2603 vectorNoTrace.append(n1); | 2603 vectorNoTrace.append(n1); |
| 2604 vectorNoTrace.append(n2); | 2604 vectorNoTrace.append(n2); |
| 2605 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 2605 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 2606 EXPECT_EQ(2, SimpleFinalizedObject::s_destructorCalls); | 2606 EXPECT_EQ(2, SimpleFinalizedObject::s_destructorCalls); |
| 2607 } | 2607 } |
| 2608 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 2608 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 2609 EXPECT_EQ(8, SimpleFinalizedObject::s_destructorCalls); | 2609 EXPECT_EQ(8, SimpleFinalizedObject::s_destructorCalls); |
| 2610 } | 2610 } |
| 2611 | 2611 |
| 2612 TEST(HeapTest, RawPtrInHash) |
| 2613 { |
| 2614 HashSet<RawPtr<int> > set; |
| 2615 set.add(new int(42)); |
| 2616 set.add(new int(42)); |
| 2617 EXPECT_EQ(2u, set.size()); |
| 2618 for (HashSet<RawPtr<int> >::iterator it = set.begin(); it != set.end(); ++it
) |
| 2619 EXPECT_EQ(42, **it); |
| 2620 } |
| 2621 |
| 2612 } // WebCore namespace | 2622 } // WebCore namespace |
| 2613 | 2623 |
| 2614 namespace WTF { | 2624 namespace WTF { |
| 2615 | 2625 |
| 2616 // We need the below vector trait specialization for the above HeapVectors to be
have correctly wrt. memset, memcmp etc. | 2626 // We need the below vector trait specialization for the above HeapVectors to be
have correctly wrt. memset, memcmp etc. |
| 2617 template<> struct VectorTraits<WebCore::VectorObject> : public SimpleClassVector
Traits<WebCore::VectorObject> { }; | 2627 template<> struct VectorTraits<WebCore::VectorObject> : public SimpleClassVector
Traits<WebCore::VectorObject> { }; |
| 2618 template<> struct VectorTraits<WebCore::VectorObjectInheritedTrace> : public Sim
pleClassVectorTraits<WebCore::VectorObjectInheritedTrace> { }; | 2628 template<> struct VectorTraits<WebCore::VectorObjectInheritedTrace> : public Sim
pleClassVectorTraits<WebCore::VectorObjectInheritedTrace> { }; |
| 2619 template<> struct VectorTraits<WebCore::VectorObjectNoTrace> : public SimpleClas
sVectorTraits<WebCore::VectorObjectNoTrace> { }; | 2629 template<> struct VectorTraits<WebCore::VectorObjectNoTrace> : public SimpleClas
sVectorTraits<WebCore::VectorObjectNoTrace> { }; |
| 2620 | 2630 |
| 2621 } // WTF namespace | 2631 } // WTF namespace |
| 2622 | 2632 |
| OLD | NEW |