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}
diff --git a/api/scoped_refptr_unittest.cc b/api/scoped_refptr_unittest.cc
index 75a202b..22b6120 100644
--- a/api/scoped_refptr_unittest.cc
+++ b/api/scoped_refptr_unittest.cc
@@ -48,7 +48,7 @@
TEST(ScopedRefptrTest, IsCopyConstructable) {
FunctionsCalled called;
- scoped_refptr<ScopedRefCounted> ptr = new ScopedRefCounted(&called);
+ scoped_refptr<ScopedRefCounted> ptr(new ScopedRefCounted(&called));
scoped_refptr<ScopedRefCounted> another_ptr = ptr;
EXPECT_TRUE(ptr);
@@ -59,7 +59,7 @@
TEST(ScopedRefptrTest, IsCopyAssignable) {
FunctionsCalled called;
scoped_refptr<ScopedRefCounted> another_ptr;
- scoped_refptr<ScopedRefCounted> ptr = new ScopedRefCounted(&called);
+ scoped_refptr<ScopedRefCounted> ptr(new ScopedRefCounted(&called));
another_ptr = ptr;
EXPECT_TRUE(ptr);
@@ -69,7 +69,7 @@
TEST(ScopedRefptrTest, IsMoveConstructableWithoutExtraAddRefRelease) {
FunctionsCalled called;
- scoped_refptr<ScopedRefCounted> ptr = new ScopedRefCounted(&called);
+ scoped_refptr<ScopedRefCounted> ptr(new ScopedRefCounted(&called));
scoped_refptr<ScopedRefCounted> another_ptr = std::move(ptr);
EXPECT_FALSE(ptr);
@@ -81,7 +81,7 @@
TEST(ScopedRefptrTest, IsMoveAssignableWithoutExtraAddRefRelease) {
FunctionsCalled called;
scoped_refptr<ScopedRefCounted> another_ptr;
- scoped_refptr<ScopedRefCounted> ptr = new ScopedRefCounted(&called);
+ scoped_refptr<ScopedRefCounted> ptr(new ScopedRefCounted(&called));
another_ptr = std::move(ptr);
EXPECT_FALSE(ptr);
@@ -100,8 +100,8 @@
std::vector<scoped_refptr<ScopedRefCounted>> ptrs;
ptrs.reserve(1);
// Insert more elements than reserved to provoke reallocation.
- ptrs.push_back(new ScopedRefCounted(&called));
- ptrs.push_back(new ScopedRefCounted(&called));
+ ptrs.emplace_back(new ScopedRefCounted(&called));
+ ptrs.emplace_back(new ScopedRefCounted(&called));
EXPECT_EQ(called.addref, 2);
EXPECT_EQ(called.release, 0);