Closed
Bug 1463908
Opened 7 years ago
Closed 7 years ago
tooltip text provider uses about 20KB of memory per-process
Categories
(Firefox :: General, enhancement)
Firefox
General
Tracking
()
RESOLVED
FIXED
Firefox 62
Tracking | Status | |
---|---|---|
firefox62 | --- | fixed |
People
(Reporter: bzbarsky, Assigned: Felipe)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fxperf:p1])
Attachments
(1 file)
It's not a huge thing, but we have a JS-implemented default tooltip text provider and instantiating that service (which we do in all content processes via the ChromeTooltipListener) costs about 20KB of RAM.
Assignee | ||
Comment 2•7 years ago
|
||
From what I found, the default tooltip provider is something that is needed in content processes, as it's responsible for providing tooltips for a lot of things (e.g., <input file>), etc.
However, it shouldn't need to be instantiated until getNodeText is called, from sTooltipCallback.
There are three options that we could do to reduce this memory overhead:
A) Rewrite the default tooltip provider in C++ so it doesn't have a per-process memory cost
B) Lazily instantiate the ChromeTooltipListener
C) Lazily instantiate the default tooltip provider
Option C) is super easy (as it is instantiated in the ChromeTooltipListener constructor, but it could be only when sTooltipCallback is called), and it should be more than enough to make this no longer an issue, so I'm gonna go with it as it's the simplest one.
Assignee: nobody → felipc
Status: NEW → ASSIGNED
Flags: needinfo?(felipc)
Comment hidden (mozreview-request) |
Assignee | ||
Comment 4•7 years ago
|
||
Two things: I initially wrote this just returning a raw pointer, but I wasn't sure if it was certain that the object could be gone by the time this is called.. Thinking more about it, I think it would be ok
There's a change in behavior in that, if the do_getService calls fail, it will keep retrying now.. I believe it doesn't matter for Firefox, but let me know if I should keep the old behavior
Reporter | ||
Comment 5•7 years ago
|
||
mozreview-review |
Comment on attachment 8981300 [details]
Bug 1463908 - Lazily instatiate the tooltip text provider.
https://reviewboard.mozilla.org/r/247406/#review254156
::: docshell/base/nsDocShellTreeOwner.h:172
(Diff revision 1)
> NS_IMETHOD HideTooltip();
>
> nsWebBrowser* mWebBrowser;
> nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;
> nsCOMPtr<nsITooltipTextProvider> mTooltipTextProvider;
> + already_AddRefed<nsITooltipTextProvider> GetTooltipTextProvider();
Please put the methe next to the other methods, before the data members start.
::: docshell/base/nsDocShellTreeOwner.cpp:1063
(Diff revision 1)
> mTooltipTextProvider = do_GetService(NS_DEFAULTTOOLTIPTEXTPROVIDER_CONTRACTID);
> }
> -}
>
> -ChromeTooltipListener::~ChromeTooltipListener()
> -{
> + nsCOMPtr<nsITooltipTextProvider> provider = mTooltipTextProvider;
> + return provider.forget();
Could also just return mTooltipTextProvider and change the return type to nsITooltipTextProvider*.
Attachment #8981300 -
Flags: review?(bzbarsky) → review+
Comment hidden (mozreview-request) |
Pushed by felipc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/53732e14e552
Lazily instatiate the tooltip text provider. r=bz
Assignee | ||
Updated•7 years ago
|
Whiteboard: [fxperf:p1]
Comment 8•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox62:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 62
You need to log in
before you can comment on or make changes to this bug.
Description
•