Add absl::string_view overload for RtcEventLogOutput::Write
Bug: webrtc:13579
Change-Id: I13f63fb6be6aa62c2e011c18327499fa16b5824e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/267641
Commit-Queue: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37440}
diff --git a/api/rtc_event_log_output_file.cc b/api/rtc_event_log_output_file.cc
index 2e31c2d..2ba3e02 100644
--- a/api/rtc_event_log_output_file.cc
+++ b/api/rtc_event_log_output_file.cc
@@ -55,14 +55,18 @@
}
bool RtcEventLogOutputFile::Write(const std::string& output) {
+ return Write(absl::string_view(output));
+}
+
+bool RtcEventLogOutputFile::Write(absl::string_view output) {
RTC_DCHECK(IsActiveInternal());
// No single write may be so big, that it would risk overflowing the
// calculation of (written_bytes_ + output.length()).
- RTC_DCHECK_LT(output.length(), kMaxReasonableFileSize);
+ RTC_DCHECK_LT(output.size(), kMaxReasonableFileSize);
if (max_size_bytes_ == RtcEventLog::kUnlimitedOutput ||
- written_bytes_ + output.length() <= max_size_bytes_) {
- if (file_.Write(output.c_str(), output.size())) {
+ written_bytes_ + output.size() <= max_size_bytes_) {
+ if (file_.Write(output.data(), output.size())) {
written_bytes_ += output.size();
return true;
} else {