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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
970 public: | 970 public: |
971 VectorObjectNoTrace() | 971 VectorObjectNoTrace() |
972 { | 972 { |
973 m_value = SimpleFinalizedObject::create(); | 973 m_value = SimpleFinalizedObject::create(); |
974 } | 974 } |
975 | 975 |
976 private: | 976 private: |
977 Member<SimpleFinalizedObject> m_value; | 977 Member<SimpleFinalizedObject> m_value; |
978 }; | 978 }; |
979 | 979 |
980 } // WebCore namespace | |
981 | |
982 namespace WTF { | |
Mads Ager (chromium)
2014/03/11 13:34:41
Why do you need to move this Ian?
zerny-chromium
2014/03/11 13:54:12
The below code uses inlineCapacity for a vector of
Mads Ager (chromium)
2014/03/11 15:09:20
Ah, yes, thanks for the explanation. :)
| |
983 | |
984 // We need the below vector trait specialization for the above HeapVectors to be have correctly wrt. memset, memcmp etc. | |
985 template<> struct VectorTraits<WebCore::VectorObject> : public SimpleClassVector Traits<WebCore::VectorObject> { }; | |
986 template<> struct VectorTraits<WebCore::VectorObjectInheritedTrace> : public Sim pleClassVectorTraits<WebCore::VectorObjectInheritedTrace> { }; | |
987 template<> struct VectorTraits<WebCore::VectorObjectNoTrace> : public SimpleClas sVectorTraits<WebCore::VectorObjectNoTrace> { }; | |
988 | |
989 } // WTF namespace | |
990 | |
991 namespace WebCore { | |
992 | |
993 | |
980 TEST(HeapTest, Transition) | 994 TEST(HeapTest, Transition) |
981 { | 995 { |
982 { | 996 { |
983 RefPtr<TransitionRefCounted> refCounted = TransitionRefCounted::create() ; | 997 RefPtr<TransitionRefCounted> refCounted = TransitionRefCounted::create() ; |
984 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); | 998 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); |
985 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 999 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
986 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); | 1000 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); |
987 } | 1001 } |
988 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 1002 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
989 EXPECT_EQ(0, TransitionRefCounted::s_aliveCount); | 1003 EXPECT_EQ(0, TransitionRefCounted::s_aliveCount); |
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2613 { | 2627 { |
2614 HashSet<RawPtr<int> > set; | 2628 HashSet<RawPtr<int> > set; |
2615 set.add(new int(42)); | 2629 set.add(new int(42)); |
2616 set.add(new int(42)); | 2630 set.add(new int(42)); |
2617 EXPECT_EQ(2u, set.size()); | 2631 EXPECT_EQ(2u, set.size()); |
2618 for (HashSet<RawPtr<int> >::iterator it = set.begin(); it != set.end(); ++it ) | 2632 for (HashSet<RawPtr<int> >::iterator it = set.begin(); it != set.end(); ++it ) |
2619 EXPECT_EQ(42, **it); | 2633 EXPECT_EQ(42, **it); |
2620 } | 2634 } |
2621 | 2635 |
2622 } // WebCore namespace | 2636 } // WebCore namespace |
2623 | |
2624 namespace WTF { | |
2625 | |
2626 // We need the below vector trait specialization for the above HeapVectors to be have correctly wrt. memset, memcmp etc. | |
2627 template<> struct VectorTraits<WebCore::VectorObject> : public SimpleClassVector Traits<WebCore::VectorObject> { }; | |
2628 template<> struct VectorTraits<WebCore::VectorObjectInheritedTrace> : public Sim pleClassVectorTraits<WebCore::VectorObjectInheritedTrace> { }; | |
2629 template<> struct VectorTraits<WebCore::VectorObjectNoTrace> : public SimpleClas sVectorTraits<WebCore::VectorObjectNoTrace> { }; | |
2630 | |
2631 } // WTF namespace | |
2632 | |
OLD | NEW |