Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: Source/platform/UIWebThreadSupportingGC.cpp

Issue 474683003: Not for review - Rebase of crrev.com/62833003 Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/UIWebThreadSupportingGC.h ('k') | Source/platform/WebThreadOwnPtr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
+
+}
« no previous file with comments | « Source/platform/UIWebThreadSupportingGC.h ('k') | Source/platform/WebThreadOwnPtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698