Improve naming of static pref getter functions
Categories
(Core :: Preferences: Backend, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: n.nethercote, Assigned: n.nethercote)
References
Details
Attachments
(3 files)
Now that StaticPrefList.h is generated from StaticPrefList.yaml, we have more flexibility in how static pref getter functions are named, and we can do some useful things.
![]() |
Assignee | |
Comment 1•6 years ago
|
||
This is fall-out from bug 1564724.
![]() |
Assignee | |
Comment 2•6 years ago
|
||
This better distinguishes it from the pref name part of the getter, which uses
snake case.
Depends on D38602
![]() |
Assignee | |
Comment 3•6 years ago
|
||
Currently it's completely unclear at use sites that the getters for once
static prefs return the pref value from startup, rather than the current pref
value. (Bugs have been caused by this.) This commit improves things by changing
the getter name to make it clear that the pref value obtained is from startup.
This required changing things within libpref so it distinguishes between the
"base id" (foo_bar
) and the "full id" (foo_bar
or
foo_bar_DoNotUseDirectly
or foo_bar_AtStartup
or
foo_bar_AtStartup_DoNotUseDirectly
; the name used depends on the mirror
and
do_not_use_directly
values in the YAML definition.) The "full id" is used in
most places, while the "base id" is used for the GetPrefName_*
and
GetPrefDefault_*
functions.
(This is a nice demonstration of the benefits of the YAML file, bTW. Making
this change with the old code would have involved adding an entry to every
single pref in StaticPrefList.h.)
The patch also rejigs the comment at the top of StaticPrefList.yaml, to clarify
some things.
Depends on D38603
Comment 5•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1cbe3ab8f7cd
https://hg.mozilla.org/mozilla-central/rev/4d005e8db6cc
https://hg.mozilla.org/mozilla-central/rev/2cb4ffa920c6
Description
•