Closed
Bug 232201
Opened 21 years ago
Closed 21 years ago
nsIPrefBranchInternal should inherit from nsIPrefBranch
Categories
(Core :: Preferences: Backend, defect)
Core
Preferences: Backend
Tracking
()
RESOLVED
FIXED
mozilla1.7alpha
People
(Reporter: benjamin, Assigned: benjamin)
Details
(Keywords: memory-footprint)
Attachments
(2 files)
5.89 KB,
patch
|
alecf
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
51.10 KB,
patch
|
alecf
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
caillon points out that in bug 231076 we increased codesize by 100 bytes which
really shouldn't be necessary. This can really add up since we're converting all
the old nsIPref client code. If nsIPrefBranchInternal inherits from
nsIPrefBranch, we can save a QI and a comptr, and I'm pretty sure it costs nothing.
Assignee | ||
Comment 1•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #139918 -
Flags: superreview?(darin)
Attachment #139918 -
Flags: review?(alecf)
Comment 2•21 years ago
|
||
ugh... I'm really not into interface inheritance. I want it to be very expclit
that nsIPrefBranchInternal is a seperate interface.
is there another reason other than code size to make this change?
Assignee | ||
Comment 3•21 years ago
|
||
(In reply to comment #2)
> ugh... I'm really not into interface inheritance. I want it to be very expclit
> that nsIPrefBranchInternal is a seperate interface.
What does this mean? Are you philosophically opposed to interface inheritance? I
try to use interface inheritance whenever appropriate, defined as:
1) interface2 extends the functionality of interface1
2) you'ld never have interface2 without interface1
3) you're not planning on implementing interface2 as a tearoff
In these cases I feel that interface inheritance is not only appropriate, but
should be recommended. This is IMO a model case for interface inheritance.
Comment 4•21 years ago
|
||
i agree with bsmedberg.. plus it reduces the size of a pref branch object by one
WORD ;-)
Comment 5•21 years ago
|
||
Comment on attachment 139918 [details] [diff] [review]
nsIPrefBranchInternal inherits from nsIPrefBranch
i think there are other places (in necko for sure) where you can avoid separate
QI's to nsIPrefBranchInternal just as you have done in
mozPersonalDictionary.cpp
sr=darin
Attachment #139918 -
Flags: superreview?(darin) → superreview+
Comment 6•21 years ago
|
||
Actually, would it make sense to rename this thing into nsIPrefBranch*2* while
having it inherit from nsIPrefBranch? I don't really see what is "internal"
about it, to be honest. If we don't, then the inheritance chain will be kind of
weird when we DO have an nsIPrefBranch2....
Comment 7•21 years ago
|
||
Comment on attachment 139918 [details] [diff] [review]
nsIPrefBranchInternal inherits from nsIPrefBranch
The internal is a reserved interface that will never be made public or frozen.
If and when we do a to-be-frozen interface, then yes we should call it "2"
If we need to move a method over to the "2" interface, then we can... but the
internal one will always be internal.
and I'm convinced, or at least persuaded, that this should inhert.
r=alecf
Attachment #139918 -
Flags: review?(alecf) → review+
Assignee | ||
Comment 8•21 years ago
|
||
checked in... I'm gonna leave this open to patch a small basketful of consumers.
Whiteboard: first patch checked in, additional consumers to be updated
Assignee | ||
Comment 9•21 years ago
|
||
This reduced codesize beyond my wildest hopes, so I've gone through the tree
and updated a lot of clients. I didn't touch mailnews (too painful) or any
clients that use the non-root prefbranch.
Assignee | ||
Updated•21 years ago
|
Attachment #140068 -
Flags: superreview?(darin)
Attachment #140068 -
Flags: review?(alecf)
Comment 10•21 years ago
|
||
Comment on attachment 140068 [details] [diff] [review]
part 2, update many callers
*sigh* I guess this is good for code size and all, I'm just sad to see lots of
code going from calling a frozen interface to calling an internal interface.
r/sr=alec
on a side note, I'm wondering if its time for nsIPrefBranch2, now that we've
decided to freeze nsIObserver after all. Originally we put AddObserver() on
nsIPrefBranchInternal because we didn't want to "freeze" topics, like
pref-changed and so forth. I think we're now in a world where that is fairly
safe.
When we do that, we probably want to add getStringPref() and getUnicharPref()
to simplify nsA[C]String access to prefs.
Attachment #140068 -
Flags: review?(alecf) → review+
Comment 11•21 years ago
|
||
I can fix this in mailnews when I'm removing nsIPref (bug 226005)
Comment 12•21 years ago
|
||
Comment on attachment 140068 [details] [diff] [review]
part 2, update many callers
sr=darin
very nice!!
Attachment #140068 -
Flags: superreview?(darin) → superreview+
In my tree, I get Venkman failing to init on a QI error from nsIPrefBranch to
nsIPrefBranchInternal in pref-manager.js, probably because of this fix...
Assignee | ||
Comment 14•21 years ago
|
||
part 2 got checked in last week, with happy codesize savings. Comment #13 was
due to a bad build.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Whiteboard: first patch checked in, additional consumers to be updated
Target Milestone: --- → mozilla1.7alpha
You need to log in
before you can comment on or make changes to this bug.
Description
•