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:
committed by
Commit Bot
parent
deb866360a
commit
59dd482249
@ -32,7 +32,7 @@ ConfigReader::~ConfigReader() = default;
|
|||||||
rtc::Optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
|
rtc::Optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
|
||||||
#ifdef WEBRTC_NETWORK_TESTER_PROTO
|
#ifdef WEBRTC_NETWORK_TESTER_PROTO
|
||||||
if (proto_config_index_ >= proto_all_configs_.configs_size())
|
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_++);
|
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_send_interval_ms());
|
||||||
RTC_DCHECK(proto_config.has_packet_size());
|
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_send_interval_ms = proto_config.packet_send_interval_ms();
|
||||||
config.packet_size = proto_config.packet_size();
|
config.packet_size = proto_config.packet_size();
|
||||||
config.execution_time_ms = proto_config.execution_time_ms();
|
config.execution_time_ms = proto_config.execution_time_ms();
|
||||||
return rtc::Optional<Config>(config);
|
return config;
|
||||||
#else
|
#else
|
||||||
return rtc::Optional<Config>();
|
return rtc::nullopt;
|
||||||
#endif // WEBRTC_NETWORK_TESTER_PROTO
|
#endif // WEBRTC_NETWORK_TESTER_PROTO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@ void PacketSender::SendPacket() {
|
|||||||
packet.set_type(NetworkTesterPacket::TEST_DATA);
|
packet.set_type(NetworkTesterPacket::TEST_DATA);
|
||||||
packet.set_sequence_number(sequence_number_++);
|
packet.set_sequence_number(sequence_number_++);
|
||||||
packet.set_send_timestamp(rtc::TimeMicros());
|
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 {
|
int64_t PacketSender::GetSendIntervalMs() const {
|
||||||
|
|||||||
@ -37,7 +37,7 @@ void TestController::SendConnectTo(const std::string& hostname, int port) {
|
|||||||
udp_transport_->SetRemoteAddress(rtc::SocketAddress(hostname, port));
|
udp_transport_->SetRemoteAddress(rtc::SocketAddress(hostname, port));
|
||||||
NetworkTesterPacket packet;
|
NetworkTesterPacket packet;
|
||||||
packet.set_type(NetworkTesterPacket::HAND_SHAKING);
|
packet.set_type(NetworkTesterPacket::HAND_SHAKING);
|
||||||
SendData(packet, rtc::Optional<size_t>());
|
SendData(packet, rtc::nullopt);
|
||||||
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
||||||
local_test_done_ = false;
|
local_test_done_ = false;
|
||||||
remote_test_done_ = false;
|
remote_test_done_ = false;
|
||||||
@ -65,7 +65,7 @@ void TestController::OnTestDone() {
|
|||||||
RTC_DCHECK_CALLED_SEQUENTIALLY(&packet_sender_checker_);
|
RTC_DCHECK_CALLED_SEQUENTIALLY(&packet_sender_checker_);
|
||||||
NetworkTesterPacket packet;
|
NetworkTesterPacket packet;
|
||||||
packet.set_type(NetworkTesterPacket::TEST_DONE);
|
packet.set_type(NetworkTesterPacket::TEST_DONE);
|
||||||
SendData(packet, rtc::Optional<size_t>());
|
SendData(packet, rtc::nullopt);
|
||||||
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
||||||
local_test_done_ = true;
|
local_test_done_ = true;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ void TestController::OnReadPacket(rtc::AsyncPacketSocket* socket,
|
|||||||
NetworkTesterPacket packet;
|
NetworkTesterPacket packet;
|
||||||
packet.set_type(NetworkTesterPacket::TEST_START);
|
packet.set_type(NetworkTesterPacket::TEST_START);
|
||||||
udp_transport_->SetRemoteAddress(remote_addr);
|
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_.reset(new PacketSender(this, config_file_path_));
|
||||||
packet_sender_->StartSending();
|
packet_sender_->StartSending();
|
||||||
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
rtc::CritScope scoped_lock(&local_test_done_lock_);
|
||||||
|
|||||||
Reference in New Issue
Block a user