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

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

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/Assertions.h" 10 #include "wtf/Assertions.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void prepareForThreadStateTermination(ThreadState*); 181 void prepareForThreadStateTermination(ThreadState*);
182 182
183 private: 183 private:
184 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion 184 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion
185 // because we don't want to virtualize performance-sensitive methods 185 // because we don't want to virtualize performance-sensitive methods
186 // such as PersistentRegion::allocate/freePersistentNode. 186 // such as PersistentRegion::allocate/freePersistentNode.
187 OwnPtr<PersistentRegion> m_persistentRegion; 187 OwnPtr<PersistentRegion> m_persistentRegion;
188 Mutex m_mutex; 188 Mutex m_mutex;
189 }; 189 };
190 190
191 class XThreadPersistentRegion final {
haraken 2016/01/07 08:06:22 XThreadPersistentRegion and CrossThreadPersistentR
192 public:
193 XThreadPersistentRegion() : m_persistentRegion(adoptPtr(new PersistentRegion )) { }
194
195 PersistentNode* allocatePersistentNode(void* self, TraceCallback trace)
196 {
197 MutexLocker lock(m_mutex);
198 return m_persistentRegion->allocatePersistentNode(self, trace);
199 }
200
201 void freePersistentNode(PersistentNode* persistentNode)
202 {
203 MutexLocker lock(m_mutex);
204 m_persistentRegion->freePersistentNode(persistentNode);
205 }
206
207 void tracePersistentNodes(Visitor* visitor)
208 {
209 MutexLocker lock(m_mutex);
210 m_persistentRegion->tracePersistentNodes(visitor);
211 }
212
213 void prepareForThreadStateTermination(ThreadState*);
214
215 private:
216 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion
217 // because we don't want to virtualize performance-sensitive methods
218 // such as PersistentRegion::allocate/freePersistentNode.
219 OwnPtr<PersistentRegion> m_persistentRegion;
220 Mutex m_mutex;
221 };
222
191 } // namespace blink 223 } // namespace blink
192 224
193 #endif 225 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698