diff --git a/api/scoped_refptr.h b/api/scoped_refptr.h index b1c90fcbbe..e145509127 100644 --- a/api/scoped_refptr.h +++ b/api/scoped_refptr.h @@ -105,8 +105,6 @@ class scoped_refptr { T* get() const { return ptr_; } explicit operator bool() const { return ptr_ != nullptr; } - // TODO(bugs.webrtc.org/13464): Delete this conversion operator. - operator T*() const { return ptr_; } T& operator*() const { return *ptr_; } T* operator->() const { return ptr_; } @@ -194,6 +192,25 @@ bool operator!=(std::nullptr_t, const rtc::scoped_refptr& a) { return !(a == nullptr); } +// Comparison with raw pointer. +template +bool operator==(const rtc::scoped_refptr& a, const U* b) { + return a.get() == b; +} +template +bool operator!=(const rtc::scoped_refptr& a, const U* b) { + return !(a == b); +} + +template +bool operator==(const T* a, const rtc::scoped_refptr& b) { + return a == b.get(); +} +template +bool operator!=(const T* a, const rtc::scoped_refptr& b) { + return !(a == b); +} + // Ordered comparison, needed for use as a std::map key. template bool operator<(const rtc::scoped_refptr& a, const rtc::scoped_refptr& b) { diff --git a/test/fuzzers/sdp_integration_fuzzer.cc b/test/fuzzers/sdp_integration_fuzzer.cc index 2a8be3978c..ece4b50505 100644 --- a/test/fuzzers/sdp_integration_fuzzer.cc +++ b/test/fuzzers/sdp_integration_fuzzer.cc @@ -27,22 +27,21 @@ class FuzzerTest : public PeerConnectionIntegrationBaseTest { // generated are discarded. auto srd_observer = - rtc::make_ref_counted(); + rtc::make_ref_counted(); SdpParseError error; std::unique_ptr sdp( CreateSessionDescription("offer", std::string(message), &error)); - // Note: This form of SRD takes ownership of the description. - caller()->pc()->SetRemoteDescription(srd_observer, sdp.release()); + caller()->pc()->SetRemoteDescription(std::move(sdp), srd_observer); // Wait a short time for observer to be called. Timeout is short // because the fuzzer should be trying many branches. EXPECT_TRUE_WAIT(srd_observer->called(), 100); // If set-remote-description was successful, try to answer. auto sld_observer = - rtc::make_ref_counted(); - if (srd_observer->result()) { - caller()->pc()->SetLocalDescription(sld_observer.get()); + rtc::make_ref_counted(); + if (srd_observer->error().ok()) { + caller()->pc()->SetLocalDescription(sld_observer); EXPECT_TRUE_WAIT(sld_observer->called(), 100); } // If there is an EXPECT failure, die here.