OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "platform/WebThreadSupportingGC.h" | 6 #include "platform/WebThreadSupportingGC.h" |
7 | 7 |
8 #include "wtf/Threading.h" | |
9 | |
8 namespace blink { | 10 namespace blink { |
9 | 11 |
10 PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name ) | 12 PassOwnPtr<WebThreadSupportingGC> WebThreadSupportingGC::create(const char* name ) |
11 { | 13 { |
14 #if ENABLE(ASSERT) | |
15 WTF::willCreateThread(); | |
kinuko
2015/01/27 14:50:37
Adding a hook here feels a bit slippery, suggestio
| |
16 #endif | |
12 return adoptPtr(new WebThreadSupportingGC(name)); | 17 return adoptPtr(new WebThreadSupportingGC(name)); |
13 } | 18 } |
14 | 19 |
15 WebThreadSupportingGC::WebThreadSupportingGC(const char* name) | 20 WebThreadSupportingGC::WebThreadSupportingGC(const char* name) |
16 : m_thread(adoptPtr(Platform::current()->createThread(name))) | 21 : m_thread(adoptPtr(Platform::current()->createThread(name))) |
17 { | 22 { |
18 } | 23 } |
19 | 24 |
20 WebThreadSupportingGC::~WebThreadSupportingGC() | 25 WebThreadSupportingGC::~WebThreadSupportingGC() |
21 { | 26 { |
(...skipping 16 matching lines...) Expand all Loading... | |
38 void WebThreadSupportingGC::detachGC() | 43 void WebThreadSupportingGC::detachGC() |
39 { | 44 { |
40 ThreadState::current()->removeInterruptor(m_messageLoopInterruptor.get()); | 45 ThreadState::current()->removeInterruptor(m_messageLoopInterruptor.get()); |
41 ThreadState::detach(); | 46 ThreadState::detach(); |
42 platformThread().removeTaskObserver(m_pendingGCRunner.get()); | 47 platformThread().removeTaskObserver(m_pendingGCRunner.get()); |
43 m_pendingGCRunner = nullptr; | 48 m_pendingGCRunner = nullptr; |
44 m_messageLoopInterruptor = nullptr; | 49 m_messageLoopInterruptor = nullptr; |
45 } | 50 } |
46 | 51 |
47 } // namespace blink | 52 } // namespace blink |
OLD | NEW |