Chromium Code Reviews| Index: webrtc/modules/audio_coding/codecs/audio_decoder_factory.h |
| diff --git a/webrtc/modules/audio_coding/codecs/audio_decoder_factory.h b/webrtc/modules/audio_coding/codecs/audio_decoder_factory.h |
| index 12b977809187e8bf868a32bd415531f9d49d8e3f..64044b60209827f50738dbbdf8abc242ce1ba059 100644 |
| --- a/webrtc/modules/audio_coding/codecs/audio_decoder_factory.h |
| +++ b/webrtc/modules/audio_coding/codecs/audio_decoder_factory.h |
| @@ -14,6 +14,8 @@ |
| #include <memory> |
| #include <vector> |
| +#include "webrtc/base/atomicops.h" |
| +#include "webrtc/base/refcount.h" |
| #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
| #include "webrtc/modules/audio_coding/codecs/audio_format.h" |
| @@ -21,7 +23,7 @@ namespace webrtc { |
| // A factory that creates AudioDecoders. |
| // NOTE: This class is still under development and may change without notice. |
| -class AudioDecoderFactory { |
| +class AudioDecoderFactory : public rtc::RefCountInterface { |
| public: |
| virtual ~AudioDecoderFactory() = default; |
| @@ -29,6 +31,21 @@ class AudioDecoderFactory { |
| virtual std::unique_ptr<AudioDecoder> MakeAudioDecoder( |
| const SdpAudioFormat& format) = 0; |
| + |
| + int AddRef() const override { |
|
ossu
2016/05/18 11:59:56
Put these in .cc-file?
Pro: cleaner
Con: slower (a
kwiberg-webrtc
2016/05/18 14:03:15
Slower how? It's a virtual call either way.
ossu
2016/05/18 14:42:20
Yeah, I guess as long as we inherit from rtc::RefC
kwiberg-webrtc
2016/05/18 15:48:27
Making them final would essentially make them not
|
| + return rtc::AtomicOps::Increment(&ref_count_); |
| + } |
| + |
| + int Release() const override { |
| + int count = rtc::AtomicOps::Decrement(&ref_count_); |
| + if (!count) { |
| + delete this; |
| + } |
| + return count; |
| + } |
| + |
| + private: |
| + mutable volatile int ref_count_; |
|
kwiberg-webrtc
2016/05/18 14:03:15
Danger, Will Robinson! State in an interface!
Thi
ossu
2016/05/18 14:42:21
Oh, right... We'd get two reference counts and eve
|
| }; |
| } // namespace webrtc |