| Index: Source/platform/WebThreadSupportingGC.cpp
|
| diff --git a/Source/platform/WebThreadSupportingGC.cpp b/Source/platform/WebThreadSupportingGC.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c0b9c3e44dee3529817f7d69c92af30a1bfe5107
|
| --- /dev/null
|
| +++ b/Source/platform/WebThreadSupportingGC.cpp
|
| @@ -0,0 +1,38 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "platform/WebThreadSupportingGC.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name)
|
| +{
|
| + return adoptPtr(new WebThreadSupportingGC(name));
|
| +}
|
| +
|
| +WebThreadSupportingGC::WebThreadSupportingGC(const char* name)
|
| + : m_thread(adoptPtr(blink::Platform::current()->createThread(name)))
|
| +{
|
| +}
|
| +
|
| +void WebThreadSupportingGC::attachGC()
|
| +{
|
| + m_pendingGCRunner = adoptPtr(new PendingGCRunner);
|
| + m_messageLoopInterruptor = adoptPtr(new MessageLoopInterruptor(&platformThread()));
|
| + platformThread().addTaskObserver(m_pendingGCRunner.get());
|
| + ThreadState::attach();
|
| + ThreadState::current()->addInterruptor(m_messageLoopInterruptor.get());
|
| +}
|
| +
|
| +void WebThreadSupportingGC::detachGC()
|
| +{
|
| + ThreadState::current()->removeInterruptor(m_messageLoopInterruptor.get());
|
| + ThreadState::detach();
|
| + platformThread().removeTaskObserver(m_pendingGCRunner.get());
|
| + m_pendingGCRunner = nullptr;
|
| + m_messageLoopInterruptor = nullptr;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|