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 // Helpers that runs the specified |task|. The |result| argument is ignored, | |
Wez
2015/10/20 23:43:52
Helpers->Helper.
Suggest "Helper that allows a ba
Sergey Ulanov
2015/10/20 23:49:16
Done.
| |
40 // but it is necessary in order for this method to be passed to | |
41 // pp::Core::CallOnMainThread() as a completion callback. | |
42 void RunTask(int32_t result, const base::Closure& task); | |
43 | |
44 pp::Core* core_; | |
45 pp::CompletionCallbackFactory<PepperMainThreadTaskRunner> callback_factory_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(PepperMainThreadTaskRunner); | |
48 }; | |
49 | |
50 } // namespace remoting | |
51 | |
52 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_ | |
OLD | NEW |