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

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

Issue 1919663002: Unify and generalize thread static persistent finalization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: generalize clearing 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
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 #endif 132 #endif
133 if (UNLIKELY(!m_freeListHead)) 133 if (UNLIKELY(!m_freeListHead))
134 ensurePersistentNodeSlots(self, trace); 134 ensurePersistentNodeSlots(self, trace);
135 ASSERT(m_freeListHead); 135 ASSERT(m_freeListHead);
136 PersistentNode* node = m_freeListHead; 136 PersistentNode* node = m_freeListHead;
137 m_freeListHead = m_freeListHead->freeListNext(); 137 m_freeListHead = m_freeListHead->freeListNext();
138 node->initialize(self, trace); 138 node->initialize(self, trace);
139 ASSERT(!node->isUnused()); 139 ASSERT(!node->isUnused());
140 return node; 140 return node;
141 } 141 }
142
142 void freePersistentNode(PersistentNode* persistentNode) 143 void freePersistentNode(PersistentNode* persistentNode)
143 { 144 {
144 ASSERT(m_persistentCount > 0); 145 ASSERT(m_persistentCount > 0);
145 persistentNode->setFreeListNext(m_freeListHead); 146 persistentNode->setFreeListNext(m_freeListHead);
146 m_freeListHead = persistentNode; 147 m_freeListHead = persistentNode;
147 #if ENABLE(ASSERT) 148 #if ENABLE(ASSERT)
148 --m_persistentCount; 149 --m_persistentCount;
149 #endif 150 #endif
150 } 151 }
152
153 void releasePersistentNode(PersistentNode*, ThreadState::PersistentClearCall back);
151 void tracePersistentNodes(Visitor*); 154 void tracePersistentNodes(Visitor*);
152 int numberOfPersistents(); 155 int numberOfPersistents();
153 156
154 private: 157 private:
155 friend CrossThreadPersistentRegion; 158 friend CrossThreadPersistentRegion;
156 159
157 void ensurePersistentNodeSlots(void*, TraceCallback); 160 void ensurePersistentNodeSlots(void*, TraceCallback);
158 161
159 PersistentNode* m_freeListHead; 162 PersistentNode* m_freeListHead;
160 PersistentNodeSlots* m_slots; 163 PersistentNodeSlots* m_slots;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion 195 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion
193 // because we don't want to virtualize performance-sensitive methods 196 // because we don't want to virtualize performance-sensitive methods
194 // such as PersistentRegion::allocate/freePersistentNode. 197 // such as PersistentRegion::allocate/freePersistentNode.
195 OwnPtr<PersistentRegion> m_persistentRegion; 198 OwnPtr<PersistentRegion> m_persistentRegion;
196 Mutex m_mutex; 199 Mutex m_mutex;
197 }; 200 };
198 201
199 } // namespace blink 202 } // namespace blink
200 203
201 #endif 204 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698