Revert "Remove old-style OnFailure callbacks"

This reverts commit 1a290e4495c8132e7ff2c44d78de5e1d7eefdb9e.

Reason for revert: Breaks downstream project.

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 <kwiberg@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#30570}

TBR=steveanton@webrtc.org,kwiberg@webrtc.org,hta@webrtc.org

Change-Id: Ibc46b7a7294fb906f848e4528a85c09cbb62b913
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:589455
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168920
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30573}
This commit is contained in:
Mirko Bonadei
2020-02-20 14:39:18 +00:00
committed by Commit Bot
parent d881983a38
commit 4805a480fe
2 changed files with 25 additions and 5 deletions

View File

@ -21,6 +21,23 @@ size_t SessionDescriptionInterface::RemoveCandidates(
return 0; 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::kOffer[] = "offer";
const char SessionDescriptionInterface::kPrAnswer[] = "pranswer"; const char SessionDescriptionInterface::kPrAnswer[] = "pranswer";
const char SessionDescriptionInterface::kAnswer[] = "answer"; const char SessionDescriptionInterface::kAnswer[] = "answer";

View File

@ -28,7 +28,6 @@
#include "absl/types/optional.h" #include "absl/types/optional.h"
#include "api/rtc_error.h" #include "api/rtc_error.h"
#include "rtc_base/deprecation.h"
#include "rtc_base/ref_count.h" #include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h" #include "rtc_base/system/rtc_export.h"
@ -223,9 +222,11 @@ class RTC_EXPORT CreateSessionDescriptionObserver
// error code and a string. // error code and a string.
// RTCError is non-copyable, so it must be passed using std::move. // RTCError is non-copyable, so it must be passed using std::move.
// Earlier versions of the API used a string argument. This version // Earlier versions of the API used a string argument. This version
// is removed; its functionality was the same as passing // is deprecated; in order to let clients remove the old version, it has a
// error.message. // default implementation. If both versions are unimplemented, the
virtual void OnFailure(RTCError error) = 0; // result will be a runtime error (stack overflow). This is intentional.
virtual void OnFailure(RTCError error);
virtual void OnFailure(const std::string& error);
protected: protected:
~CreateSessionDescriptionObserver() override = default; ~CreateSessionDescriptionObserver() override = default;
@ -236,7 +237,9 @@ class RTC_EXPORT SetSessionDescriptionObserver : public rtc::RefCountInterface {
public: public:
virtual void OnSuccess() = 0; virtual void OnSuccess() = 0;
// See description in CreateSessionDescriptionObserver for OnFailure. // See description in CreateSessionDescriptionObserver for OnFailure.
virtual void OnFailure(RTCError error) = 0; virtual void OnFailure(RTCError error);
virtual void OnFailure(const std::string& error);
protected: protected:
~SetSessionDescriptionObserver() override = default; ~SetSessionDescriptionObserver() override = default;