Optional: Use nullopt and implicit construction in /p2p
Changes places where we explicitly construct an Optional to instead use nullopt or the requisite value type only. This CL was uploaded by git cl split. Bug: None Change-Id: Ia65be19b24c93db360a313f82a84bfae1a49bf2d Reviewed-on: https://webrtc-review.googlesource.com/23605 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Oskar Sundbom <ossu@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20929}
This commit is contained in:
parent
ebe62408b5
commit
903dcd733a
@ -151,9 +151,7 @@ class FakeIceTransport : public IceTransportInternal {
|
||||
return true;
|
||||
}
|
||||
|
||||
rtc::Optional<int> GetRttEstimate() override {
|
||||
return rtc::Optional<int>();
|
||||
}
|
||||
rtc::Optional<int> GetRttEstimate() override { return rtc::nullopt; }
|
||||
|
||||
void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) override {
|
||||
}
|
||||
|
||||
@ -57,9 +57,7 @@ class MockIceTransport : public IceTransportInternal {
|
||||
void SetRemoteIceParameters(const IceParameters& ice_params) override {}
|
||||
void SetRemoteIceMode(IceMode mode) override {}
|
||||
void SetIceConfig(const IceConfig& config) override {}
|
||||
rtc::Optional<int> GetRttEstimate() override {
|
||||
return rtc::Optional<int>();
|
||||
}
|
||||
rtc::Optional<int> GetRttEstimate() override { return rtc::nullopt; }
|
||||
void MaybeStartGathering() override {}
|
||||
void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) override {
|
||||
}
|
||||
|
||||
@ -307,9 +307,9 @@ IceGatheringState P2PTransportChannel::gathering_state() const {
|
||||
rtc::Optional<int> P2PTransportChannel::GetRttEstimate() {
|
||||
if (selected_connection_ != nullptr
|
||||
&& selected_connection_->rtt_samples() > 0) {
|
||||
return rtc::Optional<int>(selected_connection_->rtt());
|
||||
return selected_connection_->rtt();
|
||||
} else {
|
||||
return rtc::Optional<int>();
|
||||
return rtc::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1340,8 +1340,7 @@ void P2PTransportChannel::SortConnectionsAndUpdateState() {
|
||||
// TODO(honghaiz): Don't sort; Just use std::max_element in the right places.
|
||||
std::stable_sort(connections_.begin(), connections_.end(),
|
||||
[this](const Connection* a, const Connection* b) {
|
||||
int cmp = CompareConnections(
|
||||
a, b, rtc::Optional<int64_t>(), nullptr);
|
||||
int cmp = CompareConnections(a, b, rtc::nullopt, nullptr);
|
||||
if (cmp != 0) {
|
||||
return cmp > 0;
|
||||
}
|
||||
|
||||
@ -1336,9 +1336,9 @@ TEST_F(P2PTransportChannelTest,
|
||||
|
||||
// ep1 gathers continually but ep2 does not.
|
||||
IceConfig config1 = CreateIceConfig(1000, GATHER_CONTINUALLY);
|
||||
config1.regather_on_failed_networks_interval = rtc::Optional<int>(2000);
|
||||
config1.regather_on_failed_networks_interval = 2000;
|
||||
IceConfig config2;
|
||||
config2.regather_on_failed_networks_interval = rtc::Optional<int>(2000);
|
||||
config2.regather_on_failed_networks_interval = 2000;
|
||||
CreateChannels(config1, config2);
|
||||
|
||||
EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
|
||||
@ -3013,7 +3013,7 @@ TEST_F(P2PTransportChannelMultihomedTest, TestRestoreBackupConnection) {
|
||||
|
||||
// Create channels and let them go writable, as usual.
|
||||
IceConfig config = CreateIceConfig(1000, GATHER_CONTINUALLY);
|
||||
config.regather_on_failed_networks_interval = rtc::Optional<int>(2000);
|
||||
config.regather_on_failed_networks_interval = 2000;
|
||||
CreateChannels(config, config);
|
||||
EXPECT_TRUE_SIMULATED_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
|
||||
ep2_ch1()->receiving() &&
|
||||
@ -4132,7 +4132,7 @@ TEST_F(P2PTransportChannelPingTest, TestConnectionPrunedAgain) {
|
||||
P2PTransportChannel ch("test channel", 1, &pa);
|
||||
PrepareChannel(&ch);
|
||||
IceConfig config = CreateIceConfig(1000, GATHER_ONCE);
|
||||
config.receiving_switching_delay = rtc::Optional<int>(800);
|
||||
config.receiving_switching_delay = 800;
|
||||
ch.SetIceConfig(config);
|
||||
ch.MaybeStartGathering();
|
||||
ch.AddRemoteCandidate(CreateUdpCandidate(LOCAL_PORT_TYPE, "1.1.1.1", 1, 100));
|
||||
|
||||
@ -1330,8 +1330,7 @@ void Connection::ReceivedPingResponse(int rtt, const std::string& request_id) {
|
||||
}
|
||||
|
||||
total_round_trip_time_ms_ += rtt;
|
||||
current_round_trip_time_ms_ = rtc::Optional<uint32_t>(
|
||||
static_cast<uint32_t>(rtt));
|
||||
current_round_trip_time_ms_ = static_cast<uint32_t>(rtt);
|
||||
|
||||
pings_since_last_response_.clear();
|
||||
last_ping_response_received_ = rtc::TimeMillis();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user