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/operations_chain.cc b/rtc_base/operations_chain.cc
index 59d30d3..f42482b 100644
--- a/rtc_base/operations_chain.cc
+++ b/rtc_base/operations_chain.cc
@@ -37,10 +37,11 @@
// static
scoped_refptr<OperationsChain> OperationsChain::Create() {
- return new OperationsChain();
+ // Explicit new, to access private constructor.
+ return rtc::scoped_refptr<OperationsChain>(new OperationsChain());
}
-OperationsChain::OperationsChain() : RefCountedObject() {
+OperationsChain::OperationsChain() {
RTC_DCHECK_RUN_ON(&sequence_checker_);
}
@@ -63,8 +64,10 @@
}
std::function<void()> OperationsChain::CreateOperationsChainCallback() {
- return [handle = rtc::scoped_refptr<CallbackHandle>(
- new CallbackHandle(this))]() { handle->OnOperationComplete(); };
+ return [handle = rtc::make_ref_counted<CallbackHandle>(
+ rtc::scoped_refptr<OperationsChain>(this))]() {
+ handle->OnOperationComplete();
+ };
}
void OperationsChain::OnOperationComplete() {