OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // running. | 51 // running. |
52 // * ProcessThread::Stop() was called and the thread has been stopped. | 52 // * ProcessThread::Stop() was called and the thread has been stopped. |
53 // | 53 // |
54 // NOTE: This method is not called from the worker thread itself, but from | 54 // NOTE: This method is not called from the worker thread itself, but from |
55 // the thread that registers/deregisters the module or calls Start/Stop. | 55 // the thread that registers/deregisters the module or calls Start/Stop. |
56 virtual void ProcessThreadAttached(ProcessThread* process_thread) {} | 56 virtual void ProcessThreadAttached(ProcessThread* process_thread) {} |
57 | 57 |
58 protected: | 58 protected: |
59 virtual ~Module() {} | 59 virtual ~Module() {} |
60 }; | 60 }; |
61 | |
62 // Reference counted version of the Module interface. | |
63 class RefCountedModule : public Module { | |
64 public: | |
65 // Increase the reference count by one. | |
66 // Returns the incremented reference count. | |
67 virtual int32_t AddRef() const = 0; | |
68 | |
69 // Decrease the reference count by one. | |
70 // Returns the decreased reference count. | |
71 // Returns 0 if the last reference was just released. | |
72 // When the reference count reaches 0 the object will self-destruct. | |
73 virtual int32_t Release() const = 0; | |
74 | |
75 protected: | |
76 ~RefCountedModule() override = default; | |
77 }; | |
78 | |
79 } // namespace webrtc | 61 } // namespace webrtc |
80 | 62 |
81 #endif // MODULES_INCLUDE_MODULE_H_ | 63 #endif // MODULES_INCLUDE_MODULE_H_ |
OLD | NEW |