Commit d27bf911 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Use base::Optional::value_or() idiom in rtc_ice_candidate.cc

BUG=78725
R=guidou@chromium.org

Change-Id: I2bd17004fd4635330e761980bc6a1304e0475f4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1924887
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717668}
parent 562cdc7e
...@@ -88,7 +88,7 @@ String RTCIceCandidate::sdpMid() const { ...@@ -88,7 +88,7 @@ String RTCIceCandidate::sdpMid() const {
uint16_t RTCIceCandidate::sdpMLineIndex(bool& is_null) const { uint16_t RTCIceCandidate::sdpMLineIndex(bool& is_null) const {
is_null = !platform_candidate_->SdpMLineIndex().has_value(); is_null = !platform_candidate_->SdpMLineIndex().has_value();
return is_null ? 0 : *platform_candidate_->SdpMLineIndex(); return platform_candidate_->SdpMLineIndex().value_or(0);
} }
scoped_refptr<RTCIceCandidatePlatform> RTCIceCandidate::PlatformCandidate() scoped_refptr<RTCIceCandidatePlatform> RTCIceCandidate::PlatformCandidate()
...@@ -106,7 +106,7 @@ String RTCIceCandidate::component() const { ...@@ -106,7 +106,7 @@ String RTCIceCandidate::component() const {
uint32_t RTCIceCandidate::priority(bool& is_null) const { uint32_t RTCIceCandidate::priority(bool& is_null) const {
is_null = !platform_candidate_->Priority().has_value(); is_null = !platform_candidate_->Priority().has_value();
return is_null ? 0 : *platform_candidate_->Priority(); return platform_candidate_->Priority().value_or(0);
} }
String RTCIceCandidate::address() const { String RTCIceCandidate::address() const {
...@@ -119,7 +119,7 @@ String RTCIceCandidate::protocol() const { ...@@ -119,7 +119,7 @@ String RTCIceCandidate::protocol() const {
uint16_t RTCIceCandidate::port(bool& is_null) const { uint16_t RTCIceCandidate::port(bool& is_null) const {
is_null = !platform_candidate_->Port().has_value(); is_null = !platform_candidate_->Port().has_value();
return is_null ? 0 : *platform_candidate_->Port(); return platform_candidate_->Port().value_or(0);
} }
String RTCIceCandidate::type() const { String RTCIceCandidate::type() const {
...@@ -136,7 +136,7 @@ String RTCIceCandidate::relatedAddress() const { ...@@ -136,7 +136,7 @@ String RTCIceCandidate::relatedAddress() const {
uint16_t RTCIceCandidate::relatedPort(bool& is_null) const { uint16_t RTCIceCandidate::relatedPort(bool& is_null) const {
is_null = !platform_candidate_->RelatedPort().has_value(); is_null = !platform_candidate_->RelatedPort().has_value();
return is_null ? 0 : *platform_candidate_->RelatedPort(); return platform_candidate_->RelatedPort().value_or(0);
} }
String RTCIceCandidate::usernameFragment() const { String RTCIceCandidate::usernameFragment() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment