mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Update api/ to not use implicit T* --> scoped_refptr<T> conversion
Bug: webrtc:13464 Change-Id: I5dc292fefd27bfd43574f3e0c63c0e1da6dddcae Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/244091 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35667}
This commit is contained in:
parent
994bf454ec
commit
961f382458
8 changed files with 16 additions and 14 deletions
|
@ -48,7 +48,7 @@ class ScopedRefCounted {
|
||||||
|
|
||||||
TEST(ScopedRefptrTest, IsCopyConstructable) {
|
TEST(ScopedRefptrTest, IsCopyConstructable) {
|
||||||
FunctionsCalled called;
|
FunctionsCalled called;
|
||||||
scoped_refptr<ScopedRefCounted> ptr = new ScopedRefCounted(&called);
|
scoped_refptr<ScopedRefCounted> ptr(new ScopedRefCounted(&called));
|
||||||
scoped_refptr<ScopedRefCounted> another_ptr = ptr;
|
scoped_refptr<ScopedRefCounted> another_ptr = ptr;
|
||||||
|
|
||||||
EXPECT_TRUE(ptr);
|
EXPECT_TRUE(ptr);
|
||||||
|
@ -59,7 +59,7 @@ TEST(ScopedRefptrTest, IsCopyConstructable) {
|
||||||
TEST(ScopedRefptrTest, IsCopyAssignable) {
|
TEST(ScopedRefptrTest, IsCopyAssignable) {
|
||||||
FunctionsCalled called;
|
FunctionsCalled called;
|
||||||
scoped_refptr<ScopedRefCounted> another_ptr;
|
scoped_refptr<ScopedRefCounted> another_ptr;
|
||||||
scoped_refptr<ScopedRefCounted> ptr = new ScopedRefCounted(&called);
|
scoped_refptr<ScopedRefCounted> ptr(new ScopedRefCounted(&called));
|
||||||
another_ptr = ptr;
|
another_ptr = ptr;
|
||||||
|
|
||||||
EXPECT_TRUE(ptr);
|
EXPECT_TRUE(ptr);
|
||||||
|
@ -69,7 +69,7 @@ TEST(ScopedRefptrTest, IsCopyAssignable) {
|
||||||
|
|
||||||
TEST(ScopedRefptrTest, IsMoveConstructableWithoutExtraAddRefRelease) {
|
TEST(ScopedRefptrTest, IsMoveConstructableWithoutExtraAddRefRelease) {
|
||||||
FunctionsCalled called;
|
FunctionsCalled called;
|
||||||
scoped_refptr<ScopedRefCounted> ptr = new ScopedRefCounted(&called);
|
scoped_refptr<ScopedRefCounted> ptr(new ScopedRefCounted(&called));
|
||||||
scoped_refptr<ScopedRefCounted> another_ptr = std::move(ptr);
|
scoped_refptr<ScopedRefCounted> another_ptr = std::move(ptr);
|
||||||
|
|
||||||
EXPECT_FALSE(ptr);
|
EXPECT_FALSE(ptr);
|
||||||
|
@ -81,7 +81,7 @@ TEST(ScopedRefptrTest, IsMoveConstructableWithoutExtraAddRefRelease) {
|
||||||
TEST(ScopedRefptrTest, IsMoveAssignableWithoutExtraAddRefRelease) {
|
TEST(ScopedRefptrTest, IsMoveAssignableWithoutExtraAddRefRelease) {
|
||||||
FunctionsCalled called;
|
FunctionsCalled called;
|
||||||
scoped_refptr<ScopedRefCounted> another_ptr;
|
scoped_refptr<ScopedRefCounted> another_ptr;
|
||||||
scoped_refptr<ScopedRefCounted> ptr = new ScopedRefCounted(&called);
|
scoped_refptr<ScopedRefCounted> ptr(new ScopedRefCounted(&called));
|
||||||
another_ptr = std::move(ptr);
|
another_ptr = std::move(ptr);
|
||||||
|
|
||||||
EXPECT_FALSE(ptr);
|
EXPECT_FALSE(ptr);
|
||||||
|
@ -100,8 +100,8 @@ TEST(ScopedRefptrTest, MovableDuringVectorReallocation) {
|
||||||
std::vector<scoped_refptr<ScopedRefCounted>> ptrs;
|
std::vector<scoped_refptr<ScopedRefCounted>> ptrs;
|
||||||
ptrs.reserve(1);
|
ptrs.reserve(1);
|
||||||
// Insert more elements than reserved to provoke reallocation.
|
// Insert more elements than reserved to provoke reallocation.
|
||||||
ptrs.push_back(new ScopedRefCounted(&called));
|
ptrs.emplace_back(new ScopedRefCounted(&called));
|
||||||
ptrs.push_back(new ScopedRefCounted(&called));
|
ptrs.emplace_back(new ScopedRefCounted(&called));
|
||||||
|
|
||||||
EXPECT_EQ(called.addref, 2);
|
EXPECT_EQ(called.addref, 2);
|
||||||
EXPECT_EQ(called.release, 0);
|
EXPECT_EQ(called.release, 0);
|
||||||
|
|
|
@ -22,7 +22,8 @@ class MockDataChannelInterface final
|
||||||
: public rtc::RefCountedObject<webrtc::DataChannelInterface> {
|
: public rtc::RefCountedObject<webrtc::DataChannelInterface> {
|
||||||
public:
|
public:
|
||||||
static rtc::scoped_refptr<MockDataChannelInterface> Create() {
|
static rtc::scoped_refptr<MockDataChannelInterface> Create() {
|
||||||
return new MockDataChannelInterface();
|
return rtc::scoped_refptr<MockDataChannelInterface>(
|
||||||
|
new MockDataChannelInterface());
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
|
|
|
@ -22,7 +22,7 @@ class MockAudioSource final
|
||||||
: public rtc::RefCountedObject<AudioSourceInterface> {
|
: public rtc::RefCountedObject<AudioSourceInterface> {
|
||||||
public:
|
public:
|
||||||
static rtc::scoped_refptr<MockAudioSource> Create() {
|
static rtc::scoped_refptr<MockAudioSource> Create() {
|
||||||
return new MockAudioSource();
|
return rtc::scoped_refptr<MockAudioSource>(new MockAudioSource());
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
|
@ -55,7 +55,7 @@ class MockAudioSource final
|
||||||
class MockAudioTrack final : public rtc::RefCountedObject<AudioTrackInterface> {
|
class MockAudioTrack final : public rtc::RefCountedObject<AudioTrackInterface> {
|
||||||
public:
|
public:
|
||||||
static rtc::scoped_refptr<MockAudioTrack> Create() {
|
static rtc::scoped_refptr<MockAudioTrack> Create() {
|
||||||
return new MockAudioTrack();
|
return rtc::scoped_refptr<MockAudioTrack>(new MockAudioTrack());
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_METHOD(void,
|
MOCK_METHOD(void,
|
||||||
|
|
|
@ -23,7 +23,8 @@ class MockPeerConnectionFactoryInterface final
|
||||||
: public rtc::RefCountedObject<webrtc::PeerConnectionFactoryInterface> {
|
: public rtc::RefCountedObject<webrtc::PeerConnectionFactoryInterface> {
|
||||||
public:
|
public:
|
||||||
static rtc::scoped_refptr<MockPeerConnectionFactoryInterface> Create() {
|
static rtc::scoped_refptr<MockPeerConnectionFactoryInterface> Create() {
|
||||||
return new MockPeerConnectionFactoryInterface();
|
return rtc::scoped_refptr<MockPeerConnectionFactoryInterface>(
|
||||||
|
new MockPeerConnectionFactoryInterface());
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_METHOD(void, SetOptions, (const Options&), (override));
|
MOCK_METHOD(void, SetOptions, (const Options&), (override));
|
||||||
|
|
|
@ -29,7 +29,7 @@ class MockPeerConnectionInterface
|
||||||
: public rtc::RefCountedObject<webrtc::PeerConnectionInterface> {
|
: public rtc::RefCountedObject<webrtc::PeerConnectionInterface> {
|
||||||
public:
|
public:
|
||||||
static rtc::scoped_refptr<MockPeerConnectionInterface> Create() {
|
static rtc::scoped_refptr<MockPeerConnectionInterface> Create() {
|
||||||
return new MockPeerConnectionInterface();
|
return rtc::make_ref_counted<MockPeerConnectionInterface>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// PeerConnectionInterface
|
// PeerConnectionInterface
|
||||||
|
|
|
@ -23,7 +23,7 @@ class MockRtpTransceiver final
|
||||||
: public rtc::RefCountedObject<RtpTransceiverInterface> {
|
: public rtc::RefCountedObject<RtpTransceiverInterface> {
|
||||||
public:
|
public:
|
||||||
static rtc::scoped_refptr<MockRtpTransceiver> Create() {
|
static rtc::scoped_refptr<MockRtpTransceiver> Create() {
|
||||||
return new MockRtpTransceiver();
|
return rtc::scoped_refptr<MockRtpTransceiver>(new MockRtpTransceiver());
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_METHOD(cricket::MediaType, media_type, (), (const, override));
|
MOCK_METHOD(cricket::MediaType, media_type, (), (const, override));
|
||||||
|
|
|
@ -24,7 +24,7 @@ class MockVideoTrack final
|
||||||
: public rtc::RefCountedObject<webrtc::VideoTrackInterface> {
|
: public rtc::RefCountedObject<webrtc::VideoTrackInterface> {
|
||||||
public:
|
public:
|
||||||
static rtc::scoped_refptr<MockVideoTrack> Create() {
|
static rtc::scoped_refptr<MockVideoTrack> Create() {
|
||||||
return new MockVideoTrack();
|
return rtc::scoped_refptr<MockVideoTrack>(new MockVideoTrack());
|
||||||
}
|
}
|
||||||
|
|
||||||
// NotifierInterface
|
// NotifierInterface
|
||||||
|
|
|
@ -94,7 +94,7 @@ int I420BufferInterface::ChromaHeight() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::scoped_refptr<I420BufferInterface> I420BufferInterface::ToI420() {
|
rtc::scoped_refptr<I420BufferInterface> I420BufferInterface::ToI420() {
|
||||||
return this;
|
return rtc::scoped_refptr<I420BufferInterface>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const I420BufferInterface* I420BufferInterface::GetI420() const {
|
const I420BufferInterface* I420BufferInterface::GetI420() const {
|
||||||
|
|
Loading…
Reference in a new issue