Delete implicit conversion from rtc::scoped_refptr<T> to T*
Bug: webrtc:13464 Change-Id: I24c742c11a4ea5c4e307e170ee4fbd4e81cf1814 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/260325 Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36808}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
58d774ba78
commit
42a829e623
@ -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<T>& a) {
|
||||
return !(a == nullptr);
|
||||
}
|
||||
|
||||
// Comparison with raw pointer.
|
||||
template <typename T, typename U>
|
||||
bool operator==(const rtc::scoped_refptr<T>& a, const U* b) {
|
||||
return a.get() == b;
|
||||
}
|
||||
template <typename T, typename U>
|
||||
bool operator!=(const rtc::scoped_refptr<T>& a, const U* b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
bool operator==(const T* a, const rtc::scoped_refptr<U>& b) {
|
||||
return a == b.get();
|
||||
}
|
||||
template <typename T, typename U>
|
||||
bool operator!=(const T* a, const rtc::scoped_refptr<U>& b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
// Ordered comparison, needed for use as a std::map key.
|
||||
template <typename T, typename U>
|
||||
bool operator<(const rtc::scoped_refptr<T>& a, const rtc::scoped_refptr<U>& b) {
|
||||
|
@ -27,22 +27,21 @@ class FuzzerTest : public PeerConnectionIntegrationBaseTest {
|
||||
// generated are discarded.
|
||||
|
||||
auto srd_observer =
|
||||
rtc::make_ref_counted<MockSetSessionDescriptionObserver>();
|
||||
rtc::make_ref_counted<FakeSetRemoteDescriptionObserver>();
|
||||
|
||||
SdpParseError error;
|
||||
std::unique_ptr<SessionDescriptionInterface> 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<MockSetSessionDescriptionObserver>();
|
||||
if (srd_observer->result()) {
|
||||
caller()->pc()->SetLocalDescription(sld_observer.get());
|
||||
rtc::make_ref_counted<FakeSetLocalDescriptionObserver>();
|
||||
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.
|
||||
|
Reference in New Issue
Block a user