Optional: Use nullopt and implicit construction in /rtc_tools

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.

R=mbonadei@webrtc.org

Bug: None
Change-Id: Iec336d342414dc68b59ba4b4623fdf768f6fb655
Reviewed-on: https://webrtc-review.googlesource.com/23602
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20932}
This commit is contained in:
Oskar Sundbom
2017-11-16 10:55:27 +01:00
committed by Commit Bot
parent deb866360a
commit 59dd482249
3 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@ ConfigReader::~ConfigReader() = default;
rtc::Optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
#ifdef WEBRTC_NETWORK_TESTER_PROTO
if (proto_config_index_ >= proto_all_configs_.configs_size())
return rtc::Optional<Config>();
return rtc::nullopt;
auto proto_config = proto_all_configs_.configs(proto_config_index_++);
RTC_DCHECK(proto_config.has_packet_send_interval_ms());
RTC_DCHECK(proto_config.has_packet_size());
@ -41,9 +41,9 @@ rtc::Optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
config.packet_send_interval_ms = proto_config.packet_send_interval_ms();
config.packet_size = proto_config.packet_size();
config.execution_time_ms = proto_config.execution_time_ms();
return rtc::Optional<Config>(config);
return config;
#else
return rtc::Optional<Config>();
return rtc::nullopt;
#endif // WEBRTC_NETWORK_TESTER_PROTO
}

View File

@ -115,7 +115,7 @@ void PacketSender::SendPacket() {
packet.set_type(NetworkTesterPacket::TEST_DATA);
packet.set_sequence_number(sequence_number_++);
packet.set_send_timestamp(rtc::TimeMicros());
test_controller_->SendData(packet, rtc::Optional<size_t>(packet_size_));
test_controller_->SendData(packet, packet_size_);
}
int64_t PacketSender::GetSendIntervalMs() const {

View File

@ -37,7 +37,7 @@ void TestController::SendConnectTo(const std::string& hostname, int port) {
udp_transport_->SetRemoteAddress(rtc::SocketAddress(hostname, port));
NetworkTesterPacket packet;
packet.set_type(NetworkTesterPacket::HAND_SHAKING);
SendData(packet, rtc::Optional<size_t>());
SendData(packet, rtc::nullopt);
rtc::CritScope scoped_lock(&local_test_done_lock_);
local_test_done_ = false;
remote_test_done_ = false;
@ -65,7 +65,7 @@ void TestController::OnTestDone() {
RTC_DCHECK_CALLED_SEQUENTIALLY(&packet_sender_checker_);
NetworkTesterPacket packet;
packet.set_type(NetworkTesterPacket::TEST_DONE);
SendData(packet, rtc::Optional<size_t>());
SendData(packet, rtc::nullopt);
rtc::CritScope scoped_lock(&local_test_done_lock_);
local_test_done_ = true;
}
@ -92,7 +92,7 @@ void TestController::OnReadPacket(rtc::AsyncPacketSocket* socket,
NetworkTesterPacket packet;
packet.set_type(NetworkTesterPacket::TEST_START);
udp_transport_->SetRemoteAddress(remote_addr);
SendData(packet, rtc::Optional<size_t>());
SendData(packet, rtc::nullopt);
packet_sender_.reset(new PacketSender(this, config_file_path_));
packet_sender_->StartSending();
rtc::CritScope scoped_lock(&local_test_done_lock_);