Skip to content

Commit

Permalink
Replace rtc::Optional with absl::optional in test and rtc_tools
Browse files Browse the repository at this point in the history
This is a no-op change because rtc::Optional is an alias to absl::optional

This CL generated by running script with parameters 'test rtc_tools'

find $@ -type f \( -name \*.h -o -name \*.cc \) \
-exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \
-exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \
-exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+

find $@ -type f -name BUILD.gn \
-exec sed -r -i 's|"(../)*api:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+;

git cl format

Bug: webrtc:9078
Change-Id: Ibb43c737f4c45fe300736382b0dd2d8ab32c6377
Reviewed-on: https://webrtc-review.googlesource.com/83944
Reviewed-by: Patrik Höglund <[email protected]>
Commit-Queue: Danil Chapovalov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#23642}
  • Loading branch information
DanilChapovalov authored and Commit Bot committed Jun 18, 2018
1 parent 9bf3158 commit 431abd9
Show file tree
Hide file tree
Showing 25 changed files with 116 additions and 116 deletions.
112 changes: 56 additions & 56 deletions rtc_tools/event_log_visualizer/analyzer.cc

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rtc_tools/network_tester/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ if (rtc_enable_protobuf) {
deps = [
":network_tester_config_proto",
":network_tester_packet_proto",
"../../api:optional",
"../../p2p",
"../../rtc_base:checks",
"../../rtc_base:protobuf_utils",
"../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_task_queue",
"../../rtc_base:sequenced_task_checker",
"//third_party/abseil-cpp/absl/types:optional",
]

if (!build_with_chromium && is_clang) {
Expand Down
6 changes: 3 additions & 3 deletions rtc_tools/network_tester/config_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ ConfigReader::ConfigReader(const std::string& config_file_path)

ConfigReader::~ConfigReader() = default;

rtc::Optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
absl::optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
#ifdef WEBRTC_NETWORK_TESTER_PROTO
if (proto_config_index_ >= proto_all_configs_.configs_size())
return rtc::nullopt;
return absl::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());
Expand All @@ -45,7 +45,7 @@ rtc::Optional<ConfigReader::Config> ConfigReader::GetNextConfig() {
config.execution_time_ms = proto_config.execution_time_ms();
return config;
#else
return rtc::nullopt;
return absl::nullopt;
#endif // WEBRTC_NETWORK_TESTER_PROTO
}

Expand Down
4 changes: 2 additions & 2 deletions rtc_tools/network_tester/config_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <fstream>
#include <string>

#include "api/optional.h"
#include "absl/types/optional.h"
#include "rtc_base/constructormagic.h"

#include "rtc_base/ignore_wundef.h"
Expand All @@ -40,7 +40,7 @@ class ConfigReader {
explicit ConfigReader(const std::string& config_file_path);
~ConfigReader();

rtc::Optional<Config> GetNextConfig();
absl::optional<Config> GetNextConfig();

private:
NetworkTesterAllConfigs proto_all_configs_;
Expand Down
8 changes: 4 additions & 4 deletions rtc_tools/network_tester/test_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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::nullopt);
SendData(packet, absl::nullopt);
rtc::CritScope scoped_lock(&local_test_done_lock_);
local_test_done_ = false;
remote_test_done_ = false;
Expand All @@ -49,7 +49,7 @@ void TestController::Run() {
}

void TestController::SendData(const NetworkTesterPacket& packet,
rtc::Optional<size_t> data_size) {
absl::optional<size_t> data_size) {
// Can be call from packet_sender or from test_controller thread.
size_t packet_size = packet.ByteSizeLong();
send_data_[0] = packet_size;
Expand All @@ -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::nullopt);
SendData(packet, absl::nullopt);
rtc::CritScope scoped_lock(&local_test_done_lock_);
local_test_done_ = true;
}
Expand All @@ -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::nullopt);
SendData(packet, absl::nullopt);
packet_sender_.reset(new PacketSender(this, config_file_path_));
packet_sender_->StartSending();
rtc::CritScope scoped_lock(&local_test_done_lock_);
Expand Down
2 changes: 1 addition & 1 deletion rtc_tools/network_tester/test_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class TestController : public sigslot::has_slots<> {
void SendConnectTo(const std::string& hostname, int port);

void SendData(const NetworkTesterPacket& packet,
rtc::Optional<size_t> data_size);
absl::optional<size_t> data_size);

