Always compile rtc_base/trace_categories.{h,cc}.

Instead use the preprocessor to avoid compiling Perfetto related code
when RTC_USE_PERFETTO is not defined.

Bug: None
Change-Id: I85b37cb0287327035ac2e8feb3caf9505486a1e4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368343
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43410}
This commit is contained in:
Mirko Bonadei 2024-11-15 19:18:11 +01:00 committed by WebRTC LUCI CQ
parent ab0b1888a5
commit 79c380c5b7
3 changed files with 10 additions and 6 deletions

View File

@ -187,6 +187,8 @@ rtc_library("event_tracer") {
sources = [ sources = [
"event_tracer.cc", "event_tracer.cc",
"event_tracer.h", "event_tracer.h",
"trace_categories.cc",
"trace_categories.h",
"trace_event.h", "trace_event.h",
] ]
deps = [ deps = [
@ -203,12 +205,6 @@ rtc_library("event_tracer") {
"system:rtc_export", "system:rtc_export",
"//third_party/abseil-cpp/absl/strings:string_view", "//third_party/abseil-cpp/absl/strings:string_view",
] ]
if (rtc_use_perfetto) {
sources += [
"trace_categories.cc",
"trace_categories.h",
]
}
} }
rtc_library("histogram_percentile_counter") { rtc_library("histogram_percentile_counter") {

View File

@ -10,4 +10,8 @@
#include "rtc_base/trace_categories.h" #include "rtc_base/trace_categories.h"
#if defined(RTC_USE_PERFETTO)
PERFETTO_TRACK_EVENT_STATIC_STORAGE_IN_NAMESPACE_WITH_ATTRS(webrtc, RTC_EXPORT); PERFETTO_TRACK_EVENT_STATIC_STORAGE_IN_NAMESPACE_WITH_ATTRS(webrtc, RTC_EXPORT);
#endif // RTC_USE_PERFETTO

View File

@ -11,6 +11,8 @@
#ifndef RTC_BASE_TRACE_CATEGORIES_H_ #ifndef RTC_BASE_TRACE_CATEGORIES_H_
#define RTC_BASE_TRACE_CATEGORIES_H_ #define RTC_BASE_TRACE_CATEGORIES_H_
#if defined(RTC_USE_PERFETTO)
#define PERFETTO_ENABLE_LEGACY_TRACE_EVENTS 1 #define PERFETTO_ENABLE_LEGACY_TRACE_EVENTS 1
#include "rtc_base/system/rtc_export.h" #include "rtc_base/system/rtc_export.h"
@ -30,4 +32,6 @@ PERFETTO_DEFINE_CATEGORIES_IN_NAMESPACE_WITH_ATTRS(
PERFETTO_USE_CATEGORIES_FROM_NAMESPACE(webrtc); PERFETTO_USE_CATEGORIES_FROM_NAMESPACE(webrtc);
#endif // RTC_USE_PERFETTO
#endif // RTC_BASE_TRACE_CATEGORIES_H_ #endif // RTC_BASE_TRACE_CATEGORIES_H_