| 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 873baa3c94e48d340e093e52178b17933042dc4d..b26c3ea8315a6962b8d9be03a8cbc9e3d4ad4b60 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_cleanupHooks)
|
| + (*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::registerCleanupHook(PassOwnPtr<SameThreadClosure> hook)
|
| +{
|
| + ASSERT(checkThread());
|
| + ASSERT(!isTerminating());
|
| + m_cleanupHooks.append(hook);
|
| +}
|
| +
|
| #if defined(LEAK_SANITIZER)
|
| void ThreadState::registerStaticPersistentNode(PersistentNode* node)
|
| {
|
|
|