OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_UTILITY_INCLUDE_PROCESS_THREAD_H_ | 11 #ifndef WEBRTC_MODULES_UTILITY_INCLUDE_PROCESS_THREAD_H_ |
12 #define WEBRTC_MODULES_UTILITY_INCLUDE_PROCESS_THREAD_H_ | 12 #define WEBRTC_MODULES_UTILITY_INCLUDE_PROCESS_THREAD_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 | 15 |
16 #include "webrtc/typedefs.h" | 16 #include "webrtc/typedefs.h" |
17 | 17 |
18 #if defined(WEBRTC_WIN) | 18 #if defined(WEBRTC_WIN) |
19 // Due to a bug in the std::unique_ptr implementation that ships with MSVS, | 19 // Due to a bug in the std::unique_ptr implementation that ships with MSVS, |
20 // we need the full definition of QueuedTask, on Windows. | 20 // we need the full definition of QueuedTask, on Windows. |
21 #include "webrtc/base/task_queue.h" | 21 #include "webrtc/base/task_queue.h" |
22 #else | 22 #else |
23 namespace rtc { | 23 namespace rtc { |
24 class QueuedTask; | 24 class QueuedTask; |
25 } | 25 } |
26 #endif | 26 #endif |
27 | 27 |
| 28 namespace rtc { |
| 29 class Location; |
| 30 } |
| 31 |
28 namespace webrtc { | 32 namespace webrtc { |
29 class Module; | 33 class Module; |
30 | 34 |
31 // TODO(tommi): ProcessThread probably doesn't need to be a virtual | 35 // TODO(tommi): ProcessThread probably doesn't need to be a virtual |
32 // interface. There exists one override besides ProcessThreadImpl, | 36 // interface. There exists one override besides ProcessThreadImpl, |
33 // MockProcessThread, but when looking at how it is used, it seems | 37 // MockProcessThread, but when looking at how it is used, it seems |
34 // a nullptr might suffice (or simply an actual ProcessThread instance). | 38 // a nullptr might suffice (or simply an actual ProcessThread instance). |
35 class ProcessThread { | 39 class ProcessThread { |
36 public: | 40 public: |
37 virtual ~ProcessThread(); | 41 virtual ~ProcessThread(); |
(...skipping 16 matching lines...) Expand all Loading... |
54 // Queues a task object to run on the worker thread. Ownership of the | 58 // Queues a task object to run on the worker thread. Ownership of the |
55 // task object is transferred to the ProcessThread and the object will | 59 // task object is transferred to the ProcessThread and the object will |
56 // either be deleted after running on the worker thread, or on the | 60 // either be deleted after running on the worker thread, or on the |
57 // construction thread of the ProcessThread instance, if the task did not | 61 // construction thread of the ProcessThread instance, if the task did not |
58 // get a chance to run (e.g. posting the task while shutting down or when | 62 // get a chance to run (e.g. posting the task while shutting down or when |
59 // the thread never runs). | 63 // the thread never runs). |
60 virtual void PostTask(std::unique_ptr<rtc::QueuedTask> task) = 0; | 64 virtual void PostTask(std::unique_ptr<rtc::QueuedTask> task) = 0; |
61 | 65 |
62 // Adds a module that will start to receive callbacks on the worker thread. | 66 // Adds a module that will start to receive callbacks on the worker thread. |
63 // Can be called from any thread. | 67 // Can be called from any thread. |
64 virtual void RegisterModule(Module* module) = 0; | 68 virtual void RegisterModule(Module* module, const rtc::Location& from) = 0; |
65 | 69 |
66 // Removes a previously registered module. | 70 // Removes a previously registered module. |
67 // Can be called from any thread. | 71 // Can be called from any thread. |
68 virtual void DeRegisterModule(Module* module) = 0; | 72 virtual void DeRegisterModule(Module* module) = 0; |
69 }; | 73 }; |
70 | 74 |
71 } // namespace webrtc | 75 } // namespace webrtc |
72 | 76 |
73 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_PROCESS_THREAD_H_ | 77 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_PROCESS_THREAD_H_ |
OLD | NEW |