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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // count to bail out early.) | 110 // count to bail out early.) |
111 PersistentNodeSlots* slots = m_persistentRegion->m_slots; | 111 PersistentNodeSlots* slots = m_persistentRegion->m_slots; |
112 while (slots) { | 112 while (slots) { |
113 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { | 113 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { |
114 if (slots->m_slot[i].isUnused()) | 114 if (slots->m_slot[i].isUnused()) |
115 continue; | 115 continue; |
116 | 116 |
117 // 'self' is in use, containing the cross-thread persistent wrapper
object. | 117 // 'self' is in use, containing the cross-thread persistent wrapper
object. |
118 CrossThreadPersistent<GCObject>* persistent = reinterpret_cast<Cross
ThreadPersistent<GCObject>*>(slots->m_slot[i].self()); | 118 CrossThreadPersistent<GCObject>* persistent = reinterpret_cast<Cross
ThreadPersistent<GCObject>*>(slots->m_slot[i].self()); |
119 ASSERT(persistent); | 119 ASSERT(persistent); |
120 void* rawObject = persistent->get(); | 120 void* rawObject = persistent->atomicGet(); |
121 if (!rawObject) | 121 if (!rawObject) |
122 continue; | 122 continue; |
123 BasePage* page = pageFromObject(rawObject); | 123 BasePage* page = pageFromObject(rawObject); |
124 ASSERT(page); | 124 ASSERT(page); |
125 // The main thread will upon detach just mark its heap pages as orph
aned, | 125 // The main thread will upon detach just mark its heap pages as orph
aned, |
126 // but not invalidate its CrossThreadPersistent<>s. | 126 // but not invalidate its CrossThreadPersistent<>s. |
127 if (page->orphaned()) | 127 if (page->orphaned()) |
128 continue; | 128 continue; |
129 if (page->heap()->threadState() == threadState) | 129 if (page->heap()->threadState() == threadState) |
130 persistent->clear(); | 130 persistent->clear(); |
131 } | 131 } |
132 slots = slots->m_next; | 132 slots = slots->m_next; |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 } // namespace blink | 136 } // namespace blink |
OLD | NEW |