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

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

Issue 1919663002: Unify and generalize thread static persistent finalization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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/ThreadState.h
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.h b/third_party/WebKit/Source/platform/heap/ThreadState.h
index 572810db2ddc431d87214d24be63fe8f2ae56589..1864d0082a5f79a532ff892de637e225aa2289f1 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.h
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.h
@@ -503,15 +503,14 @@ public:
size_t threadStackSize();
#endif
- // Registers a closure that will be called while the thread is shutting down
- // (i.e. ThreadState::isTerminating will be true), in order to allow for any
- // persistent handles that should be cleared.
- void registerThreadShutdownHook(PassOwnPtr<SameThreadClosure>);
+ void freePersistentNode(PersistentNode*);
-#if defined(LEAK_SANITIZER)
- void registerStaticPersistentNode(PersistentNode*);
+ using PersistentClearCallback = void(*)(void*);
+
+ void registerStaticPersistentNode(PersistentNode*, PersistentClearCallback);
void releaseStaticPersistentNodes();
+#if defined(LEAK_SANITIZER)
void enterStaticReferenceRegistrationDisabledScope();
void leaveStaticReferenceRegistrationDisabledScope();
#endif
@@ -656,19 +655,17 @@ private:
v8::Isolate* m_isolate;
void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*);
- // Invoked while the thread is terminating. Intended to be used to free
- // persistent pointers into the thread's heap.
- Vector<OwnPtr<SameThreadClosure>> m_threadShutdownHooks;
-
#if defined(ADDRESS_SANITIZER)
void* m_asanFakeStack;
#endif
-#if defined(LEAK_SANITIZER)
// PersistentNodes that are stored in static references;
- // references we have to clear before initiating LSan's leak detection.
- HashSet<PersistentNode*> m_staticPersistents;
+ // references that either have to be cleared upon the thread
+ // detaching from Oilpan and shutting down or references we
+ // have to clear before initiating LSan's leak detection.
+ HashMap<PersistentNode*, PersistentClearCallback> m_staticPersistents;
+#if defined(LEAK_SANITIZER)
// Count that controls scoped disabling of persistent registration.
size_t m_disabledStaticPersistentsRegistration;
#endif
« no previous file with comments | « third_party/WebKit/Source/platform/heap/PersistentNode.cpp ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698