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 10 matching lines...) Expand all Loading... | |
21 // thread allocates any objects managed by the Blink GC. The shutdown | 21 // thread allocates any objects managed by the Blink GC. The shutdown |
22 // method must be called on the WebThread during shutdown when the thread | 22 // method must be called on the WebThread during shutdown when the thread |
23 // no longer needs to access objects managed by the Blink GC. | 23 // no longer needs to access objects managed by the Blink GC. |
24 // | 24 // |
25 // WebThreadSupportingGC usually internally creates and owns WebThread unless | 25 // WebThreadSupportingGC usually internally creates and owns WebThread unless |
26 // an existing WebThread is given via createForThread. | 26 // an existing WebThread is given via createForThread. |
27 class PLATFORM_EXPORT WebThreadSupportingGC final { | 27 class PLATFORM_EXPORT WebThreadSupportingGC final { |
28 USING_FAST_MALLOC(WebThreadSupportingGC); | 28 USING_FAST_MALLOC(WebThreadSupportingGC); |
29 WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC); | 29 WTF_MAKE_NONCOPYABLE(WebThreadSupportingGC); |
30 public: | 30 public: |
31 static std::unique_ptr<WebThreadSupportingGC> create(const char* name, bool perThreadHeapEnabled = false); | 31 static std::unique_ptr<WebThreadSupportingGC> create(const char* name, Threa dHeapMode); |
32 static std::unique_ptr<WebThreadSupportingGC> createForThread(WebThread*, bo ol perThreadHeapEnabled = false); | 32 static std::unique_ptr<WebThreadSupportingGC> createForThread(WebThread*, Th readHeapMode); |
33 ~WebThreadSupportingGC(); | 33 ~WebThreadSupportingGC(); |
34 | 34 |
35 void postTask(const WebTraceLocation& location, std::unique_ptr<WTF::Closure > task) | 35 void postTask(const WebTraceLocation& location, std::unique_ptr<WTF::Closure > task) |
36 { | 36 { |
37 m_thread->getWebTaskRunner()->postTask(location, std::move(task)); | 37 m_thread->getWebTaskRunner()->postTask(location, std::move(task)); |
38 } | 38 } |
39 | 39 |
40 void postDelayedTask(const WebTraceLocation& location, std::unique_ptr<WTF:: Closure> task, long long delayMs) | 40 void postDelayedTask(const WebTraceLocation& location, std::unique_ptr<WTF:: Closure> task, long long delayMs) |
41 { | 41 { |
42 m_thread->getWebTaskRunner()->postDelayedTask(location, std::move(task), delayMs); | 42 m_thread->getWebTaskRunner()->postDelayedTask(location, std::move(task), delayMs); |
(...skipping 27 matching lines...) Expand all Loading... | |
70 void initialize(); | 70 void initialize(); |
71 void shutdown(); | 71 void shutdown(); |
72 | 72 |
73 WebThread& platformThread() const | 73 WebThread& platformThread() const |
74 { | 74 { |
75 ASSERT(m_thread); | 75 ASSERT(m_thread); |
76 return *m_thread; | 76 return *m_thread; |
77 } | 77 } |
78 | 78 |
79 private: | 79 private: |
80 WebThreadSupportingGC(const char* name, WebThread*, bool perThreadHeapEnable d); | 80 WebThreadSupportingGC(const char* name, WebThread*, ThreadHeapMode); |
81 | 81 |
82 std::unique_ptr<GCTaskRunner> m_gcTaskRunner; | 82 std::unique_ptr<GCTaskRunner> m_gcTaskRunner; |
83 | 83 |
84 // m_thread is guaranteed to be non-null after this instance is constructed. | 84 // m_thread is guaranteed to be non-null after this instance is constructed. |
85 // m_owningThread is non-null unless this instance is constructed for an | 85 // m_owningThread is non-null unless this instance is constructed for an |
86 // existing thread via createForThread(). | 86 // existing thread via createForThread(). |
87 WebThread* m_thread = nullptr; | 87 WebThread* m_thread = nullptr; |
88 std::unique_ptr<WebThread> m_owningThread; | 88 std::unique_ptr<WebThread> m_owningThread; |
89 bool m_perThreadHeapEnabled; | 89 ThreadHeapMode m_threadHeapMode; |
nhiroki
2016/09/21 05:15:26
const?
keishi
2016/09/21 07:06:37
Done.
| |
90 }; | 90 }; |
91 | 91 |
92 } // namespace blink | 92 } // namespace blink |
93 | 93 |
94 #endif | 94 #endif |
OLD | NEW |