Update rtc_base to not use implicit T* --> scoped_refptr<T> conversion

Also updated the OperationsChain and CallbackHandle classes to not use
any virtual methods.

Bug: webrtc:13464
Change-Id: I3437d1b7b043339e66411f5a46c226624b7ff9a5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/246102
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35682}
diff --git a/rtc_base/rtc_certificate.cc b/rtc_base/rtc_certificate.cc
index 496b4ac..e9137f4 100644
--- a/rtc_base/rtc_certificate.cc
+++ b/rtc_base/rtc_certificate.cc
@@ -13,6 +13,7 @@
 #include <memory>
 
 #include "rtc_base/checks.h"
+#include "rtc_base/ref_counted_object.h"
 #include "rtc_base/ssl_certificate.h"
 #include "rtc_base/ssl_identity.h"
 #include "rtc_base/time_utils.h"
@@ -21,7 +22,9 @@
 
 scoped_refptr<RTCCertificate> RTCCertificate::Create(
     std::unique_ptr<SSLIdentity> identity) {
-  return new RTCCertificate(identity.release());
+  // Explicit new to access proteced constructor.
+  return rtc::scoped_refptr<RTCCertificate>(
+      new RTCCertificate(identity.release()));
 }
 
 RTCCertificate::RTCCertificate(SSLIdentity* identity) : identity_(identity) {
@@ -61,7 +64,7 @@
       SSLIdentity::CreateFromPEMStrings(pem.private_key(), pem.certificate()));
   if (!identity)
     return nullptr;
-  return new RTCCertificate(identity.release());
+  return RTCCertificate::Create(std::move(identity));
 }
 
 bool RTCCertificate::operator==(const RTCCertificate& certificate) const {