| 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 #ifndef WebThreadSupportingGC_h | 5 #ifndef WebThreadSupportingGC_h |
| 6 #define WebThreadSupportingGC_h | 6 #define WebThreadSupportingGC_h |
| 7 | 7 |
| 8 #include "platform/heap/GCTaskRunner.h" | 8 #include "platform/heap/GCTaskRunner.h" |
| 9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
| 10 #include "public/platform/WebTaskRunner.h" | 10 #include "public/platform/WebTaskRunner.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // thread allocates any objects managed by the Blink GC. The shutdown | 22 // thread allocates any objects managed by the Blink GC. The shutdown |
| 23 // method must be called on the WebThread during shutdown when the thread | 23 // method must be called on the WebThread during shutdown when the thread |
| 24 // no longer needs to access objects managed by the Blink GC. | 24 // no longer needs to access objects managed by the Blink GC. |
| 25 // | 25 // |
| 26 // WebThreadSupportingGC usually internally creates and owns WebThread unless | 26 // WebThreadSupportingGC usually internally creates and owns WebThread unless |
| 27 // an existing WebThread is given via createForThread. | 27 // an existing WebThread is given via createForThread. |
| 28 class PLATFORM_EXPORT WebThreadSupportingGC final { | 28 class PLATFORM_EXPORT WebThreadSupportingGC final { |
| 29 USING_FAST_MALLOC(WebThreadSupportingGC); | 29 USING_FAST_MALLOC(WebThreadSupportingGC); |
| 30 WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC); | 30 WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC); |
| 31 public: | 31 public: |
| 32 static PassOwnPtr<WebThreadSupportingGC> create(const char* name, bool perTh
readHeapEnabled = false); | 32 static PassOwnPtr<WebThreadSupportingGC> create(const char* name); |
| 33 static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*, bool pe
rThreadHeapEnabled = false); | 33 static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*); |
| 34 ~WebThreadSupportingGC(); | 34 ~WebThreadSupportingGC(); |
| 35 | 35 |
| 36 void postTask(const WebTraceLocation& location, PassOwnPtr<SameThreadClosure
> task) | 36 void postTask(const WebTraceLocation& location, PassOwnPtr<SameThreadClosure
> task) |
| 37 { | 37 { |
| 38 m_thread->getWebTaskRunner()->postTask(location, task); | 38 m_thread->getWebTaskRunner()->postTask(location, task); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void postDelayedTask(const WebTraceLocation& location, PassOwnPtr<SameThread
Closure> task, long long delayMs) | 41 void postDelayedTask(const WebTraceLocation& location, PassOwnPtr<SameThread
Closure> task, long long delayMs) |
| 42 { | 42 { |
| 43 m_thread->getWebTaskRunner()->postDelayedTask(location, task, delayMs); | 43 m_thread->getWebTaskRunner()->postDelayedTask(location, task, delayMs); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 71 void initialize(); | 71 void initialize(); |
| 72 void shutdown(); | 72 void shutdown(); |
| 73 | 73 |
| 74 WebThread& platformThread() const | 74 WebThread& platformThread() const |
| 75 { | 75 { |
| 76 ASSERT(m_thread); | 76 ASSERT(m_thread); |
| 77 return *m_thread; | 77 return *m_thread; |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 WebThreadSupportingGC(const char* name, WebThread*, bool perThreadHeapEnable
d); | 81 WebThreadSupportingGC(const char* name, WebThread*); |
| 82 | 82 |
| 83 OwnPtr<GCTaskRunner> m_gcTaskRunner; | 83 OwnPtr<GCTaskRunner> m_gcTaskRunner; |
| 84 | 84 |
| 85 // m_thread is guaranteed to be non-null after this instance is constructed. | 85 // m_thread is guaranteed to be non-null after this instance is constructed. |
| 86 // m_owningThread is non-null unless this instance is constructed for an | 86 // m_owningThread is non-null unless this instance is constructed for an |
| 87 // existing thread via createForThread(). | 87 // existing thread via createForThread(). |
| 88 WebThread* m_thread = nullptr; | 88 WebThread* m_thread = nullptr; |
| 89 OwnPtr<WebThread> m_owningThread; | 89 OwnPtr<WebThread> m_owningThread; |
| 90 bool m_perThreadHeapEnabled; | |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 } // namespace blink | 92 } // namespace blink |
| 94 | 93 |
| 95 #endif | 94 #endif |
| OLD | NEW |