Make RefCountedObject require overriding virtual methods
Bug: webrtc:12701 Change-Id: Ia4ae4ad2e857cb8790d6ccfb6f88f07d52a8e91b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215967 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33831}
This commit is contained in:
committed by
Commit Bot
parent
1959f8fedc
commit
e249d195e0
@ -15,7 +15,6 @@
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/ref_counted_object.h"
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
#include "vpx/vpx_frame_buffer.h"
|
||||
@ -68,7 +67,7 @@ Vp9FrameBufferPool::GetFrameBuffer(size_t min_size) {
|
||||
}
|
||||
// Otherwise create one.
|
||||
if (available_buffer == nullptr) {
|
||||
available_buffer = new rtc::RefCountedObject<Vp9FrameBuffer>();
|
||||
available_buffer = new Vp9FrameBuffer();
|
||||
allocated_buffers_.push_back(available_buffer);
|
||||
if (allocated_buffers_.size() > max_num_buffers_) {
|
||||
RTC_LOG(LS_WARNING)
|
||||
|
||||
@ -16,9 +16,9 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "api/ref_counted_base.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "rtc_base/ref_count.h"
|
||||
#include "rtc_base/synchronization/mutex.h"
|
||||
|
||||
struct vpx_codec_ctx;
|
||||
@ -65,13 +65,14 @@ constexpr size_t kDefaultMaxNumBuffers = 68;
|
||||
// vpx_codec_destroy(decoder_ctx);
|
||||
class Vp9FrameBufferPool {
|
||||
public:
|
||||
class Vp9FrameBuffer : public rtc::RefCountInterface {
|
||||
class Vp9FrameBuffer final
|
||||
: public rtc::RefCountedNonVirtual<Vp9FrameBuffer> {
|
||||
public:
|
||||
uint8_t* GetData();
|
||||
size_t GetDataSize() const;
|
||||
void SetSize(size_t size);
|
||||
|
||||
virtual bool HasOneRef() const = 0;
|
||||
using rtc::RefCountedNonVirtual<Vp9FrameBuffer>::HasOneRef;
|
||||
|
||||
private:
|
||||
// Data as an easily resizable buffer.
|
||||
|
||||
Reference in New Issue
Block a user