From 11146cdfea64411b10200482abffaa504187b577 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Thu, 20 Feb 2020 11:40:37 +0100 Subject: [PATCH] Reland "Remove old-style OnFailure callbacks" This is a reland of 1a290e4495c8132e7ff2c44d78de5e1d7eefdb9e after fixing the downstream projects. Original change's description: > Remove old-style OnFailure callbacks > > Also delete default implementation of new-style OnFailure, > since it can't call the deprecated function. > > Deprecating the old-style OnFailure callback turned out to be impossible, > since one can't have the new-style callback call the old-style one. > > Bug: chromium:589455 > Change-Id: Icf529ddb02d99ad9e205095d5a1fbeb0da91dd0e > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146219 > Reviewed-by: Karl Wiberg > Commit-Queue: Harald Alvestrand > Cr-Commit-Position: refs/heads/master@{#30570} Bug: chromium:589455 Change-Id: I7227e3c6886c504043b019b621e45658cbd6fd53 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168941 Reviewed-by: Karl Wiberg Commit-Queue: Harald Alvestrand Cr-Commit-Position: refs/heads/master@{#30583} --- api/jsep.cc | 17 ----------------- api/jsep.h | 13 +++++-------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/api/jsep.cc b/api/jsep.cc index ddb39b6181..5fdc8905c7 100644 --- a/api/jsep.cc +++ b/api/jsep.cc @@ -21,23 +21,6 @@ size_t SessionDescriptionInterface::RemoveCandidates( return 0; } -void CreateSessionDescriptionObserver::OnFailure(RTCError error) { - OnFailure(error.message()); -} - -void CreateSessionDescriptionObserver::OnFailure(const std::string& error) { - OnFailure(RTCError(RTCErrorType::INTERNAL_ERROR, std::string(error))); -} - -void SetSessionDescriptionObserver::OnFailure(RTCError error) { - std::string message(error.message()); - OnFailure(message); -} - -void SetSessionDescriptionObserver::OnFailure(const std::string& error) { - OnFailure(RTCError(RTCErrorType::INTERNAL_ERROR, std::string(error))); -} - const char SessionDescriptionInterface::kOffer[] = "offer"; const char SessionDescriptionInterface::kPrAnswer[] = "pranswer"; const char SessionDescriptionInterface::kAnswer[] = "answer"; diff --git a/api/jsep.h b/api/jsep.h index 86f4162f84..cf8aeb0cb4 100644 --- a/api/jsep.h +++ b/api/jsep.h @@ -28,6 +28,7 @@ #include "absl/types/optional.h" #include "api/rtc_error.h" +#include "rtc_base/deprecation.h" #include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" @@ -222,11 +223,9 @@ class RTC_EXPORT CreateSessionDescriptionObserver // error code and a string. // RTCError is non-copyable, so it must be passed using std::move. // Earlier versions of the API used a string argument. This version - // is deprecated; in order to let clients remove the old version, it has a - // default implementation. If both versions are unimplemented, the - // result will be a runtime error (stack overflow). This is intentional. - virtual void OnFailure(RTCError error); - virtual void OnFailure(const std::string& error); + // is removed; its functionality was the same as passing + // error.message. + virtual void OnFailure(RTCError error) = 0; protected: ~CreateSessionDescriptionObserver() override = default; @@ -237,9 +236,7 @@ class RTC_EXPORT SetSessionDescriptionObserver : public rtc::RefCountInterface { public: virtual void OnSuccess() = 0; // See description in CreateSessionDescriptionObserver for OnFailure. - virtual void OnFailure(RTCError error); - - virtual void OnFailure(const std::string& error); + virtual void OnFailure(RTCError error) = 0; protected: ~SetSessionDescriptionObserver() override = default;