Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: third_party/WebKit/Source/platform/heap/Persistent.h

Issue 2106863003: Handle cross-thread weak persistents during global weak processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only treat cross-thread weaks during global weak processing Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}
« no previous file with comments | « third_party/WebKit/Source/platform/heap/MarkingVisitorImpl.h ('k') | third_party/WebKit/Source/platform/heap/Visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698