diff --git a/api/rtc_event_log_output.h b/api/rtc_event_log_output.h index ae61de62d7..f1f84a5f3a 100644 --- a/api/rtc_event_log_output.h +++ b/api/rtc_event_log_output.h @@ -33,11 +33,6 @@ class RtcEventLogOutput { // about how much data was written, if any. The output sink becomes inactive // after the first time `false` is returned. Write() may not be called on // an inactive output sink. - virtual bool Write(const std::string& output) { - return Write(absl::string_view(output)); - } - // TODO(bugs.webrtc.org/13579): Remove the string ref once all classes - // implement the string_view version. virtual bool Write(absl::string_view output) = 0; // Indicates that buffers should be written to disk if applicable. diff --git a/api/rtc_event_log_output_file_unittest.cc b/api/rtc_event_log_output_file_unittest.cc index ef5c3e6c21..0aff57fbbc 100644 --- a/api/rtc_event_log_output_file_unittest.cc +++ b/api/rtc_event_log_output_file_unittest.cc @@ -78,9 +78,9 @@ TEST_F(RtcEventLogOutputFileTest, LimitedOutputFileCappedToCapacity) { auto output_file = std::make_unique(output_file_name_, 2); - output_file->Write(absl::string_view("1")); - output_file->Write(absl::string_view("2")); - output_file->Write(absl::string_view("3")); + output_file->Write("1"); + output_file->Write("2"); + output_file->Write("3"); // Unsuccessful writes close the file; no need to delete the output to flush. EXPECT_EQ(GetOutputFileContents(), "12"); @@ -108,20 +108,20 @@ TEST_F(RtcEventLogOutputFileTest, DoNotWritePartialLines) { TEST_F(RtcEventLogOutputFileTest, UnsuccessfulWriteReturnsFalse) { auto output_file = std::make_unique(output_file_name_, 2); - EXPECT_FALSE(output_file->Write(absl::string_view("abc"))); + EXPECT_FALSE(output_file->Write("abc")); } TEST_F(RtcEventLogOutputFileTest, SuccessfulWriteReturnsTrue) { auto output_file = std::make_unique(output_file_name_, 3); - EXPECT_TRUE(output_file->Write(absl::string_view("abc"))); + EXPECT_TRUE(output_file->Write("abc")); } // Even if capacity is reached, a successful write leaves the output active. TEST_F(RtcEventLogOutputFileTest, FileStillActiveAfterSuccessfulWrite) { auto output_file = std::make_unique(output_file_name_, 3); - ASSERT_TRUE(output_file->Write(absl::string_view("abc"))); + ASSERT_TRUE(output_file->Write("abc")); EXPECT_TRUE(output_file->IsActive()); } @@ -130,7 +130,7 @@ TEST_F(RtcEventLogOutputFileTest, FileStillActiveAfterSuccessfulWrite) { TEST_F(RtcEventLogOutputFileTest, FileInactiveAfterUnsuccessfulWrite) { auto output_file = std::make_unique(output_file_name_, 2); - ASSERT_FALSE(output_file->Write(absl::string_view("abc"))); + ASSERT_FALSE(output_file->Write("abc")); EXPECT_FALSE(output_file->IsActive()); } @@ -145,9 +145,9 @@ class RtcEventLogOutputFileDeathTest : public RtcEventLogOutputFileTest {}; TEST_F(RtcEventLogOutputFileDeathTest, WritingToInactiveFileForbidden) { RtcEventLogOutputFile output_file(output_file_name_, 2); - ASSERT_FALSE(output_file.Write(absl::string_view("abc"))); + ASSERT_FALSE(output_file.Write("abc")); ASSERT_FALSE(output_file.IsActive()); - EXPECT_DEATH(output_file.Write(absl::string_view("abc")), ""); + EXPECT_DEATH(output_file.Write("abc"), ""); } TEST_F(RtcEventLogOutputFileDeathTest, DisallowUnreasonableFileSizeLimits) { diff --git a/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc b/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc index bcf3aca4cd..6dadf8b9c4 100644 --- a/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc +++ b/modules/congestion_controller/goog_cc/test/goog_cc_printer.cc @@ -136,10 +136,10 @@ void GoogCcStatePrinter::PrintHeaders(RtcEventLogOutput* log) { int ix = 0; for (const auto& logger : loggers_) { if (ix++) - log->Write(absl::string_view(" ")); + log->Write(" "); log->Write(logger->name()); } - log->Write(absl::string_view("\n")); + log->Write("\n"); log->Flush(); } @@ -160,11 +160,11 @@ void GoogCcStatePrinter::PrintState(RtcEventLogOutput* log, int ix = 0; for (const auto& logger : loggers_) { if (ix++) - log->Write(absl::string_view(" ")); + log->Write(" "); logger->WriteValue(log); } - log->Write(absl::string_view("\n")); + log->Write("\n"); log->Flush(); } diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index da9244cd53..638e7edb0f 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -2810,9 +2810,9 @@ TEST_P(PeerConnectionIntegrationTest, RtcEventLogOutputWriteCalled) { auto output = std::make_unique>(); ON_CALL(*output, IsActive()).WillByDefault(::testing::Return(true)); - ON_CALL(*output, Write(::testing::A())) + ON_CALL(*output, Write(::testing::A())) .WillByDefault(::testing::Return(true)); - EXPECT_CALL(*output, Write(::testing::A())) + EXPECT_CALL(*output, Write(::testing::A())) .Times(::testing::AtLeast(1)); EXPECT_TRUE(caller()->pc()->StartRtcEventLog( std::move(output), webrtc::RtcEventLog::kImmediateOutput)); diff --git a/pc/test/integration_test_helpers.h b/pc/test/integration_test_helpers.h index f68b96ed17..82d4babd5b 100644 --- a/pc/test/integration_test_helpers.h +++ b/pc/test/integration_test_helpers.h @@ -28,6 +28,7 @@ #include "absl/algorithm/container.h" #include "absl/memory/memory.h" +#include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "api/audio_options.h" #include "api/call/call_factory_interface.h" @@ -1250,7 +1251,6 @@ class MockRtcEventLogOutput : public webrtc::RtcEventLogOutput { public: virtual ~MockRtcEventLogOutput() = default; MOCK_METHOD(bool, IsActive, (), (const, override)); - MOCK_METHOD(bool, Write, (const std::string&), (override)); MOCK_METHOD(bool, Write, (absl::string_view), (override)); }; diff --git a/test/scenario/column_printer.cc b/test/scenario/column_printer.cc index 87dbe0b89c..661c83bd0d 100644 --- a/test/scenario/column_printer.cc +++ b/test/scenario/column_printer.cc @@ -48,12 +48,12 @@ StatesPrinter::~StatesPrinter() = default; void StatesPrinter::PrintHeaders() { if (!writer_) return; - writer_->Write(absl::string_view(printers_[0].headers_)); + writer_->Write(printers_[0].headers_); for (size_t i = 1; i < printers_.size(); ++i) { - writer_->Write(absl::string_view(" ")); - writer_->Write(absl::string_view(printers_[i].headers_)); + writer_->Write(" "); + writer_->Write(printers_[i].headers_); } - writer_->Write(absl::string_view("\n")); + writer_->Write("\n"); } void StatesPrinter::PrintRow() { diff --git a/test/scenario/stats_collection.cc b/test/scenario/stats_collection.cc index 5c81e3dd12..e32696de71 100644 --- a/test/scenario/stats_collection.cc +++ b/test/scenario/stats_collection.cc @@ -29,9 +29,9 @@ VideoQualityAnalyzer::VideoQualityAnalyzer( VideoQualityAnalyzer::~VideoQualityAnalyzer() = default; void VideoQualityAnalyzer::PrintHeaders() { - writer_->Write(absl::string_view( + writer_->Write( "capture_time render_time capture_width capture_height render_width " - "render_height psnr\n")); + "render_height psnr\n"); } std::function VideoQualityAnalyzer::Handler() {