OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/client/plugin/pepper_main_thread_task_runner.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "ppapi/cpp/core.h" |
| 9 |
| 10 namespace remoting { |
| 11 |
| 12 PepperMainThreadTaskRunner::PepperMainThreadTaskRunner() |
| 13 : core_(pp::Module::Get()->core()), callback_factory_(this) {} |
| 14 |
| 15 bool PepperMainThreadTaskRunner::PostDelayedTask( |
| 16 const tracked_objects::Location& from_here, |
| 17 const base::Closure& task, |
| 18 base::TimeDelta delay) { |
| 19 core_->CallOnMainThread(delay.InMillisecondsRoundedUp(), |
| 20 callback_factory_.NewCallback( |
| 21 &PepperMainThreadTaskRunner::RunTask, task)); |
| 22 return true; |
| 23 } |
| 24 |
| 25 bool PepperMainThreadTaskRunner::PostNonNestableDelayedTask( |
| 26 const tracked_objects::Location& from_here, |
| 27 const base::Closure& task, |
| 28 base::TimeDelta delay) { |
| 29 return PostDelayedTask(from_here, task, delay); |
| 30 } |
| 31 |
| 32 bool PepperMainThreadTaskRunner::RunsTasksOnCurrentThread() const { |
| 33 return core_->IsMainThread(); |
| 34 } |
| 35 |
| 36 PepperMainThreadTaskRunner::~PepperMainThreadTaskRunner() {} |
| 37 |
| 38 void PepperMainThreadTaskRunner::RunTask(int32_t result, |
| 39 const base::Closure& task) { |
| 40 task.Run(); |
| 41 } |
| 42 |
| 43 } // namespace remoting |
OLD | NEW |