| 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 15 matching lines...) Expand all Loading... |
| 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); | 32 static PassOwnPtr<WebThreadSupportingGC> create(const char* name); |
| 33 static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*); | 33 static PassOwnPtr<WebThreadSupportingGC> createForThread(WebThread*); |
| 34 ~WebThreadSupportingGC(); | 34 ~WebThreadSupportingGC(); |
| 35 | 35 |
| 36 void postTask(const WebTraceLocation& location, PassOwnPtr<Closure> 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<Closure> t
ask, 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); |
| 44 } | 44 } |
| 45 |
| 46 void postTask(const WebTraceLocation& location, PassOwnPtr<CrossThreadClosur
e> task) |
| 47 { |
| 48 m_thread->getWebTaskRunner()->postTask(location, task); |
| 49 } |
| 50 |
| 51 void postDelayedTask(const WebTraceLocation& location, PassOwnPtr<CrossThrea
dClosure> task, long long delayMs) |
| 52 { |
| 53 m_thread->getWebTaskRunner()->postDelayedTask(location, task, delayMs); |
| 54 } |
| 45 | 55 |
| 46 bool isCurrentThread() const | 56 bool isCurrentThread() const |
| 47 { | 57 { |
| 48 return m_thread->isCurrentThread(); | 58 return m_thread->isCurrentThread(); |
| 49 } | 59 } |
| 50 | 60 |
| 51 void addTaskObserver(WebThread::TaskObserver* observer) | 61 void addTaskObserver(WebThread::TaskObserver* observer) |
| 52 { | 62 { |
| 53 m_thread->addTaskObserver(observer); | 63 m_thread->addTaskObserver(observer); |
| 54 } | 64 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 75 // 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. |
| 76 // 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 |
| 77 // existing thread via createForThread(). | 87 // existing thread via createForThread(). |
| 78 WebThread* m_thread = nullptr; | 88 WebThread* m_thread = nullptr; |
| 79 OwnPtr<WebThread> m_owningThread; | 89 OwnPtr<WebThread> m_owningThread; |
| 80 }; | 90 }; |
| 81 | 91 |
| 82 } // namespace blink | 92 } // namespace blink |
| 83 | 93 |
| 84 #endif | 94 #endif |
| OLD | NEW |