| 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 "base/debug/alias.h" | 7 #include "base/debug/alias.h" |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // object. | 158 // object. |
| 159 CrossThreadPersistent<DummyGCBase>* persistent = | 159 CrossThreadPersistent<DummyGCBase>* persistent = |
| 160 reinterpret_cast<CrossThreadPersistent<DummyGCBase>*>( | 160 reinterpret_cast<CrossThreadPersistent<DummyGCBase>*>( |
| 161 slots->m_slot[i].self()); | 161 slots->m_slot[i].self()); |
| 162 ASSERT(persistent); | 162 ASSERT(persistent); |
| 163 void* rawObject = persistent->atomicGet(); | 163 void* rawObject = persistent->atomicGet(); |
| 164 if (!rawObject) | 164 if (!rawObject) |
| 165 continue; | 165 continue; |
| 166 BasePage* page = pageFromObject(rawObject); | 166 BasePage* page = pageFromObject(rawObject); |
| 167 ASSERT(page); | 167 ASSERT(page); |
| 168 // The main thread will upon detach just mark its heap pages as orphaned, | |
| 169 // but not invalidate its CrossThreadPersistent<>s. | |
| 170 if (page->orphaned()) | |
| 171 continue; | |
| 172 if (page->arena()->getThreadState() == threadState) { | 168 if (page->arena()->getThreadState() == threadState) { |
| 173 persistent->clear(); | 169 persistent->clear(); |
| 174 ASSERT(slots->m_slot[i].isUnused()); | 170 ASSERT(slots->m_slot[i].isUnused()); |
| 175 } | 171 } |
| 176 } | 172 } |
| 177 slots = slots->m_next; | 173 slots = slots->m_next; |
| 178 } | 174 } |
| 179 } | 175 } |
| 180 | 176 |
| 181 #if defined(ADDRESS_SANITIZER) | 177 #if defined(ADDRESS_SANITIZER) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 193 } | 189 } |
| 194 } | 190 } |
| 195 } | 191 } |
| 196 #if DCHECK_IS_ON() | 192 #if DCHECK_IS_ON() |
| 197 DCHECK_EQ(persistentCount, m_persistentRegion->m_persistentCount); | 193 DCHECK_EQ(persistentCount, m_persistentRegion->m_persistentCount); |
| 198 #endif | 194 #endif |
| 199 } | 195 } |
| 200 #endif | 196 #endif |
| 201 | 197 |
| 202 } // namespace blink | 198 } // namespace blink |
| OLD | NEW |