OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_PLUGIN_THREAD_TASK_RUNNER_H_ | 5 #ifndef REMOTING_BASE_PLUGIN_THREAD_TASK_RUNNER_H_ |
6 #define REMOTING_BASE_PLUGIN_THREAD_TASK_RUNNER_H_ | 6 #define REMOTING_BASE_PLUGIN_THREAD_TASK_RUNNER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 public: | 25 public: |
26 class Delegate { | 26 class Delegate { |
27 public: | 27 public: |
28 virtual ~Delegate(); | 28 virtual ~Delegate(); |
29 | 29 |
30 virtual bool RunOnPluginThread( | 30 virtual bool RunOnPluginThread( |
31 base::TimeDelta delay, void(function)(void*), void* data) = 0; | 31 base::TimeDelta delay, void(function)(void*), void* data) = 0; |
32 }; | 32 }; |
33 | 33 |
34 // Caller keeps ownership of delegate. | 34 // Caller keeps ownership of delegate. |
35 PluginThreadTaskRunner(Delegate* delegate); | 35 explicit PluginThreadTaskRunner(Delegate* delegate); |
36 | 36 |
37 // Detaches the PluginThreadTaskRunner from the underlying Delegate and | 37 // Detaches the PluginThreadTaskRunner from the underlying Delegate and |
38 // processes posted tasks until Quit() is called. This is used during plugin | 38 // processes posted tasks until Quit() is called. This is used during plugin |
39 // shutdown, when the plugin environment has stopped accepting new tasks to | 39 // shutdown, when the plugin environment has stopped accepting new tasks to |
40 // run, to process cleanup tasks posted to the plugin thread. | 40 // run, to process cleanup tasks posted to the plugin thread. |
41 // This method must be called on the plugin thread. | 41 // This method must be called on the plugin thread. |
42 void DetachAndRunShutdownLoop(); | 42 void DetachAndRunShutdownLoop(); |
43 | 43 |
44 // Makes DetachAndRunShutdownLoop() stop processing tasks and return control | 44 // Makes DetachAndRunShutdownLoop() stop processing tasks and return control |
45 // to the caller. Calling Quit() before DetachAndRunShutdownLoop() causes | 45 // to the caller. Calling Quit() before DetachAndRunShutdownLoop() causes |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 // True if the shutdown task loop was been stopped. | 122 // True if the shutdown task loop was been stopped. |
123 bool stopped_; | 123 bool stopped_; |
124 | 124 |
125 DISALLOW_COPY_AND_ASSIGN(PluginThreadTaskRunner); | 125 DISALLOW_COPY_AND_ASSIGN(PluginThreadTaskRunner); |
126 }; | 126 }; |
127 | 127 |
128 } // namespace remoting | 128 } // namespace remoting |
129 | 129 |
130 #endif // REMOTING_BASE_PLUGIN_THREAD_TASK_RUNNER_H_ | 130 #endif // REMOTING_BASE_PLUGIN_THREAD_TASK_RUNNER_H_ |
OLD | NEW |