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}
This commit is contained in:
Ali Tofigh
2022-03-14 13:32:04 +01:00
committed by WebRTC LUCI CQ
parent 9848890590
commit 6364d0899e
16 changed files with 118 additions and 24 deletions

View File

@ -10,6 +10,8 @@
#import "NSString+StdString.h"
#include "absl/strings/string_view.h"
@implementation NSString (StdString)
- (std::string)stdString {
@ -31,3 +33,13 @@
}
@end
@implementation NSString (AbslStringView)
+ (NSString *)stringForAbslStringView:(const absl::string_view)abslStringView {
return [[NSString alloc] initWithBytes:abslStringView.data()
length:abslStringView.length()
encoding:NSUTF8StringEncoding];
}
@end