Closed
Bug 584866
Opened 16 years ago
Closed 15 years ago
Cache LoadFrameScript Calls
Categories
(Core :: IPC, defect)
Core
IPC
Tracking
()
RESOLVED
FIXED
People
(Reporter: azakai, Assigned: smaug)
References
Details
Attachments
(4 files, 1 obsolete file)
|
23.56 KB,
patch
|
Details | Diff | Splinter Review | |
|
3.04 KB,
patch
|
Details | Diff | Splinter Review | |
|
15.11 KB,
patch
|
jst
:
review+
azakai
:
feedback+
|
Details | Diff | Splinter Review |
|
15.22 KB,
patch
|
Details | Diff | Splinter Review |
LoadFrameScript creates a channel and compiles the JavaScript it loads from that channel; both operations can be noticeably slow (see discussion in bug 550936).
We should cache the results here, so after we load&compile a script once, later times can use that compiled code.
| Assignee | ||
Updated•16 years ago
|
Assignee: nobody → Olli.Pettay
| Reporter | ||
Comment 1•15 years ago
|
||
This is needed for bug 550936, which is blocking2.0 beta4+ and blocking-fennec
2.0a1+.
blocking2.0: --- → ?
tracking-fennec: --- → ?
Updated•15 years ago
|
tracking-fennec: ? → 2.0a1+
| Assignee | ||
Comment 2•15 years ago
|
||
This needs more testing, but passes some very simple tests without leaking
when closing the browser.
| Reporter | ||
Comment 3•15 years ago
|
||
Tested a bit, doesn't seem to crash or leak.
I'm not sure how to test this with caching enabled, though - the current patch appears to have it disabled (scripts are still compiled once per new window). I'm not sure where to change the patch to enable caching in a simple way.
Why do we even need this as an option, btw - why not always cache scripts?
| Assignee | ||
Comment 4•15 years ago
|
||
Scripts are compiled only first time and released when there are no
in-process message managers. So I guess in your txul test we might actually
compile the script for each window and release the script when the window closes.
I guess I need to use the safe JSContext to release the scripts, not the last
alive message manager context.
We do need the option not-cache, because I want that sending
data: urls works, and we probably don't usually want to cache those.
| Assignee | ||
Comment 5•15 years ago
|
||
Alon, could you try this one.
With this the cached scripts are cleared during shutdown, not when the
last frame message manager is deleted.
And when testing, just use the 3rd parameter of loadFrameScript.
Attachment #463705 -
Attachment is obsolete: true
| Reporter | ||
Comment 6•15 years ago
|
||
Tested, works very well.
Only suggestion I have is to make the default to cache scripts, so we don't need to go around changing all the places that call loadFrameScript. Or maybe just not cache |data:| urls, and cache all the rest?
| Reporter | ||
Comment 7•15 years ago
|
||
Hmm, on the try server there are some oranges about "nsBaseHashtable was not initialized properly" and some leaks about hash tables as well. Perhaps to do with the static hashtable?
| Reporter | ||
Comment 8•15 years ago
|
||
Seems to fix the hashtable errors in the patch.
| Assignee | ||
Comment 9•15 years ago
|
||
Ok, perhaps for now not caching data: and cache everything else is
good enough.
| Assignee | ||
Comment 10•15 years ago
|
||
If this is ok to you Alon, I'll ask review from jst or someone.
Attachment #463902 -
Flags: feedback?(azakai)
| Reporter | ||
Comment 11•15 years ago
|
||
Comment on attachment 463902 [details] [diff] [review]
patch
Looks great.
Attachment #463902 -
Flags: feedback?(azakai) → feedback+
| Reporter | ||
Updated•15 years ago
|
Attachment #463902 -
Flags: review?(jst)
| Assignee | ||
Comment 12•15 years ago
|
||
Jst, this is the non-e10s patch.
I'll fix e10s (content process) in a separate bug, but it will
also use nsFrameScriptExecutor.
Comment 13•15 years ago
|
||
Comment on attachment 463902 [details] [diff] [review]
patch
+static PLDHashOperator
+EnumerateCachedScripts(const nsAString& aKey,
+ nsFrameScriptExecutorJSObjectHolder*& aData,
+ void* aUserArg)
+{
+ JSContext* cx = static_cast<JSContext*>(aUserArg);
+ JS_RemoveObjectRoot(cx, &(aData->mObject));
How about we rename this function to CachedScriptUnrooter() or something, since that's what it does.
r=jst
Attachment #463902 -
Flags: review?(jst) → review+
Comment 14•15 years ago
|
||
This patch has jst's rename. I'll land it.
Comment 15•15 years ago
|
||
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
| Reporter | ||
Comment 16•15 years ago
|
||
(In reply to comment #12)
> this is the non-e10s patch.
> I'll fix e10s (content process) in a separate bug, but it will
> also use nsFrameScriptExecutor.
Posted followup bug 586115.
Updated•15 years ago
|
blocking2.0: ? → final+
You need to log in
before you can comment on or make changes to this bug.
Description
•