void OnTestDone();

Expand Down
6 changes: 3 additions & 3 deletions test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ rtc_source_set("video_test_common") {
"..:webrtc_common",
"../:typedefs",
"../api:libjingle_peerconnection_api",
"../api:optional",
"../api/video:video_frame",
"../api/video:video_frame_i420",
"../api/video_codecs:video_codecs_api",
Expand All @@ -75,6 +74,7 @@ rtc_source_set("video_test_common") {
"../rtc_base:rtc_base",
"../rtc_base:rtc_task_queue",
"../system_wrappers",
"//third_party/abseil-cpp/absl/types:optional",
]
}

Expand Down Expand Up @@ -389,9 +389,9 @@ rtc_source_set("fileutils") {
deps = [
"..:webrtc_common",
"../:typedefs",
"../api:optional",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"//third_party/abseil-cpp/absl/types:optional",
]
if (is_ios) {
deps += [ ":fileutils_objc" ]
Expand Down Expand Up @@ -453,10 +453,10 @@ rtc_source_set("fileutils_unittests") {
deps = [
":fileutils",
":test_support",
"../api:optional",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
"//testing/gtest",
"//third_party/abseil-cpp/absl/types:optional",
]
}

Expand Down
4 changes: 2 additions & 2 deletions test/call_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock,
int width,
int height) {
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
width, height, rtc::nullopt, rtc::nullopt, framerate * speed, clock));
width, height, absl::nullopt, absl::nullopt, framerate * speed, clock));
video_send_stream_->SetSource(frame_generator_capturer_.get(),
DegradationPreference::MAINTAIN_FRAMERATE);
}
Expand All @@ -332,7 +332,7 @@ void CallTest::CreateFrameGeneratorCapturer(int framerate,
int width,
int height) {
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
width, height, rtc::nullopt, rtc::nullopt, framerate, clock_));
width, height, absl::nullopt, absl::nullopt, framerate, clock_));
video_send_stream_->SetSource(frame_generator_capturer_.get(),
DegradationPreference::MAINTAIN_FRAMERATE);
}
Expand Down
6 changes: 3 additions & 3 deletions test/frame_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class ScrollingImageFrameGenerator : public FrameGenerator {

size_t current_frame_num_;
VideoFrame* current_source_frame_;
rtc::Optional<VideoFrame> current_frame_;
absl::optional<VideoFrame> current_frame_;
YuvFileGenerator file_generator_;
};

