| 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 #include "platform/heap/PersistentNode.h" | 5 #include "platform/heap/PersistentNode.h" |
| 6 | 6 |
| 7 #include "platform/heap/Handle.h" | 7 #include "platform/heap/Handle.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 freeListLast->setFreeListNext(m_freeListHead); | 112 freeListLast->setFreeListNext(m_freeListHead); |
| 113 m_freeListHead = freeListNext; | 113 m_freeListHead = freeListNext; |
| 114 } | 114 } |
| 115 prevNext = &slots->m_next; | 115 prevNext = &slots->m_next; |
| 116 slots = slots->m_next; | 116 slots = slots->m_next; |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 ASSERT(persistentCount == m_persistentCount); | 119 ASSERT(persistentCount == m_persistentCount); |
| 120 } | 120 } |
| 121 | 121 |
| 122 | |
| 123 namespace { | |
| 124 class GCObject final : public GarbageCollected<GCObject> { | |
| 125 public: | |
| 126 DEFINE_INLINE_TRACE() { } | |
| 127 }; | |
| 128 } | |
| 129 | |
| 130 void CrossThreadPersistentRegion::prepareForThreadStateTermination(ThreadState*
threadState) | 122 void CrossThreadPersistentRegion::prepareForThreadStateTermination(ThreadState*
threadState) |
| 131 { | 123 { |
| 132 // For heaps belonging to a thread that's detaching, any cross-thread persis
tents | 124 // For heaps belonging to a thread that's detaching, any cross-thread persis
tents |
| 133 // pointing into them needs to be disabled. Do that by clearing out the unde
rlying | 125 // pointing into them needs to be disabled. Do that by clearing out the unde
rlying |
| 134 // heap reference. | 126 // heap reference. |
| 135 MutexLocker lock(m_mutex); | 127 MutexLocker lock(m_mutex); |
| 136 | 128 |
| 137 // TODO(sof): consider ways of reducing overhead. (e.g., tracking number of
active | 129 // TODO(sof): consider ways of reducing overhead. (e.g., tracking number of
active |
| 138 // CrossThreadPersistent<>s pointing into the heaps of each ThreadState and
use that | 130 // CrossThreadPersistent<>s pointing into the heaps of each ThreadState and
use that |
| 139 // count to bail out early.) | 131 // count to bail out early.) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 156 if (page->orphaned()) | 148 if (page->orphaned()) |
| 157 continue; | 149 continue; |
| 158 if (page->arena()->getThreadState() == threadState) | 150 if (page->arena()->getThreadState() == threadState) |
| 159 persistent->clear(); | 151 persistent->clear(); |
| 160 } | 152 } |
| 161 slots = slots->m_next; | 153 slots = slots->m_next; |
| 162 } | 154 } |
| 163 } | 155 } |
| 164 | 156 |
| 165 } // namespace blink | 157 } // namespace blink |
| OLD | NEW |