Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Side by Side Diff: remoting/client/plugin/pepper_main_thread_task_runner.h

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_ 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_ 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "ppapi/utility/completion_callback_factory.h" 15 #include "ppapi/utility/completion_callback_factory.h"
16 16
17 namespace pp { 17 namespace pp {
18 class Core; 18 class Core;
19 } // namespace pp 19 } // namespace pp
20 20
21 namespace remoting { 21 namespace remoting {
22 22
23 // SingleThreadTaskRunner implementation for the main plugin thread. 23 // SingleThreadTaskRunner implementation for the main plugin thread.
24 class PepperMainThreadTaskRunner : public base::SingleThreadTaskRunner { 24 class PepperMainThreadTaskRunner : public base::SingleThreadTaskRunner {
25 public: 25 public:
26 PepperMainThreadTaskRunner(); 26 PepperMainThreadTaskRunner();
27 27
28 // base::SingleThreadTaskRunner interface. 28 // base::SingleThreadTaskRunner interface.
29 bool PostDelayedTask(const tracked_objects::Location& from_here, 29 bool PostDelayedTask(const tracked_objects::Location& from_here,
30 const base::Closure& task, 30 base::OnceClosure task,
31 base::TimeDelta delay) override; 31 base::TimeDelta delay) override;
32 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here, 32 bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
33 const base::Closure& task, 33 base::OnceClosure task,
34 base::TimeDelta delay) override; 34 base::TimeDelta delay) override;
35 bool RunsTasksOnCurrentThread() const override; 35 bool RunsTasksOnCurrentThread() const override;
36 36
37 protected: 37 protected:
38 ~PepperMainThreadTaskRunner() override; 38 ~PepperMainThreadTaskRunner() override;
39 39
40 private: 40 private:
41 // Helper that allows a base::Closure to be used as a pp::CompletionCallback, 41 // Helper that allows a base::Closure to be used as a pp::CompletionCallback,
42 // by ignoring the completion result. 42 // by ignoring the completion result.
43 void RunTask(int32_t result, const base::Closure& task); 43 void RunTask(int32_t result, const base::Closure& task);
44 44
45 pp::Core* core_; 45 pp::Core* core_;
46 pp::CompletionCallbackFactory<PepperMainThreadTaskRunner> callback_factory_; 46 pp::CompletionCallbackFactory<PepperMainThreadTaskRunner> callback_factory_;
47 47
48 DISALLOW_COPY_AND_ASSIGN(PepperMainThreadTaskRunner); 48 DISALLOW_COPY_AND_ASSIGN(PepperMainThreadTaskRunner);
49 }; 49 };
50 50
51 } // namespace remoting 51 } // namespace remoting
52 52
53 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_ 53 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_MAIN_THREAD_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « remoting/base/auto_thread_task_runner.cc ('k') | remoting/client/plugin/pepper_main_thread_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698