Chromium Code Reviews| Index: third_party/WebKit/Source/platform/heap/Persistent.h |
| diff --git a/third_party/WebKit/Source/platform/heap/Persistent.h b/third_party/WebKit/Source/platform/heap/Persistent.h |
| index 034afd70935aca72ce039c650978cf77454c1212..420d487cb2c0af301e3f82d17f3616d228fb6d22 100644 |
| --- a/third_party/WebKit/Source/platform/heap/Persistent.h |
| +++ b/third_party/WebKit/Source/platform/heap/Persistent.h |
| @@ -184,10 +184,14 @@ private: |
| { |
| static_assert(sizeof(T), "T must be fully defined"); |
| static_assert(IsGarbageCollectedType<T>::value, "T needs to be a garbage collected object"); |
| - if (weaknessConfiguration == WeakPersistentConfiguration) |
| - visitor->registerWeakMembers(this, m_raw, handleWeakPersistent); |
| - else |
| + if (weaknessConfiguration == WeakPersistentConfiguration) { |
| + if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) |
| + visitor->registerWeakCellWithCallback(reinterpret_cast<void**>(this), handleWeakPersistent); |
| + else |
| + visitor->registerWeakMembers(this, m_raw, handleWeakPersistent); |
|
haraken
2016/06/29 00:41:54
Is there any reason you don't want to move this on
sof
2016/06/29 05:13:47
It would be untidy to do so, as Persistent<>s have
|
| + } else { |
| visitor->mark(m_raw); |
| + } |
| } |
| NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| @@ -246,11 +250,12 @@ private: |
| #endif |
| } |
| - static void handleWeakPersistent(Visitor* self, void* object) |
| + static void handleWeakPersistent(Visitor* self, void* persistentPointer) |
| { |
| using Base = PersistentBase<typename std::remove_const<T>::type, weaknessConfiguration, crossThreadnessConfiguration>; |
| - Base* persistent = reinterpret_cast<Base*>(object); |
| - if (persistent->get() && !ObjectAliveTrait<T>::isHeapObjectAlive(persistent->get())) |
| + Base* persistent = reinterpret_cast<Base*>(persistentPointer); |
| + T* object = persistent->get(); |
| + if (object && !ObjectAliveTrait<T>::isHeapObjectAlive(object)) |
| persistent->clear(); |
| } |