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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 void prepareForThreadStateTermination(ThreadState*); | 195 void prepareForThreadStateTermination(ThreadState*); |
196 | 196 |
197 static bool shouldTracePersistentNode(Visitor*, PersistentNode*); | 197 static bool shouldTracePersistentNode(Visitor*, PersistentNode*); |
198 | 198 |
199 private: | 199 private: |
200 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion | 200 // We don't make CrossThreadPersistentRegion inherit from PersistentRegion |
201 // because we don't want to virtualize performance-sensitive methods | 201 // because we don't want to virtualize performance-sensitive methods |
202 // such as PersistentRegion::allocate/freePersistentNode. | 202 // such as PersistentRegion::allocate/freePersistentNode. |
203 OwnPtr<PersistentRegion> m_persistentRegion; | 203 OwnPtr<PersistentRegion> m_persistentRegion; |
204 Mutex m_mutex; | 204 |
| 205 // Recursive as prepareForThreadStateTermination() clears a PersistentNode's |
| 206 // associated Persistent<> -- it in turn freeing the PersistentNode. And bot
h |
| 207 // CrossThreadPersistentRegion operations need a lock on the region before |
| 208 // mutating. |
| 209 RecursiveMutex m_mutex; |
205 }; | 210 }; |
206 | 211 |
207 } // namespace blink | 212 } // namespace blink |
208 | 213 |
209 #endif | 214 #endif |
OLD | NEW |