Adopt absl::string_view in rtc_base/log_sinks
This is part of a large scale effort to increase adoption of
absl::string_view across the WebRTC code base.
This CL adds absl::string_view versions of the OnLogMessage functions in
rtc::LogSink. The const std::string& versions are kept for now since
downstream clients use subclasses of LogSink and need to be migrated
before these are removed.
Bug: webrtc:13579
Change-Id: I57bb72ad503805ff0ca16f1d7aece2d44c65cb73
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/253980
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Xavier Lepaul <xalep@webrtc.org>
Owners-Override: Xavier Lepaul <xalep@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36189}
diff --git a/sdk/android/native_unittests/stacktrace/stacktrace_unittest.cc b/sdk/android/native_unittests/stacktrace/stacktrace_unittest.cc
index b77d867..5cbd4aa 100644
--- a/sdk/android/native_unittests/stacktrace/stacktrace_unittest.cc
+++ b/sdk/android/native_unittests/stacktrace/stacktrace_unittest.cc
@@ -16,6 +16,7 @@
#include <memory>
#include <vector>
+#include "absl/strings/string_view.h"
#include "rtc_base/event.h"
#include "rtc_base/logging.h"
#include "rtc_base/platform_thread.h"
@@ -201,6 +202,9 @@
explicit LookoutLogSink(std::string look_for)
: look_for_(std::move(look_for)) {}
void OnLogMessage(const std::string& message) override {
+ OnLogMessage(absl::string_view(message));
+ }
+ void OnLogMessage(absl::string_view message) override {
if (message.find(look_for_) != std::string::npos) {
when_found_.Set();
}