| OLD | NEW |
| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 #if DCHECK_IS_ON() | 162 #if DCHECK_IS_ON() |
| 163 int m_persistentCount; | 163 int m_persistentCount; |
| 164 #endif | 164 #endif |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 class CrossThreadPersistentRegion final { | 167 class CrossThreadPersistentRegion final { |
| 168 USING_FAST_MALLOC(CrossThreadPersistentRegion); | 168 USING_FAST_MALLOC(CrossThreadPersistentRegion); |
| 169 | 169 |
| 170 public: | 170 public: |
| 171 CrossThreadPersistentRegion() | 171 CrossThreadPersistentRegion() |
| 172 : m_persistentRegion(wrapUnique(new PersistentRegion)) {} | 172 : m_persistentRegion(WTF::wrapUnique(new PersistentRegion)) {} |
| 173 | 173 |
| 174 void allocatePersistentNode(PersistentNode*& persistentNode, | 174 void allocatePersistentNode(PersistentNode*& persistentNode, |
| 175 void* self, | 175 void* self, |
| 176 TraceCallback trace) { | 176 TraceCallback trace) { |
| 177 MutexLocker lock(m_mutex); | 177 MutexLocker lock(m_mutex); |
| 178 PersistentNode* node = | 178 PersistentNode* node = |
| 179 m_persistentRegion->allocatePersistentNode(self, trace); | 179 m_persistentRegion->allocatePersistentNode(self, trace); |
| 180 releaseStore(reinterpret_cast<void* volatile*>(&persistentNode), node); | 180 releaseStore(reinterpret_cast<void* volatile*>(&persistentNode), node); |
| 181 } | 181 } |
| 182 | 182 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // Recursive as prepareForThreadStateTermination() clears a PersistentNode's | 245 // Recursive as prepareForThreadStateTermination() clears a PersistentNode's |
| 246 // associated Persistent<> -- it in turn freeing the PersistentNode. And both | 246 // associated Persistent<> -- it in turn freeing the PersistentNode. And both |
| 247 // CrossThreadPersistentRegion operations need a lock on the region before | 247 // CrossThreadPersistentRegion operations need a lock on the region before |
| 248 // mutating. | 248 // mutating. |
| 249 RecursiveMutex m_mutex; | 249 RecursiveMutex m_mutex; |
| 250 }; | 250 }; |
| 251 | 251 |
| 252 } // namespace blink | 252 } // namespace blink |
| 253 | 253 |
| 254 #endif | 254 #endif |
| OLD | NEW |