| Index: Source/platform/WebThreadSupportingGC.cpp
|
| diff --git a/Source/platform/WebThreadSupportingGC.cpp b/Source/platform/WebThreadSupportingGC.cpp
|
| index f2aec3e1addf011c63eaf4c1a887c67e01faa58e..549b067b56af1d3990583af1bf8c9959e9250bc5 100644
|
| --- a/Source/platform/WebThreadSupportingGC.cpp
|
| +++ b/Source/platform/WebThreadSupportingGC.cpp
|
| @@ -11,6 +11,29 @@
|
|
|
| namespace blink {
|
|
|
| +PassOwnPtr<GCSupportForWebThread> GCSupportForWebThread::create(WebThread& thread)
|
| +{
|
| + return adoptPtr(new GCSupportForWebThread(thread));
|
| +}
|
| +
|
| +GCSupportForWebThread::GCSupportForWebThread(WebThread& thread)
|
| + : m_thread(thread)
|
| +{
|
| + m_pendingGCRunner = adoptPtr(new PendingGCRunner);
|
| + m_thread.addTaskObserver(m_pendingGCRunner.get());
|
| + ThreadState::attach();
|
| + OwnPtr<MessageLoopInterruptor> interruptor = adoptPtr(new MessageLoopInterruptor(&m_thread));
|
| + ThreadState::current()->addInterruptor(interruptor.release());
|
| +}
|
| +
|
| +GCSupportForWebThread::~GCSupportForWebThread()
|
| +{
|
| + m_thread.removeTaskObserver(m_pendingGCRunner.get());
|
| +
|
| + ThreadState::detach();
|
| + m_pendingGCRunner = nullptr;
|
| +}
|
| +
|
| PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name)
|
| {
|
| #if ENABLE(ASSERT)
|
| @@ -35,21 +58,14 @@ WebThreadSupportingGC::~WebThreadSupportingGC()
|
|
|
| void WebThreadSupportingGC::initialize()
|
| {
|
| - m_pendingGCRunner = adoptPtr(new PendingGCRunner);
|
| - platformThread().addTaskObserver(m_pendingGCRunner.get());
|
| - ThreadState::attach();
|
| - OwnPtr<MessageLoopInterruptor> interruptor = adoptPtr(new MessageLoopInterruptor(&platformThread()));
|
| - ThreadState::current()->addInterruptor(interruptor.release());
|
| + m_gcSupport = GCSupportForWebThread::create(platformThread());
|
| }
|
|
|
| void WebThreadSupportingGC::shutdown()
|
| {
|
| // Ensure no posted tasks will run from this point on.
|
| - platformThread().removeTaskObserver(m_pendingGCRunner.get());
|
| platformThread().scheduler()->shutdown();
|
| -
|
| - ThreadState::detach();
|
| - m_pendingGCRunner = nullptr;
|
| + m_gcSupport.clear();
|
| }
|
|
|
| } // namespace blink
|
|
|