Merge "tracing: Fix data source static state instantiation for DLLs"
diff --git a/include/perfetto/tracing/data_source.h b/include/perfetto/tracing/data_source.h
index c4c6681..6b2a81a 100644
--- a/include/perfetto/tracing/data_source.h
+++ b/include/perfetto/tracing/data_source.h
@@ -536,22 +536,7 @@
#define PERFETTO_DECLARE_DATA_SOURCE_STATIC_MEMBERS(...) \
template <> \
PERFETTO_COMPONENT_EXPORT perfetto::internal::DataSourceStaticState \
- perfetto::DataSource<__VA_ARGS__>::static_state_; \
- template <> \
- PERFETTO_COMPONENT_EXPORT PERFETTO_THREAD_LOCAL \
- perfetto::internal::DataSourceThreadLocalState* \
- perfetto::DataSource<__VA_ARGS__>::tls_state_
-
-// MSVC has a bug where explicit template member specialization declarations
-// can't have thread_local as the storage class specifier. The generated code
-// seems correct without the specifier, so drop it until the bug gets fixed.
-// See https://developercommunity2.visualstudio.com/t/Unable-to-specialize-
-// static-thread_local/1302689.
-#if PERFETTO_BUILDFLAG(PERFETTO_COMPILER_MSVC)
-#define PERFETTO_TEMPLATE_THREAD_LOCAL
-#else
-#define PERFETTO_TEMPLATE_THREAD_LOCAL PERFETTO_THREAD_LOCAL
-#endif
+ perfetto::DataSource<__VA_ARGS__>::static_state_
// This macro must be used once for each data source in one source file to
// allocate static storage for the data source's static state.
@@ -563,10 +548,6 @@
#define PERFETTO_DEFINE_DATA_SOURCE_STATIC_MEMBERS(...) \
template <> \
PERFETTO_COMPONENT_EXPORT perfetto::internal::DataSourceStaticState \
- perfetto::DataSource<__VA_ARGS__>::static_state_{}; \
- template <> \
- PERFETTO_COMPONENT_EXPORT PERFETTO_TEMPLATE_THREAD_LOCAL \
- perfetto::internal::DataSourceThreadLocalState* \
- perfetto::DataSource<__VA_ARGS__>::tls_state_ = nullptr
+ perfetto::DataSource<__VA_ARGS__>::static_state_ {}
#endif // INCLUDE_PERFETTO_TRACING_DATA_SOURCE_H_
diff --git a/include/perfetto/tracing/internal/track_event_macros.h b/include/perfetto/tracing/internal/track_event_macros.h
index 4663c18..332ba0e 100644
--- a/include/perfetto/tracing/internal/track_event_macros.h
+++ b/include/perfetto/tracing/internal/track_event_macros.h
@@ -87,10 +87,9 @@
} // namespace internal
// Defines the TrackEvent data source for the current track event namespace.
-#define PERFETTO_INTERNAL_DECLARE_TRACK_EVENT_DATA_SOURCE() \
- struct PERFETTO_COMPONENT_EXPORT TrackEvent \
- : public ::perfetto::internal::TrackEventDataSource< \
- TrackEvent, &internal::kCategoryRegistry> {}
+#define PERFETTO_INTERNAL_DECLARE_TRACK_EVENT_DATA_SOURCE() \
+ struct TrackEvent : public ::perfetto::internal::TrackEventDataSource< \
+ TrackEvent, &internal::kCategoryRegistry> {}
// At compile time, turns a category name represented by a static string into an
// index into the current category registry. A build error will be generated if