Closed Bug 1728769 Opened 4 years ago Closed 2 years ago

Consider using `std::underlying_type_t` for the profiler buffer types

Categories

(Core :: Gecko Profiler, task, P3)

task

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox93 --- wontfix
firefox113 --- fixed

People

(Reporter: canova, Assigned: aabh, Mentored)

References

Details

(Whiteboard: [fxp-profiler])

Attachments

(1 file)

Currently we have some types that we use in the buffer like ...UnderlyingType. It would be great to remove them and directly use std::underlying_type_t instead in the future.

See the locations where we have these types:
https://searchfox.org/mozilla-central/search?q=using.*UnderlyingType&path=profiler&case=false&regexp=true

Mentor: canaltinova
Assignee: nobody → abrouwersharries
Status: NEW → ASSIGNED
Whiteboard: [fxp] → [fxp-profiler]

I'm not sure this transform is valid for the UnderlyingType in ProportionValue.h, as it isn't an enum class. We could potentially restructure it to make it so, but I don't know what value that would add as the typedef isn't used outside of ProportionValue.

(In reply to Adam Brouwers-Harries [:aabh] [he/him] ⌚GMT from comment #1)

I'm not sure this transform is valid for the UnderlyingType in ProportionValue.h, as it isn't an enum class. We could potentially restructure it to make it so, but I don't know what value that would add as the typedef isn't used outside of ProportionValue.

Yes, you're right. I think when I wrote this bug and added this searchfox link, that type didn't exist yet. Let's leave that type out of this bug's scope.

Sounds good. I'm mostly done with the refactoring, so should hopefully have a patch up today.

This patch replaces "custom" underlying type definitions with definitions gleaned using the std::underlying_type mechanism. This allows us to directly set the underlying type for the enums without having to name it, and reduces the number of semantically identical names in the profile buffer code.

Pushed by abrouwersharries@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a997d78debb4 Use std::underlying_type_t for profile buffer enum types r=canaltinova
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: