Proxy: solve event tracing with compile time strings.
This change creates trace events with a single parameter
composed of ClassName::Method.
The change additionally causes the duration of the proxy call to be
traced, not only the occurrence.
Fixed: webrtc:12787
Change-Id: I1689862318d4c6fc1dcef343c3ccf3ae9f7e17df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219788
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34149}
diff --git a/rtc_base/string_utils_unittest.cc b/rtc_base/string_utils_unittest.cc
index 2fa1f22..120f7e6 100644
--- a/rtc_base/string_utils_unittest.cc
+++ b/rtc_base/string_utils_unittest.cc
@@ -39,4 +39,29 @@
#endif // WEBRTC_WIN
+TEST(CompileTimeString, MakeActsLikeAString) {
+ EXPECT_STREQ(MakeCompileTimeString("abc123"), "abc123");
+}
+
+TEST(CompileTimeString, ConvertibleToStdString) {
+ EXPECT_EQ(std::string(MakeCompileTimeString("abab")), "abab");
+}
+
+namespace detail {
+constexpr bool StringEquals(const char* a, const char* b) {
+ while (*a && *a == *b)
+ a++, b++;
+ return *a == *b;
+}
+} // namespace detail
+
+static_assert(detail::StringEquals(MakeCompileTimeString("handellm"),
+ "handellm"),
+ "String should initialize.");
+
+static_assert(detail::StringEquals(MakeCompileTimeString("abc123").Concat(
+ MakeCompileTimeString("def456ghi")),
+ "abc123def456ghi"),
+ "Strings should concatenate.");
+
} // namespace rtc