| 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 <memory> | 8 #include <memory> |
| 9 #include "platform/WebTaskRunner.h" | 9 #include "platform/WebTaskRunner.h" |
| 10 #include "platform/heap/GCTaskRunner.h" | 10 #include "platform/heap/GCTaskRunner.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 static std::unique_ptr<WebThreadSupportingGC> CreateForThread(WebThread*); | 33 static std::unique_ptr<WebThreadSupportingGC> CreateForThread(WebThread*); |
| 34 ~WebThreadSupportingGC(); | 34 ~WebThreadSupportingGC(); |
| 35 | 35 |
| 36 void PostTask(const WebTraceLocation& location, | 36 void PostTask(const WebTraceLocation& location, |
| 37 std::unique_ptr<WTF::Closure> task) { | 37 std::unique_ptr<WTF::Closure> task) { |
| 38 thread_->GetWebTaskRunner()->PostTask(location, std::move(task)); | 38 thread_->GetWebTaskRunner()->PostTask(location, std::move(task)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void PostDelayedTask(const WebTraceLocation& location, | 41 void PostDelayedTask(const WebTraceLocation& location, |
| 42 std::unique_ptr<WTF::Closure> task, | 42 std::unique_ptr<WTF::Closure> task, |
| 43 long long delay_ms) { | 43 WTF::TimeDelta delay) { |
| 44 thread_->GetWebTaskRunner()->PostDelayedTask(location, std::move(task), | 44 thread_->GetWebTaskRunner()->PostDelayedTask(location, std::move(task), |
| 45 delay_ms); | 45 delay); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void PostTask(const WebTraceLocation& location, | 48 void PostTask(const WebTraceLocation& location, |
| 49 std::unique_ptr<CrossThreadClosure> task) { | 49 std::unique_ptr<CrossThreadClosure> task) { |
| 50 thread_->GetWebTaskRunner()->PostTask(location, std::move(task)); | 50 thread_->GetWebTaskRunner()->PostTask(location, std::move(task)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void PostDelayedTask(const WebTraceLocation& location, | 53 void PostDelayedTask(const WebTraceLocation& location, |
| 54 std::unique_ptr<CrossThreadClosure> task, | 54 std::unique_ptr<CrossThreadClosure> task, |
| 55 long long delay_ms) { | 55 WTF::TimeDelta delay) { |
| 56 thread_->GetWebTaskRunner()->PostDelayedTask(location, std::move(task), | 56 thread_->GetWebTaskRunner()->PostDelayedTask(location, std::move(task), |
| 57 delay_ms); | 57 delay); |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool IsCurrentThread() const { return thread_->IsCurrentThread(); } | 60 bool IsCurrentThread() const { return thread_->IsCurrentThread(); } |
| 61 | 61 |
| 62 void AddTaskObserver(WebThread::TaskObserver* observer) { | 62 void AddTaskObserver(WebThread::TaskObserver* observer) { |
| 63 thread_->AddTaskObserver(observer); | 63 thread_->AddTaskObserver(observer); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void RemoveTaskObserver(WebThread::TaskObserver* observer) { | 66 void RemoveTaskObserver(WebThread::TaskObserver* observer) { |
| 67 thread_->RemoveTaskObserver(observer); | 67 thread_->RemoveTaskObserver(observer); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 83 // m_thread is guaranteed to be non-null after this instance is constructed. | 83 // m_thread is guaranteed to be non-null after this instance is constructed. |
| 84 // m_owningThread is non-null unless this instance is constructed for an | 84 // m_owningThread is non-null unless this instance is constructed for an |
| 85 // existing thread via createForThread(). | 85 // existing thread via createForThread(). |
| 86 WebThread* thread_ = nullptr; | 86 WebThread* thread_ = nullptr; |
| 87 std::unique_ptr<WebThread> owning_thread_; | 87 std::unique_ptr<WebThread> owning_thread_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| 91 | 91 |
| 92 #endif | 92 #endif |
| OLD | NEW |