| OLD | NEW |
| (Empty) | |
| 1 #include "config.h" |
| 2 #include "UIWebThreadSupportingGC.h" |
| 3 #include "WebThreadRawPtr.h" |
| 4 |
| 5 namespace blink { |
| 6 |
| 7 PassOwnPtr<UIWebThreadSupportingGC> UIWebThreadSupportingGC::create(const char*
name) |
| 8 { |
| 9 return adoptPtr(new UIWebThreadSupportingGC(name)); |
| 10 } |
| 11 |
| 12 UIWebThreadSupportingGC::UIWebThreadSupportingGC(const char* name) |
| 13 // : m_thread(WebThreadRawPtr(blink::Platform::current()->createThread(name)
)) |
| 14 : m_attachedThreads(0) |
| 15 { |
| 16 m_thread = new WebThreadRawPtr(blink::Platform::current()->createThread(name
)); |
| 17 } |
| 18 |
| 19 UIWebThreadSupportingGC::UIWebThreadSupportingGC(WebThread* t) |
| 20 // : m_thread(WebThreadRawPtr(t)) |
| 21 : m_attachedThreads(0) |
| 22 { |
| 23 m_thread = new WebThreadRawPtr(t); |
| 24 } |
| 25 |
| 26 void UIWebThreadSupportingGC::attachGC() { |
| 27 if (m_attachedThreads == 0) |
| 28 WebThreadSupportingGC::attachGC(); |
| 29 |
| 30 m_attachedThreads++; |
| 31 } |
| 32 |
| 33 void UIWebThreadSupportingGC::detachGC() { |
| 34 m_attachedThreads--; |
| 35 |
| 36 if (m_attachedThreads == 0) |
| 37 WebThreadSupportingGC::detachGC(); |
| 38 } |
| 39 |
| 40 UIWebThreadSupportingGC::ThreadMap* UIWebThreadSupportingGC::m_threadMap; |
| 41 |
| 42 UIWebThreadSupportingGC* UIWebThreadSupportingGC::get(WebThread* t) { |
| 43 if (!m_threadMap) |
| 44 m_threadMap = new ThreadMap(); // TODO should be ownptr |
| 45 |
| 46 ThreadMap::const_iterator iter = m_threadMap->find(t); |
| 47 if (iter != m_threadMap->end()) { |
| 48 return iter->value; |
| 49 } |
| 50 |
| 51 UIWebThreadSupportingGC* uiWebThread = new UIWebThreadSupportingGC(t); |
| 52 m_threadMap->add(t, uiWebThread); |
| 53 |
| 54 return uiWebThread; |
| 55 } |
| 56 |
| 57 } |
| OLD | NEW |