Expand Down Expand Up @@ -444,8 +444,8 @@ bool FrameForwarder::has_sinks() const {
std::unique_ptr<FrameGenerator> FrameGenerator::CreateSquareGenerator(
int width,
int height,
rtc::Optional<OutputType> type,
rtc::Optional<int> num_squares) {
absl::optional<OutputType> type,
absl::optional<int> num_squares) {
return std::unique_ptr<FrameGenerator>(
new SquareGenerator(width, height, type.value_or(OutputType::I420),
num_squares.value_or(10)));
Expand Down
4 changes: 2 additions & 2 deletions test/frame_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class FrameGenerator {
static std::unique_ptr<FrameGenerator> CreateSquareGenerator(
int width,
int height,
rtc::Optional<OutputType> type,
rtc::Optional<int> num_squares);
absl::optional<OutputType> type,
absl::optional<int> num_squares);

// Creates a frame generator that repeatedly plays a set of yuv files.
// The frame_repeat_count determines how many times each frame is shown,
Expand Down
6 changes: 3 additions & 3 deletions test/frame_generator_capturer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class FrameGeneratorCapturer::InsertFrameTask : public rtc::QueuedTask {
FrameGeneratorCapturer* FrameGeneratorCapturer::Create(
int width,
int height,
rtc::Optional<FrameGenerator::OutputType> type,
rtc::Optional<int> num_squares,
absl::optional<FrameGenerator::OutputType> type,
absl::optional<int> num_squares,
int target_fps,
Clock* clock) {
std::unique_ptr<FrameGeneratorCapturer> capturer(new FrameGeneratorCapturer(
Expand Down Expand Up @@ -187,7 +187,7 @@ void FrameGeneratorCapturer::InsertFrame() {
}

if (sink_) {
rtc::Optional<VideoFrame> out_frame = AdaptFrame(*frame);
absl::optional<VideoFrame> out_frame = AdaptFrame(*frame);
if (out_frame)
sink_->OnFrame(*out_frame);
}
Expand Down
6 changes: 3 additions & 3 deletions test/frame_generator_capturer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class FrameGeneratorCapturer : public VideoCapturer {
static FrameGeneratorCapturer* Create(
int width,
int height,
rtc::Optional<FrameGenerator::OutputType> type,
rtc::Optional<int> num_squares,
absl::optional<FrameGenerator::OutputType> type,
absl::optional<int> num_squares,
int target_fps,
Clock* clock);

Expand Down Expand Up @@ -98,7 +98,7 @@ class FrameGeneratorCapturer : public VideoCapturer {
std::unique_ptr<FrameGenerator> frame_generator_;

int target_fps_ RTC_GUARDED_BY(&lock_);
rtc::Optional<int> wanted_fps_ RTC_GUARDED_BY(&lock_);
absl::optional<int> wanted_fps_ RTC_GUARDED_BY(&lock_);
VideoRotation fake_rotation_ = kVideoRotation_0;

int64_t first_frame_capture_time_;
Expand Down
4 changes: 2 additions & 2 deletions test/fuzzers/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ rtc_static_library("audio_decoder_fuzzer") {
deps = [
"../..:webrtc_common",
"../../:typedefs",
"../../api:optional",
"../../api/audio_codecs:audio_codecs_api",
"../../modules/rtp_rtcp:rtp_rtcp_format",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
"//third_party/abseil-cpp/absl/types:optional",
]
}

Expand Down Expand Up @@ -454,11 +454,11 @@ rtc_static_library("audio_processing_fuzzer_helper") {
]
deps = [
":fuzz_data_helper",
"../../api:optional",
"../../api/audio:audio_frame_api",
"../../modules/audio_processing",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
"//third_party/abseil-cpp/absl/types:optional",
]
}

Expand Down
2 changes: 1 addition & 1 deletion test/fuzzers/audio_decoder_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

#include <limits>

#include "absl/types/optional.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/optional.h"
#include "modules/rtp_rtcp/source/byte_io.h"
#include "rtc_base/checks.h"

Expand Down
6 changes: 3 additions & 3 deletions test/fuzzers/neteq_rtp_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ class FuzzRtpInput : public NetEqInput {
FuzzHeader();
}

rtc::Optional<int64_t> NextPacketTime() const override {
absl::optional<int64_t> NextPacketTime() const override {
return packet_->time_ms;
}

rtc::Optional<int64_t> NextOutputEventTime() const override {
absl::optional<int64_t> NextOutputEventTime() const override {
return input_->NextOutputEventTime();
}

Expand All @@ -85,7 +85,7 @@ class FuzzRtpInput : public NetEqInput {

bool ended() const override { return ended_; }

rtc::Optional<RTPHeader> NextHeader() const override {
absl::optional<RTPHeader> NextHeader() const override {
RTC_DCHECK(packet_);
return packet_->header;
}
Expand Down
6 changes: 3 additions & 3 deletions test/fuzzers/neteq_signal_fuzzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ class FuzzSignalInput : public NetEqInput {
output_event_period_ms_ = fuzz_data_.SelectOneOf(output_event_periods);
}

rtc::Optional<int64_t> NextPacketTime() const override {
absl::optional<int64_t> NextPacketTime() const override {
return packet_->time_ms;
}

rtc::Optional<int64_t> NextOutputEventTime() const override {
absl::optional<int64_t> NextOutputEventTime() const override {
return next_output_event_ms_;
}

Expand Down Expand Up @@ -124,7 +124,7 @@ class FuzzSignalInput : public NetEqInput {

bool ended() const override { return ended_; }

rtc::Optional<RTPHeader> NextHeader() const override {
absl::optional<RTPHeader> NextHeader() const override {
RTC_DCHECK(packet_);
return packet_->header;
}
Expand Down
4 changes: 2 additions & 2 deletions test/mock_audio_decoder_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ class MockAudioDecoderFactory : public AudioDecoderFactory {
MOCK_METHOD1(IsSupportedDecoder, bool(const SdpAudioFormat&));
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const SdpAudioFormat& format,
rtc::Optional<AudioCodecPairId> codec_pair_id) {
absl::optional<AudioCodecPairId> codec_pair_id) {
std::unique_ptr<AudioDecoder> return_value;
MakeAudioDecoderMock(format, codec_pair_id, &return_value);
return return_value;
}
MOCK_METHOD3(MakeAudioDecoderMock,
void(const SdpAudioFormat& format,
rtc::Optional<AudioCodecPairId> codec_pair_id,
absl::optional<AudioCodecPairId> codec_pair_id,
std::unique_ptr<AudioDecoder>* return_value));

// Creates a MockAudioDecoderFactory with no formats and that may not be
Expand Down
2 changes: 1 addition & 1 deletion test/mock_audio_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MockAudioEncoder : public AudioEncoder {
MOCK_METHOD1(SetMaxPayloadSize, void(int max_payload_size_bytes));
MOCK_METHOD2(OnReceivedUplinkBandwidth,
void(int target_audio_bitrate_bps,
rtc::Optional<int64_t> probing_interval_ms));
absl::optional<int64_t> probing_interval_ms));
MOCK_METHOD1(OnReceivedUplinkPacketLossFraction,
void(float uplink_packet_loss_fraction));

Expand Down
10 changes: 5 additions & 5 deletions test/mock_audio_encoder_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
public:
MOCK_METHOD0(GetSupportedEncoders, std::vector<AudioCodecSpec>());
MOCK_METHOD1(QueryAudioEncoder,
rtc::Optional<AudioCodecInfo>(const SdpAudioFormat& format));
absl::optional<AudioCodecInfo>(const SdpAudioFormat& format));

std::unique_ptr<AudioEncoder> MakeAudioEncoder(
int payload_type,
const SdpAudioFormat& format,
rtc::Optional<AudioCodecPairId> codec_pair_id) {
absl::optional<AudioCodecPairId> codec_pair_id) {
std::unique_ptr<AudioEncoder> return_value;
MakeAudioEncoderMock(payload_type, format, codec_pair_id, &return_value);
return return_value;
}
MOCK_METHOD4(MakeAudioEncoderMock,
void(int payload_type,
const SdpAudioFormat& format,
rtc::Optional<AudioCodecPairId> codec_pair_id,
absl::optional<AudioCodecPairId> codec_pair_id,
std::unique_ptr<AudioEncoder>* return_value));

// Creates a MockAudioEncoderFactory with no formats and that may not be
Expand All @@ -55,7 +55,7 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
ON_CALL(*factory.get(), GetSupportedEncoders())
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
ON_CALL(*factory.get(), QueryAudioEncoder(_))
.WillByDefault(Return(rtc::nullopt));
.WillByDefault(Return(absl::nullopt));

EXPECT_CALL(*factory.get(), GetSupportedEncoders()).Times(AnyNumber());
EXPECT_CALL(*factory.get(), QueryAudioEncoder(_)).Times(AnyNumber());
Expand All @@ -78,7 +78,7 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
ON_CALL(*factory.get(), GetSupportedEncoders())
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
ON_CALL(*factory.get(), QueryAudioEncoder(_))
.WillByDefault(Return(rtc::nullopt));
.WillByDefault(Return(absl::nullopt));
ON_CALL(*factory.get(), MakeAudioEncoderMock(_, _, _, _))
.WillByDefault(SetArgPointee<3>(nullptr));

Expand Down
Loading

0 comments on commit 431abd9

Please sign in to comment.