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

Side by Side Diff: third_party/WebKit/Source/platform/heap/PersistentNode.h

Issue 1904003002: CrossThreadPersistentRegion will only trace objects belonging to the current GCing ThreadHeap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/PersistentNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PersistentNode_h 5 #ifndef PersistentNode_h
6 #define PersistentNode_h 6 #define PersistentNode_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/heap/ThreadState.h" 9 #include "platform/heap/ThreadState.h"
10 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void freePersistentNode(PersistentNode* persistentNode) 143 void freePersistentNode(PersistentNode* persistentNode)
144 { 144 {
145 ASSERT(m_persistentCount > 0); 145 ASSERT(m_persistentCount > 0);
146 persistentNode->setFreeListNext(m_freeListHead); 146 persistentNode->setFreeListNext(m_freeListHead);
147 m_freeListHead = persistentNode; 147 m_freeListHead = persistentNode;
148 #if ENABLE(ASSERT) 148 #if ENABLE(ASSERT)
149 --m_persistentCount; 149 --m_persistentCount;
150 #endif 150 #endif
151 } 151 }
152 152
153 static bool shouldTracePersistentNode(Visitor*, PersistentNode*) { return tr ue; }
154
153 void releasePersistentNode(PersistentNode*, ThreadState::PersistentClearCall back); 155 void releasePersistentNode(PersistentNode*, ThreadState::PersistentClearCall back);
154 void tracePersistentNodes(Visitor*); 156 using ShouldTraceCallback = bool (*)(Visitor*, PersistentNode*);
157 void tracePersistentNodes(Visitor*, ShouldTraceCallback = PersistentRegion:: shouldTracePersistentNode);
155 int numberOfPersistents(); 158 int numberOfPersistents();
156 159
157 private: 160 private:
158 friend CrossThreadPersistentRegion; 161 friend CrossThreadPersistentRegion;
159 162
160 void ensurePersistentNodeSlots(void*, TraceCallback); 163 void ensurePersistentNodeSlots(void*, TraceCallback);
161 164
162 PersistentNode* m_freeListHead; 165 PersistentNode* m_freeListHead;
163 PersistentNodeSlots* m_slots; 166 PersistentNodeSlots* m_slots;
164 #if ENABLE(ASSERT) 167 #if ENABLE(ASSERT)
(...skipping 14 matching lines...) Expand all
179 182
180 void freePersistentNode(PersistentNode* persistentNode) 183 void freePersistentNode(PersistentNode* persistentNode)
181 { 184 {
182 MutexLocker lock(m_mutex); 185 MutexLocker lock(m_mutex);
183 m_persistentRegion->freePersistentNode(persistentNode); 186 m_persistentRegion->freePersistentNode(persistentNode);
184 } 187 }
185 188
186 void tracePersistentNodes(Visitor* visitor) 189 void tracePersistentNodes(Visitor* visitor)
187 { 190 {
188 MutexLocker lock(m_mutex); 191 MutexLocker lock(m_mutex);
189 m_persistentRegion->tracePersistentNodes(visitor); 192 m_persistentRegion->tracePersistentNodes(visitor, CrossThreadPersistentR egion::shouldTracePersistentNode);
190 } 193 }
191 194
192 void prepareForThreadStateTermination(ThreadState*); 195 void prepareForThreadStateTermination(ThreadState*);
193 196
197 static bool shouldTracePersistentNode(Visitor*, PersistentNode*);
198
194 private: 199 private:
195 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion 200 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion
196 // because we don't want to virtualize performance-sensitive methods 201 // because we don't want to virtualize performance-sensitive methods
197 // such as PersistentRegion::allocate/freePersistentNode. 202 // such as PersistentRegion::allocate/freePersistentNode.
198 OwnPtr<PersistentRegion> m_persistentRegion; 203 OwnPtr<PersistentRegion> m_persistentRegion;
199 Mutex m_mutex; 204 Mutex m_mutex;
200 }; 205 };
201 206
202 } // namespace blink 207 } // namespace blink
203 208
204 #endif 209 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/PersistentNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698