Replace more instances of rtc::RefCountedObject with make_ref_counted.
This is essentially replacing `new rtc::RefCountedObject` with `rtc::make_ref_counted` in many files. In a couple of places I made minor tweaks to make things compile such as adding parenthesis when they were missing. Bug: webrtc:12701 Change-Id: I3828dbf3ee0eb0232f3a47067474484ac2f4aed2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215973 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33852}
This commit is contained in:
@ -27,15 +27,14 @@ using ::testing::Invoke;
|
||||
namespace webrtc {
|
||||
|
||||
TEST(DecoderDatabase, CreateAndDestroy) {
|
||||
DecoderDatabase db(new rtc::RefCountedObject<MockAudioDecoderFactory>,
|
||||
DecoderDatabase db(rtc::make_ref_counted<MockAudioDecoderFactory>(),
|
||||
absl::nullopt);
|
||||
EXPECT_EQ(0, db.Size());
|
||||
EXPECT_TRUE(db.Empty());
|
||||
}
|
||||
|
||||
TEST(DecoderDatabase, InsertAndRemove) {
|
||||
rtc::scoped_refptr<MockAudioDecoderFactory> factory(
|
||||
new rtc::RefCountedObject<MockAudioDecoderFactory>);
|
||||
auto factory = rtc::make_ref_counted<MockAudioDecoderFactory>();
|
||||
DecoderDatabase db(factory, absl::nullopt);
|
||||
const uint8_t kPayloadType = 0;
|
||||
const std::string kCodecName = "Robert\'); DROP TABLE Students;";
|
||||
@ -50,8 +49,7 @@ TEST(DecoderDatabase, InsertAndRemove) {
|
||||
}
|
||||
|
||||
TEST(DecoderDatabase, InsertAndRemoveAll) {
|
||||
rtc::scoped_refptr<MockAudioDecoderFactory> factory(
|
||||
new rtc::RefCountedObject<MockAudioDecoderFactory>);
|
||||
auto factory = rtc::make_ref_counted<MockAudioDecoderFactory>();
|
||||
DecoderDatabase db(factory, absl::nullopt);
|
||||
const std::string kCodecName1 = "Robert\'); DROP TABLE Students;";
|
||||
const std::string kCodecName2 = "https://xkcd.com/327/";
|
||||
@ -67,8 +65,7 @@ TEST(DecoderDatabase, InsertAndRemoveAll) {
|
||||
}
|
||||
|
||||
TEST(DecoderDatabase, GetDecoderInfo) {
|
||||
rtc::scoped_refptr<MockAudioDecoderFactory> factory(
|
||||
new rtc::RefCountedObject<MockAudioDecoderFactory>);
|
||||
auto factory = rtc::make_ref_counted<MockAudioDecoderFactory>();
|
||||
auto* decoder = new MockAudioDecoder;
|
||||
EXPECT_CALL(*factory, MakeAudioDecoderMock(_, _, _))
|
||||
.WillOnce(Invoke([decoder](const SdpAudioFormat& format,
|
||||
@ -103,8 +100,7 @@ TEST(DecoderDatabase, GetDecoder) {
|
||||
}
|
||||
|
||||
TEST(DecoderDatabase, TypeTests) {
|
||||
rtc::scoped_refptr<MockAudioDecoderFactory> factory(
|
||||
new rtc::RefCountedObject<MockAudioDecoderFactory>);
|
||||
auto factory = rtc::make_ref_counted<MockAudioDecoderFactory>();
|
||||
DecoderDatabase db(factory, absl::nullopt);
|
||||
const uint8_t kPayloadTypePcmU = 0;
|
||||
const uint8_t kPayloadTypeCng = 13;
|
||||
@ -140,8 +136,7 @@ TEST(DecoderDatabase, TypeTests) {
|
||||
|
||||
TEST(DecoderDatabase, CheckPayloadTypes) {
|
||||
constexpr int kNumPayloads = 10;
|
||||
rtc::scoped_refptr<MockAudioDecoderFactory> factory(
|
||||
new rtc::RefCountedObject<MockAudioDecoderFactory>);
|
||||
auto factory = rtc::make_ref_counted<MockAudioDecoderFactory>();
|
||||
DecoderDatabase db(factory, absl::nullopt);
|
||||
// Load a number of payloads into the database. Payload types are 0, 1, ...,
|
||||
// while the decoder type is the same for all payload types (this does not
|
||||
|
Reference in New Issue
Block a user