Chromium Code Reviews| 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 PepperMainThreadTaskRunner::~PepperMainThreadTaskRunner() {} | |
|
Wez
2015/10/20 23:43:52
nit: Move this to match the ordering in the header
Sergey Ulanov
2015/10/20 23:49:16
Done.
| |
| 15 | |
| 16 bool PepperMainThreadTaskRunner::PostDelayedTask( | |
| 17 const tracked_objects::Location& from_here, | |
| 18 const base::Closure& task, | |
| 19 base::TimeDelta delay) { | |
| 20 core_->CallOnMainThread(delay.InMillisecondsRoundedUp(), | |
| 21 callback_factory_.NewCallback( | |
| 22 &PepperMainThreadTaskRunner::RunTask, task)); | |
| 23 return true; | |
| 24 } | |
| 25 | |
| 26 bool PepperMainThreadTaskRunner::PostNonNestableDelayedTask( | |
| 27 const tracked_objects::Location& from_here, | |
| 28 const base::Closure& task, | |
| 29 base::TimeDelta delay) { | |
| 30 return PostDelayedTask(from_here, task, delay); | |
| 31 } | |
| 32 | |
| 33 bool PepperMainThreadTaskRunner::RunsTasksOnCurrentThread() const { | |
| 34 return core_->IsMainThread(); | |
| 35 } | |
| 36 | |
| 37 void PepperMainThreadTaskRunner::RunTask(int32_t result, | |
| 38 const base::Closure& task) { | |
| 39 task.Run(); | |
| 40 } | |
| 41 | |
| 42 } // namespace remoting | |
| OLD | NEW |