diff --git a/mozglue/baseprofiler/core/ProfileBufferEntry.h b/mozglue/baseprofiler/core/ProfileBufferEntry.h index 81107203a89c..ee6e401bd86f 100644 --- a/mozglue/baseprofiler/core/ProfileBufferEntry.h +++ b/mozglue/baseprofiler/core/ProfileBufferEntry.h @@ -19,13 +19,15 @@ #include "mozilla/Vector.h" #include +#include namespace mozilla { namespace baseprofiler { class ProfileBufferEntry { public: - using KindUnderlyingType = ::mozilla::ProfileBufferEntryKindUnderlyingType; + using KindUnderlyingType = + std::underlying_type_t<::mozilla::ProfileBufferEntryKind>; using Kind = ::mozilla::ProfileBufferEntryKind; ProfileBufferEntry(); diff --git a/mozglue/baseprofiler/public/BaseProfilerMarkersDetail.h b/mozglue/baseprofiler/public/BaseProfilerMarkersDetail.h index 03c2afc1a0ba..110249910027 100644 --- a/mozglue/baseprofiler/public/BaseProfilerMarkersDetail.h +++ b/mozglue/baseprofiler/public/BaseProfilerMarkersDetail.h @@ -23,6 +23,7 @@ #include #include +#include namespace mozilla::baseprofiler { // Implemented in platform.cpp @@ -407,8 +408,8 @@ void DeserializeAfterKindAndStream( } auto payloadType = static_cast( - aEntryReader - .ReadObject()); + aEntryReader.ReadObject< + std::underlying_type_t>()); // Stream the payload, including the type. switch (payloadType) { diff --git a/mozglue/baseprofiler/public/ProfileBufferEntryKinds.h b/mozglue/baseprofiler/public/ProfileBufferEntryKinds.h index 6010638c1297..cd5912c49b3e 100644 --- a/mozglue/baseprofiler/public/ProfileBufferEntryKinds.h +++ b/mozglue/baseprofiler/public/ProfileBufferEntryKinds.h @@ -60,9 +60,7 @@ static constexpr size_t ProfileBufferEntryNumChars = 8; // more efficient kinds of entries (e.g., stack frames could be stored in one // bigger entry, instead of multiple `ProfileBufferEntry`s); then we could // discard `ProfileBufferEntry` and move this enum to a more appropriate spot. -using ProfileBufferEntryKindUnderlyingType = uint8_t; - -enum class ProfileBufferEntryKind : ProfileBufferEntryKindUnderlyingType { +enum class ProfileBufferEntryKind : uint8_t { INVALID = 0, #define KIND(KIND, TYPE, SIZE) KIND, FOR_EACH_PROFILE_BUFFER_ENTRY_KIND(KIND) @@ -97,8 +95,7 @@ enum class ProfileBufferEntryKind : ProfileBufferEntryKindUnderlyingType { MODERN_LIMIT }; -using MarkerPayloadTypeUnderlyingType = uint8_t; -enum class MarkerPayloadType : MarkerPayloadTypeUnderlyingType { +enum class MarkerPayloadType : uint8_t { Cpp, Rust, }; diff --git a/tools/profiler/core/ProfileBufferEntry.h b/tools/profiler/core/ProfileBufferEntry.h index f6116187d520..bfee4923a376 100644 --- a/tools/profiler/core/ProfileBufferEntry.h +++ b/tools/profiler/core/ProfileBufferEntry.h @@ -11,6 +11,7 @@ #include #include #include +#include #include "gtest/MozGtestFriend.h" #include "js/ProfilingCategory.h" #include "mozilla/Attributes.h" @@ -30,7 +31,8 @@ struct JSContext; class ProfileBufferEntry { public: - using KindUnderlyingType = mozilla::ProfileBufferEntryKindUnderlyingType; + using KindUnderlyingType = + std::underlying_type_t<::mozilla::ProfileBufferEntryKind>; using Kind = mozilla::ProfileBufferEntryKind; ProfileBufferEntry();