Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: Source/heap/HeapTest.cpp

Issue 189543014: Ensure proper finalization of garbage-collected types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase and sign error in Vector Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/heap/Heap.h ('k') | Source/modules/crypto/WorkerGlobalScopeCrypto.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 bool isLastInArray() const { return m_isLast; } 1102 bool isLastInArray() const { return m_isLast; }
1103 void setLastInArray(bool value) { m_isLast = value; } 1103 void setLastInArray(bool value) { m_isLast = value; }
1104 1104
1105 IntWrapper* payload() const { return m_payload; } 1105 IntWrapper* payload() const { return m_payload; }
1106 1106
1107 private: 1107 private:
1108 Member<IntWrapper> m_payload; 1108 Member<IntWrapper> m_payload;
1109 bool m_isLast; 1109 bool m_isLast;
1110 }; 1110 };
1111 1111
1112 } // WebCore namespace
1113
1114 namespace WTF {
1115
1116 // We need the below vector trait specialization for the above HeapVectors to be have correctly wrt. memset, memcmp etc.
1117 template<> struct VectorTraits<WebCore::VectorObject> : public SimpleClassVector Traits<WebCore::VectorObject> { };
1118 template<> struct VectorTraits<WebCore::VectorObjectInheritedTrace> : public Sim pleClassVectorTraits<WebCore::VectorObjectInheritedTrace> { };
1119 template<> struct VectorTraits<WebCore::VectorObjectNoTrace> : public SimpleClas sVectorTraits<WebCore::VectorObjectNoTrace> { };
1120
1121 } // WTF namespace
1122
1123 namespace WebCore {
1124
1112 TEST(HeapTest, Transition) 1125 TEST(HeapTest, Transition)
1113 { 1126 {
1114 { 1127 {
1115 RefPtr<TransitionRefCounted> refCounted = TransitionRefCounted::create() ; 1128 RefPtr<TransitionRefCounted> refCounted = TransitionRefCounted::create() ;
1116 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); 1129 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount);
1117 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); 1130 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
1118 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount); 1131 EXPECT_EQ(1, TransitionRefCounted::s_aliveCount);
1119 } 1132 }
1120 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); 1133 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
1121 EXPECT_EQ(0, TransitionRefCounted::s_aliveCount); 1134 EXPECT_EQ(0, TransitionRefCounted::s_aliveCount);
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 } 2846 }
2834 2847
2835 Persistent<HeapLinkedStack<TerminatedArrayItem> > pStack = stack; 2848 Persistent<HeapLinkedStack<TerminatedArrayItem> > pStack = stack;
2836 2849
2837 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); 2850 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack);
2838 EXPECT_EQ(stackSize, static_cast<size_t>(IntWrapper::s_destructorCalls)); 2851 EXPECT_EQ(stackSize, static_cast<size_t>(IntWrapper::s_destructorCalls));
2839 EXPECT_EQ(0u, pStack->size()); 2852 EXPECT_EQ(0u, pStack->size());
2840 } 2853 }
2841 2854
2842 } // WebCore namespace 2855 } // WebCore namespace
2843
2844 namespace WTF {
2845
2846 // We need the below vector trait specialization for the above HeapVectors to be have correctly wrt. memset, memcmp etc.
2847 template<> struct VectorTraits<WebCore::VectorObject> : public SimpleClassVector Traits<WebCore::VectorObject> { };
2848 template<> struct VectorTraits<WebCore::VectorObjectInheritedTrace> : public Sim pleClassVectorTraits<WebCore::VectorObjectInheritedTrace> { };
2849 template<> struct VectorTraits<WebCore::VectorObjectNoTrace> : public SimpleClas sVectorTraits<WebCore::VectorObjectNoTrace> { };
2850
2851 } // WTF namespace
2852
OLDNEW
« no previous file with comments | « Source/heap/Heap.h ('k') | Source/modules/crypto/WorkerGlobalScopeCrypto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698