From 2c20225e235b6c92da3070d83c45c59eb526cce8 Mon Sep 17 00:00:00 2001 From: Gerald Squelart Date: Wed, 2 Sep 2020 04:01:02 +0000 Subject: [PATCH] Bug 1646266 - NoPayload default type, with specialized empty helper - r=gregtatum `NoPayload` will be mostly used internally when adding markers without payload data. It has an empty specialization of the MarkerTypeHelper (mainly to catch misuses), and the add-marker code will need to have different compile-time paths to handle it. Differential Revision: https://phabricator.services.mozilla.com/D87252 --- mozglue/baseprofiler/public/BaseProfilerMarkersDetail.h | 5 +++++ .../public/BaseProfilerMarkersPrerequisites.h | 8 ++++++++ tools/profiler/public/ProfilerMarkersPrerequisites.h | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/mozglue/baseprofiler/public/BaseProfilerMarkersDetail.h b/mozglue/baseprofiler/public/BaseProfilerMarkersDetail.h index 69349b05ce5f..61773595c619 100644 --- a/mozglue/baseprofiler/public/BaseProfilerMarkersDetail.h +++ b/mozglue/baseprofiler/public/BaseProfilerMarkersDetail.h @@ -93,6 +93,11 @@ struct MarkerTypeSerialization { std::tuple_element_t; }; +template <> +struct MarkerTypeSerialization<::mozilla::baseprofiler::markers::NoPayload> { + // Nothing! NoPayload has special handling avoiding payload work. +}; + } // namespace mozilla::base_profiler_markers_detail namespace mozilla { diff --git a/mozglue/baseprofiler/public/BaseProfilerMarkersPrerequisites.h b/mozglue/baseprofiler/public/BaseProfilerMarkersPrerequisites.h index 420120601d3f..3b711a3e1c33 100644 --- a/mozglue/baseprofiler/public/BaseProfilerMarkersPrerequisites.h +++ b/mozglue/baseprofiler/public/BaseProfilerMarkersPrerequisites.h @@ -633,6 +633,14 @@ MarkerOptions MarkerCategory::WithOptions(Options&&... aOptions) const { } // namespace mozilla +namespace mozilla::baseprofiler::markers { + +// Default marker payload types, with no extra information, not even a marker +// type and payload. This is intended for label-only markers. +struct NoPayload final {}; + +} // namespace mozilla::baseprofiler::markers + #endif // MOZ_GECKO_PROFILER #endif // BaseProfilerMarkersPrerequisites_h diff --git a/tools/profiler/public/ProfilerMarkersPrerequisites.h b/tools/profiler/public/ProfilerMarkersPrerequisites.h index 599a282b798d..ad300de8570d 100644 --- a/tools/profiler/public/ProfilerMarkersPrerequisites.h +++ b/tools/profiler/public/ProfilerMarkersPrerequisites.h @@ -17,6 +17,14 @@ #ifdef MOZ_GECKO_PROFILER +namespace profilermarkers { + +// Default marker payload types, with no extra information, not even a marker +// type and payload. This is intended for label-only markers. +using NoPayload = ::mozilla::baseprofiler::markers::NoPayload; + +} // namespace profilermarkers + #endif // MOZ_GECKO_PROFILER #endif // ProfilerMarkersPrerequisites_h