Closed
Bug 371200
Opened 17 years ago
Closed 17 years ago
Every nsXULTooltipListener listens for pref change to update a global variable.
Categories
(Core :: XUL, defect)
Core
XUL
Tracking
()
RESOLVED
FIXED
People
(Reporter: jst, Assigned: jst)
Details
(4 keywords)
Attachments
(3 files)
2.50 KB,
patch
|
sicking
:
review+
sicking
:
superreview+
|
Details | Diff | Splinter Review |
1.10 KB,
patch
|
neil
:
review+
neil
:
superreview+
|
Details | Diff | Splinter Review |
2.52 KB,
patch
|
jst
:
review+
jst
:
superreview+
dveditz
:
approval1.8.1.4+
dveditz
:
approval1.8.0.12+
|
Details | Diff | Splinter Review |
This is just silly, we've got a *lot* of nsXULTooltipListener objects around at any given time, and every single one of them listens to changes to the pref browser.chrome.toolbar_tips only to update a static boolean member. There should only be one observer for that pref, period. I found this when I was tracking down a severe performance problem when closing a window in a Firefox instance that's been running for a long time (weeks), and it turns out that there's *thousands* of these listeners around, and the slowness came primarily due to these listeners unregistering themselves as pref observers. Obviously there's another problem here as well, the fact that we've got thousands of tooltip listeners, but that's another problem for another bug.
Assignee | ||
Comment 1•17 years ago
|
||
Attachment #255984 -
Flags: superreview?(jonas)
Attachment #255984 -
Flags: review?(jonas)
Attachment #255984 -
Flags: superreview?(jonas)
Attachment #255984 -
Flags: superreview+
Attachment #255984 -
Flags: review?(jonas)
Attachment #255984 -
Flags: review+
Updated•17 years ago
|
Assignee: nobody → jst
Assignee | ||
Comment 2•17 years ago
|
||
Fixed.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•17 years ago
|
Flags: blocking1.8.1.3?
Comment 3•17 years ago
|
||
Comment on attachment 255984 [details] [diff] [review] Fix, only register our listener once. >+ if (--sTooltipListenerCount == 0) { >+ // Unregister our pref observer >+ nsContentUtils::UnregisterPrefCallback("browser.chrome.toolbar_tips", >+ ToolbarTipsPrefChanged, this); >+ } Unfortunately the last destroyed tooltip is unlikely the same to be the first created tooltip, so this leaks. That there are thousands of tooltip listeners is because every XUL element that is either a tree or has a tooltip or tooltiptext attribute currently has one. However, I'm not sure that's strictly necessary, for instance mSourceNode is always equal to aEvent's currentTarget, and the tooltip listener would simply reset itself to whichever node you last moused over.
Comment 4•17 years ago
|
||
So an easy fix would be to just pass in |nsnull| instead of |this|, no?
Comment 5•17 years ago
|
||
This is a footprint or perf win? Not a blocker, but sounds nice to have. But sounds like there are unresolved issues we'd need fixed (comment 3) before approving a branch patch.
Flags: wanted1.8.1.x+
Flags: blocking1.8.1.4?
Flags: blocking1.8.1.4-
Assignee | ||
Comment 6•17 years ago
|
||
(In reply to comment #3) > (From update of attachment 255984 [details] [diff] [review]) > >+ if (--sTooltipListenerCount == 0) { > >+ // Unregister our pref observer > >+ nsContentUtils::UnregisterPrefCallback("browser.chrome.toolbar_tips", > >+ ToolbarTipsPrefChanged, this); > >+ } > Unfortunately the last destroyed tooltip is unlikely the same to be the first > created tooltip, so this leaks. Good point, passing this in here makes no sense. I do not however believe this is a leak. The pref service doesn't AFAICT hold a strong reference to the closure passed in to a pref callback. Passing in null in these cases seems like the right thing to do, the callback doesn't need the closure at all in either case... Patch coming up.
Assignee | ||
Comment 7•17 years ago
|
||
Attachment #259054 -
Flags: superreview?(neil)
Attachment #259054 -
Flags: review?(neil)
Assignee | ||
Comment 8•17 years ago
|
||
Ok, that does actually leak pref code internals (a CallbackNode struct), but not the argument itself.
Comment 9•17 years ago
|
||
Comment on attachment 259054 [details] [diff] [review] Don't pass |this| as closure as it's not needed and not consistent. Even if it's a weak pointer it's still morally wrong because it will dangle ;-) Why is nsContentUtils still using nsIPref (deprecated)?
Attachment #259054 -
Flags: superreview?(neil)
Attachment #259054 -
Flags: superreview+
Attachment #259054 -
Flags: review?(neil)
Attachment #259054 -
Flags: review+
Assignee | ||
Comment 10•17 years ago
|
||
Because it's old, and noone has bothered to update it :)(In reply to comment #9) > (From update of attachment 259054 [details] [diff] [review]) > Even if it's a weak pointer it's still morally wrong because it will dangle ;-) Agreed :) > Why is nsContentUtils still using nsIPref (deprecated)? Because it's old, and nobody has bothered to update it.
Assignee | ||
Comment 11•17 years ago
|
||
Fix landed on the trunk.
Assignee | ||
Comment 12•17 years ago
|
||
Attachment #259440 -
Flags: superreview+
Attachment #259440 -
Flags: review+
Attachment #259440 -
Flags: approval1.8.1.4?
Attachment #259440 -
Flags: approval1.8.0.12?
Comment 13•17 years ago
|
||
Comment on attachment 259440 [details] [diff] [review] Above two patches merged together (diff against branch). approved for 1.8.0.12/1.8.1.4, a=dveditz for release-drivers
Attachment #259440 -
Flags: approval1.8.1.4?
Attachment #259440 -
Flags: approval1.8.1.4+
Attachment #259440 -
Flags: approval1.8.0.12?
Attachment #259440 -
Flags: approval1.8.0.12+
Updated•17 years ago
|
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
You need to log in
before you can comment on or make changes to this bug.
Description
•