Open Bug 1158428 Opened 9 years ago Updated 2 years ago

Generalize gfxPrefs to be tree-wide

Categories

(Core :: Preferences: Backend, defect)

defect

Tracking

()

Tracking Status
firefox40 --- affected

People

(Reporter: botond, Unassigned)

Details

Attachments

(1 file)

Bug 912794 introduced a utility class called gfxPrefs [1] which allows declaring the name, type, update policy ("Once" means the pref is only read once on startup, "Live" means a var-cache is used to keep the pref value up to date), and default value of a pref with a declarative syntax, and provides easy-to-use getters for accessing the pref value.

It started off being used only for a few gfx prefs, but its use has been expanding to include all gfx prefs, apz prefs, and even some layout prefs.

I was showing this class to Ehsan, and he liked it and said it might be useful for this to be a tree-wide utility.

Is there any interest in this?

[1] http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxPrefs.h?rev=15dcfcb044c8
A few thoughts on the subject:
* Not having to worry about threads and callbacks is convenient.  The code is certainly shorter to look at.
* Having all of the preferences "declared" (e.g., DECL_GFX_PREF) in one file is probably not the best; however, extracting some common code and then having derived classes deal with the actual declaration of the prefs feels better.
* The fact that a preference is "Once" or "Live" is available at run time, which could be used for letting the user know that they need to (or don't need to) restart the browser for the change to take affect.  I actually have a sketch of a patch that does that.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: