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 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_ |
| 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_ |
| 7 |
| 8 #include "base/callback_forward.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" |
| 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/time/time.h" |
| 13 #include "ppapi/utility/completion_callback_factory.h" |
| 14 |
| 15 namespace pp { |
| 16 class Core; |
| 17 } // namespace pp |
| 18 |
| 19 namespace remoting { |
| 20 |
| 21 // SingleThreadTaskRunner implementation for the main plugin thread. |
| 22 class PepperMainThreadTaskRunner : public base::SingleThreadTaskRunner { |
| 23 public: |
| 24 PepperMainThreadTaskRunner(); |
| 25 |
| 26 // base::SingleThreadTaskRunner interface. |
| 27 bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 28 const base::Closure& task, |
| 29 base::TimeDelta delay) override; |
| 30 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, |
| 31 const base::Closure& task, |
| 32 base::TimeDelta delay) override; |
| 33 bool RunsTasksOnCurrentThread() const override; |
| 34 |
| 35 protected: |
| 36 ~PepperMainThreadTaskRunner() override; |
| 37 |
| 38 private: |
| 39 // Helper that allows a base::Closure to be used as a pp::CompletionCallback, |
| 40 // by ignoring the completion result. |
| 41 void RunTask(int32_t result, const base::Closure& task); |
| 42 |
| 43 pp::Core* core_; |
| 44 pp::CompletionCallbackFactory<PepperMainThreadTaskRunner> callback_factory_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(PepperMainThreadTaskRunner); |
| 47 }; |
| 48 |
| 49 } // namespace remoting |
| 50 |
| 51 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_ |
OLD | NEW |