diff options
author | Niels Möller <nisse@webrtc.org> | 2022-01-25 13:56:07 +0100 |
---|---|---|
committer | WebRTC LUCI CQ <webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-01-25 14:28:12 +0000 |
commit | 027c793c5798ec3ee226e86cce5929e86f8c99e1 (patch) | |
tree | 9ca7f7ccf7c27808a047252160cc63d2d60a933f /examples | |
parent | b428d6bad46c26fded1cf049dae68bb215edbe7a (diff) | |
download | webrtc-027c793c5798ec3ee226e86cce5929e86f8c99e1.tar.gz |
Replace most explicit `new RefCountedObject...` with make_ref_counted
Bug: webrtc:12701
Change-Id: Iab91f1e96715eed7f9ddcfe1ca55510a18c817eb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/224544
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35786}
Diffstat (limited to 'examples')
-rw-r--r-- | examples/androidnativeapi/jni/android_call_client.cc | 4 | ||||
-rw-r--r-- | examples/objcnativeapi/objc/objc_call_client.mm | 4 | ||||
-rw-r--r-- | examples/peerconnection/client/conductor.cc | 2 | ||||
-rw-r--r-- | examples/peerconnection/client/linux/main.cc | 3 | ||||
-rw-r--r-- | examples/peerconnection/client/main.cc | 3 | ||||
-rw-r--r-- | examples/unityplugin/simple_peer_connection.cc | 9 | ||||
-rw-r--r-- | examples/unityplugin/unity_plugin_apis.cc | 2 |
7 files changed, 12 insertions, 15 deletions
diff --git a/examples/androidnativeapi/jni/android_call_client.cc b/examples/androidnativeapi/jni/android_call_client.cc index 3c7c86d7ef..2c5e1af108 100644 --- a/examples/androidnativeapi/jni/android_call_client.cc +++ b/examples/androidnativeapi/jni/android_call_client.cc @@ -208,7 +208,7 @@ void AndroidCallClient::CreatePeerConnection() { void AndroidCallClient::Connect() { webrtc::MutexLock lock(&pc_mutex_); - pc_->CreateOffer(new rtc::RefCountedObject<CreateOfferObserver>(pc_), + pc_->CreateOffer(rtc::make_ref_counted<CreateOfferObserver>(pc_), webrtc::PeerConnectionInterface::RTCOfferAnswerOptions()); } @@ -258,7 +258,7 @@ void CreateOfferObserver::OnSuccess(webrtc::SessionDescriptionInterface* desc) { // Ownership of desc was transferred to us, now we transfer it forward. pc_->SetLocalDescription( - new rtc::RefCountedObject<SetLocalSessionDescriptionObserver>(), desc); + rtc::make_ref_counted<SetLocalSessionDescriptionObserver>(), desc); // Generate a fake answer. std::unique_ptr<webrtc::SessionDescriptionInterface> answer( diff --git a/examples/objcnativeapi/objc/objc_call_client.mm b/examples/objcnativeapi/objc/objc_call_client.mm index c1d84f7ce7..081b5bc44b 100644 --- a/examples/objcnativeapi/objc/objc_call_client.mm +++ b/examples/objcnativeapi/objc/objc_call_client.mm @@ -168,7 +168,7 @@ void ObjCCallClient::CreatePeerConnection() { void ObjCCallClient::Connect() { webrtc::MutexLock lock(&pc_mutex_); - pc_->CreateOffer(new rtc::RefCountedObject<CreateOfferObserver>(pc_), + pc_->CreateOffer(rtc::make_ref_counted<CreateOfferObserver>(pc_), webrtc::PeerConnectionInterface::RTCOfferAnswerOptions()); } @@ -214,7 +214,7 @@ void CreateOfferObserver::OnSuccess(webrtc::SessionDescriptionInterface* desc) { RTC_LOG(LS_INFO) << "Created offer: " << sdp; // Ownership of desc was transferred to us, now we transfer it forward. - pc_->SetLocalDescription(new rtc::RefCountedObject<SetLocalSessionDescriptionObserver>(), desc); + pc_->SetLocalDescription(rtc::make_ref_counted<SetLocalSessionDescriptionObserver>(), desc); // Generate a fake answer. std::unique_ptr<webrtc::SessionDescriptionInterface> answer( diff --git a/examples/peerconnection/client/conductor.cc b/examples/peerconnection/client/conductor.cc index 65958a445d..93e95b6583 100644 --- a/examples/peerconnection/client/conductor.cc +++ b/examples/peerconnection/client/conductor.cc @@ -59,7 +59,7 @@ class DummySetSessionDescriptionObserver : public webrtc::SetSessionDescriptionObserver { public: static DummySetSessionDescriptionObserver* Create() { - return new rtc::RefCountedObject<DummySetSessionDescriptionObserver>(); + return rtc::make_ref_counted<DummySetSessionDescriptionObserver>(); } virtual void OnSuccess() { RTC_LOG(LS_INFO) << __FUNCTION__; } virtual void OnFailure(webrtc::RTCError error) { diff --git a/examples/peerconnection/client/linux/main.cc b/examples/peerconnection/client/linux/main.cc index ccca7b1c7c..47f4f3618e 100644 --- a/examples/peerconnection/client/linux/main.cc +++ b/examples/peerconnection/client/linux/main.cc @@ -101,8 +101,7 @@ int main(int argc, char* argv[]) { rtc::InitializeSSL(); // Must be constructed after we set the socketserver. PeerConnectionClient client; - rtc::scoped_refptr<Conductor> conductor( - new rtc::RefCountedObject<Conductor>(&client, &wnd)); + auto conductor = rtc::make_ref_counted<Conductor>(&client, &wnd); socket_server.set_client(&client); socket_server.set_conductor(conductor); diff --git a/examples/peerconnection/client/main.cc b/examples/peerconnection/client/main.cc index 3ab4176083..04a331d2bd 100644 --- a/examples/peerconnection/client/main.cc +++ b/examples/peerconnection/client/main.cc @@ -107,8 +107,7 @@ int PASCAL wWinMain(HINSTANCE instance, rtc::InitializeSSL(); PeerConnectionClient client; - rtc::scoped_refptr<Conductor> conductor( - new rtc::RefCountedObject<Conductor>(&client, &wnd)); + auto conductor = rtc::make_ref_counted<Conductor>(&client, &wnd); // Main loop. MSG msg; diff --git a/examples/unityplugin/simple_peer_connection.cc b/examples/unityplugin/simple_peer_connection.cc index 34abbe294e..16c580e767 100644 --- a/examples/unityplugin/simple_peer_connection.cc +++ b/examples/unityplugin/simple_peer_connection.cc @@ -99,7 +99,7 @@ class DummySetSessionDescriptionObserver : public webrtc::SetSessionDescriptionObserver { public: static DummySetSessionDescriptionObserver* Create() { - return new rtc::RefCountedObject<DummySetSessionDescriptionObserver>(); + return rtc::make_ref_counted<DummySetSessionDescriptionObserver>(); } virtual void OnSuccess() { RTC_LOG(LS_INFO) << __FUNCTION__; } virtual void OnFailure(webrtc::RTCError error) { @@ -446,10 +446,9 @@ void SimplePeerConnection::AddStreams(bool audio_only) { RTC_DCHECK(texture_helper != nullptr) << "Cannot get the Surface Texture Helper."; - rtc::scoped_refptr<webrtc::jni::AndroidVideoTrackSource> source( - new rtc::RefCountedObject<webrtc::jni::AndroidVideoTrackSource>( - g_signaling_thread.get(), env, /* is_screencast= */ false, - /* align_timestamps= */ true)); + auto source = rtc::make_ref_counted<webrtc::jni::AndroidVideoTrackSource>( + g_signaling_thread.get(), env, /*is_screencast=*/false, + /*align_timestamps=*/true); // link with VideoCapturer (Camera); jmethodID link_camera_method = webrtc::GetStaticMethodID( diff --git a/examples/unityplugin/unity_plugin_apis.cc b/examples/unityplugin/unity_plugin_apis.cc index 34c28d926a..672330faec 100644 --- a/examples/unityplugin/unity_plugin_apis.cc +++ b/examples/unityplugin/unity_plugin_apis.cc @@ -27,7 +27,7 @@ int CreatePeerConnection(const char** turn_urls, const char* credential, bool mandatory_receive_video) { g_peer_connection_map[g_peer_connection_id] = - new rtc::RefCountedObject<SimplePeerConnection>(); + rtc::make_ref_counted<SimplePeerConnection>(); if (!g_peer_connection_map[g_peer_connection_id]->InitializePeerConnection( turn_urls, no_of_urls, username, credential, mandatory_receive_video)) |