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

Side by Side Diff: webrtc/modules/utility/include/process_thread.h

Issue 1923133002: Replace the remaining scoped_ptr with unique_ptr in webrtc/modules/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Don't remove #include "scoped_ptr.h" from .h files Created 4 years, 7 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 /* 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>
15
14 #include "webrtc/typedefs.h" 16 #include "webrtc/typedefs.h"
15 #include "webrtc/base/scoped_ptr.h" 17 #include "webrtc/base/scoped_ptr.h"
16 18
17 namespace webrtc { 19 namespace webrtc {
18 class Module; 20 class Module;
19 21
20 class ProcessTask { 22 class ProcessTask {
21 public: 23 public:
22 ProcessTask() {} 24 ProcessTask() {}
23 virtual ~ProcessTask() {} 25 virtual ~ProcessTask() {}
24 26
25 virtual void Run() = 0; 27 virtual void Run() = 0;
26 }; 28 };
27 29
28 class ProcessThread { 30 class ProcessThread {
29 public: 31 public:
30 virtual ~ProcessThread(); 32 virtual ~ProcessThread();
31 33
32 static rtc::scoped_ptr<ProcessThread> Create(const char* thread_name); 34 static std::unique_ptr<ProcessThread> Create(const char* thread_name);
33 35
34 // Starts the worker thread. Must be called from the construction thread. 36 // Starts the worker thread. Must be called from the construction thread.
35 virtual void Start() = 0; 37 virtual void Start() = 0;
36 38
37 // Stops the worker thread. Must be called from the construction thread. 39 // Stops the worker thread. Must be called from the construction thread.
38 virtual void Stop() = 0; 40 virtual void Stop() = 0;
39 41
40 // Wakes the thread up to give a module a chance to do processing right 42 // Wakes the thread up to give a module a chance to do processing right
41 // away. This causes the worker thread to wake up and requery the specified 43 // away. This causes the worker thread to wake up and requery the specified
42 // module for when it should be called back. (Typically the module should 44 // module for when it should be called back. (Typically the module should
43 // return 0 from TimeUntilNextProcess on the worker thread at that point). 45 // return 0 from TimeUntilNextProcess on the worker thread at that point).
44 // Can be called on any thread. 46 // Can be called on any thread.
45 virtual void WakeUp(Module* module) = 0; 47 virtual void WakeUp(Module* module) = 0;
46 48
47 // Queues a task object to run on the worker thread. Ownership of the 49 // Queues a task object to run on the worker thread. Ownership of the
48 // task object is transferred to the ProcessThread and the object will 50 // task object is transferred to the ProcessThread and the object will
49 // either be deleted after running on the worker thread, or on the 51 // either be deleted after running on the worker thread, or on the
50 // construction thread of the ProcessThread instance, if the task did not 52 // construction thread of the ProcessThread instance, if the task did not
51 // get a chance to run (e.g. posting the task while shutting down or when 53 // get a chance to run (e.g. posting the task while shutting down or when
52 // the thread never runs). 54 // the thread never runs).
53 virtual void PostTask(rtc::scoped_ptr<ProcessTask> task) = 0; 55 virtual void PostTask(std::unique_ptr<ProcessTask> task) = 0;
54 56
55 // Adds a module that will start to receive callbacks on the worker thread. 57 // Adds a module that will start to receive callbacks on the worker thread.
56 // Can be called from any thread. 58 // Can be called from any thread.
57 virtual void RegisterModule(Module* module) = 0; 59 virtual void RegisterModule(Module* module) = 0;
58 60
59 // Removes a previously registered module. 61 // Removes a previously registered module.
60 // Can be called from any thread. 62 // Can be called from any thread.
61 virtual void DeRegisterModule(Module* module) = 0; 63 virtual void DeRegisterModule(Module* module) = 0;
62 }; 64 };
63 65
64 } // namespace webrtc 66 } // namespace webrtc
65 67
66 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_PROCESS_THREAD_H_ 68 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_PROCESS_THREAD_H_
OLDNEW
« no previous file with comments | « webrtc/modules/utility/include/mock/mock_process_thread.h ('k') | webrtc/modules/utility/source/jvm_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698