| Index: Source/platform/UIWebThreadSupportingGC.cpp
|
| diff --git a/Source/platform/UIWebThreadSupportingGC.cpp b/Source/platform/UIWebThreadSupportingGC.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a581acf05f3edf2334d2862699c48a7cd5cf2b4e
|
| --- /dev/null
|
| +++ b/Source/platform/UIWebThreadSupportingGC.cpp
|
| @@ -0,0 +1,57 @@
|
| +#include "config.h"
|
| +#include "UIWebThreadSupportingGC.h"
|
| +#include "WebThreadRawPtr.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PassOwnPtr<UIWebThreadSupportingGC> UIWebThreadSupportingGC::create(const char* name)
|
| +{
|
| + return adoptPtr(new UIWebThreadSupportingGC(name));
|
| +}
|
| +
|
| +UIWebThreadSupportingGC::UIWebThreadSupportingGC(const char* name)
|
| + // : m_thread(WebThreadRawPtr(blink::Platform::current()->createThread(name)))
|
| + : m_attachedThreads(0)
|
| +{
|
| + m_thread = new WebThreadRawPtr(blink::Platform::current()->createThread(name));
|
| +}
|
| +
|
| +UIWebThreadSupportingGC::UIWebThreadSupportingGC(WebThread* t)
|
| + // : m_thread(WebThreadRawPtr(t))
|
| + : m_attachedThreads(0)
|
| +{
|
| + m_thread = new WebThreadRawPtr(t);
|
| +}
|
| +
|
| +void UIWebThreadSupportingGC::attachGC() {
|
| + if (m_attachedThreads == 0)
|
| + WebThreadSupportingGC::attachGC();
|
| +
|
| + m_attachedThreads++;
|
| +}
|
| +
|
| +void UIWebThreadSupportingGC::detachGC() {
|
| + m_attachedThreads--;
|
| +
|
| + if (m_attachedThreads == 0)
|
| + WebThreadSupportingGC::detachGC();
|
| +}
|
| +
|
| +UIWebThreadSupportingGC::ThreadMap* UIWebThreadSupportingGC::m_threadMap;
|
| +
|
| +UIWebThreadSupportingGC* UIWebThreadSupportingGC::get(WebThread* t) {
|
| + if (!m_threadMap)
|
| + m_threadMap = new ThreadMap(); // TODO should be ownptr
|
| +
|
| + ThreadMap::const_iterator iter = m_threadMap->find(t);
|
| + if (iter != m_threadMap->end()) {
|
| + return iter->value;
|
| + }
|
| +
|
| + UIWebThreadSupportingGC* uiWebThread = new UIWebThreadSupportingGC(t);
|
| + m_threadMap->add(t, uiWebThread);
|
| +
|
| + return uiWebThread;
|
| +}
|
| +
|
| +}
|
|
|