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

Side by Side 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, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/UIWebThreadSupportingGC.h ('k') | Source/platform/WebThreadOwnPtr.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« 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