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

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

Issue 1881933005: Oilpan: Add ThreadState cleanup callbacks for static thread-specific persistent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename per haraken 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/ThreadState.cpp
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
index 6d2f2959c832fe7c8c5873207292cca86a1f4811..3b3cfd8eea9632f0e7cebc468e075a98360cff40 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -292,6 +292,12 @@ void ThreadState::cleanup()
// pointers into the heap owned by this thread.
m_isTerminating = true;
+ // Invoke the cleanup hooks. This gives an opportunity to release any
+ // persistent handles that may exist, e.g. in thread-specific static
+ // locals.
+ for (const OwnPtr<SameThreadClosure>& hook : m_threadShutdownHooks)
+ (*hook)();
+
// Set the terminate flag on all heap pages of this thread. This is used to
// ensure we don't trace pages on other threads that are not part of the
// thread local GC.
@@ -1359,6 +1365,13 @@ void ThreadState::addInterruptor(PassOwnPtr<BlinkGCInterruptor> interruptor)
}
}
+void ThreadState::registerThreadShutdownHook(PassOwnPtr<SameThreadClosure> hook)
+{
+ ASSERT(checkThread());
+ ASSERT(!isTerminating());
+ m_threadShutdownHooks.append(hook);
+}
+
#if defined(LEAK_SANITIZER)
void ThreadState::registerStaticPersistentNode(PersistentNode* node)
{
« no previous file with comments | « third_party/WebKit/Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698