| 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 // An implementation of WebThread in terms of base::MessageLoop and | 5 // An implementation of WebThread in terms of base::MessageLoop and |
| 6 // base::Thread | 6 // base::Thread |
| 7 | 7 |
| 8 #include "public/platform/scheduler/child/webthread_base.h" | 8 #include "public/platform/scheduler/child/webthread_base.h" |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // static | 85 // static |
| 86 void WebThreadBase::RunWebThreadIdleTask( | 86 void WebThreadBase::RunWebThreadIdleTask( |
| 87 std::unique_ptr<blink::WebThread::IdleTask> idle_task, | 87 std::unique_ptr<blink::WebThread::IdleTask> idle_task, |
| 88 base::TimeTicks deadline) { | 88 base::TimeTicks deadline) { |
| 89 idle_task->run((deadline - base::TimeTicks()).InSecondsF()); | 89 idle_task->run((deadline - base::TimeTicks()).InSecondsF()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void WebThreadBase::postIdleTask(const blink::WebTraceLocation& location, | 92 void WebThreadBase::postIdleTask(const blink::WebTraceLocation& location, |
| 93 IdleTask* idle_task) { | 93 IdleTask* idle_task) { |
| 94 GetIdleTaskRunner()->PostIdleTask( | 94 GetIdleTaskRunner()->PostIdleTask( |
| 95 location, base::Bind(&WebThreadBase::RunWebThreadIdleTask, | 95 location, |
| 96 base::Passed(base::WrapUnique(idle_task)))); | 96 base::Bind(&WebThreadBase::RunWebThreadIdleTask, |
| 97 base::Passed(base::WrapUnique(idle_task)))); |
| 97 } | 98 } |
| 98 | 99 |
| 99 bool WebThreadBase::isCurrentThread() const { | 100 bool WebThreadBase::isCurrentThread() const { |
| 100 return GetTaskRunner()->BelongsToCurrentThread(); | 101 return GetTaskRunner()->BelongsToCurrentThread(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 } // namespace scheduler | 104 } // namespace scheduler |
| 104 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |