Closed
Bug 509249
Opened 17 years ago
Closed 17 years ago
Fast Startup component
Categories
(Toolkit Graveyard :: XULRunner, defect)
Tracking
(status1.9.2 beta1-fixed, fennec1.0a3-wm+)
RESOLVED
FIXED
mozilla1.9.3a1
| Tracking | Status | |
|---|---|---|
| status1.9.2 | --- | beta1-fixed |
| fennec | 1.0a3-wm+ | --- |
People
(Reporter: vlad, Assigned: crowderbt)
References
Details
(Whiteboard: [nv] [fixed mozilla1.9.2a2 on m-1.9.2])
Attachments
(4 files, 8 obsolete files)
|
16.74 KB,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
|
3.63 KB,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
|
15.85 KB,
patch
|
vlad
:
approval1.9.2+
|
Details | Diff | Splinter Review |
|
2.32 KB,
patch
|
Callek
:
review+
|
Details | Diff | Splinter Review |
When targetting mobile netbook devices, the browser is generally the key app that's on there. While we work on improving startup speed, we can preload most of our code at startup, and then stay resident in memory even if our windows are closed. These devices tend to be suspended rather than shut down, so this should work well.
Here's a first stab at this. It creates a command line component that looks for -faststart, and if it seems it, opens faststart.xul and stops processing further command line args (so as to skip over the default browser handler, which would open the main window).
This also introduces a global windows mutex into the startup path, to ensure that if firefox is already starting up somewhere, we'll wait for it to finish starting up before we try to look for the message window to tell it to open a new browser window. This avoids the "Firefox is running but is unresponsive" profile lock problem if the user tries to open a window very quickly after the device has booted. However, this means the splash screen needs a bit of rework, see below.
One missing piece is to get this into the registry so that fx is launched on first start; that requires the .inf file that the CAB is built from to have:
[RegData] ; registry key list
HKLM,init,Launch98,0x0,%InstallDir%\firefoxstub.exe
HKLM,init,Depend98,0x1,14,00,1e,00,0a,00
The Depend98 line says that we depend on 0x14, 0x1e, 0x0a, which are shell, gwes, and something else (filesystem? can't remember). Since the inf file is generated by a python script, not sure how best to get this in there... but we can do it manually for now. (firefoxstub just runs firefox -faststart -nosplash, but we can't put arguments in the registry entry.)
Bugs/Issues:
- The window opened for faststart.xul is invisible on the desktop (maybe?) but it's a 1x1 pixel dot in the upper left of my netbook. I really just want it to be hidden, but not sure how to make that happen.
- I'm not sure that the XBL hackery is working, need to verify it. If it is, then something else is causing the first real window open to take 5-6 seconds, and each subsequent one to take 1-2. We want 1-2 even on the first one, so would have to look into what else needs to be started and do it from faststart.xul/.js. (One piece that I know of is GLSL shader compilation; this needs to go in a separate bug, but the current ddraw/gles surface unloads the shader compiler after each compilation... we should really compile the common shaders right at the start.)
- The splash screen needs to behave better; in particular, what's desired here is if the user is trying to launch a new firefox window, and launching that window is taking longer than, say, 500ms, we should throw up a splash screen. This patch tries to handle that by seeing if locking the mutex took a bit, since we assume that Fx is starting up then and we'll need to wait for it, but we'll have the same problem during the first window open. The right thing might be to have the splash screen thread do its own timer and open the window by itself if it hasn't been told that startup is finished before it expires.
- Need to figure out the memory impact here; this patch throws out memory pressure notifications after the last window has been closed, but in addition if there's no user activity for some longer amount of time (15 min?) it should restart the stub to ensure that we don't get stuck with a leak or other problem. That part is missing.
| Reporter | ||
Updated•17 years ago
|
Whiteboard: [nv]
| Reporter | ||
Comment 1•17 years ago
|
||
And the patch.
| Reporter | ||
Comment 2•17 years ago
|
||
Updated patch, seems to work decently. Seems to fix the first issue and somewhat the second. However, the first window that's opened takes about 5-6 seconds (future ones are 1-2s), so it would be nice to reopen the splash screen there... but we'd have the reopen it from the already-running process, since we hand things over very early on in init (so if we just used the normal splash screen, it would pop open and then close right away, and then a delay of 5 seconds, then the window.)
Attachment #393391 -
Attachment is obsolete: true
| Assignee | ||
Updated•17 years ago
|
Assignee: nobody → crowder
| Assignee | ||
Comment 4•17 years ago
|
||
This is basically the v1 patch, except that I have moved the files into the toolkit, instead of being browser components, and added a flag to configure to support enabling and disabling this feature at build-time.
The firefoxstub still needs some work, which I will follow-up with shortly.
Attachment #394120 -
Attachment is obsolete: true
| Assignee | ||
Comment 5•17 years ago
|
||
Also, the configure work isn't quite right yet. Still massaging.
Updated•17 years ago
|
Component: General → XULRunner
Product: Firefox → Toolkit
QA Contact: general → xulrunner
Target Milestone: --- → mozilla1.9.2
Version: unspecified → Trunk
Updated•17 years ago
|
tracking-fennec: --- → 1.0a3-wm+
| Assignee | ||
Comment 6•17 years ago
|
||
I cleaned up some whitespace messiness and also made the faststart stub app not use the registry anymore. Instead, based on its own name and location, it looks nearby for the appropriate app to run with the "-nosplash -faststart" arguments. This means that by naming it as <appname>faststart.exe it will run <appname> with the -nosplash -faststart arguments by looking for it in the same working directory. This only works for WinCE, currently (but it really solves a problem we only experience on WinCE). Gonna fire it off at the Try server shortly.
Attachment #395678 -
Attachment is obsolete: true
| Assignee | ||
Comment 7•17 years ago
|
||
The "couldn't figure out how to run the faststart service!" messageboxes should never been shown, and are unlocalizable currently, fwiw.
| Assignee | ||
Comment 8•17 years ago
|
||
This strips out the xul and css, which I think are best handled by the apps themselves, who can load a hidden window or do whatever they need, also, it works! I will create a follow-up bug for doing the Fennec build step of copying the faststartstub.exe file to fennecfaststart.exe to make that magic work.
Attachment #395773 -
Attachment is obsolete: true
| Assignee | ||
Comment 9•17 years ago
|
||
Also fixed the Win32 portability issues in the faststartstub app (which I introduced). I'll run a tryserver build now.
| Assignee | ||
Updated•17 years ago
|
Attachment #395885 -
Flags: review?(ted.mielczarek)
Comment 10•17 years ago
|
||
Comment on attachment 395885 [details] [diff] [review]
just the component, ma'am.
r=me on the build bits. Note that if you want to ship this with Firefox, you'll have to add it to packages-static (#ifdef MOZ_FASTSTART, of course).
Attachment #395885 -
Flags: review?(ted.mielczarek) → review+
| Assignee | ||
Comment 11•17 years ago
|
||
Comment on attachment 395885 [details] [diff] [review]
just the component, ma'am.
I'll let someone else deal w/ the firefox bits, or pick it up myself later.
Attachment #395885 -
Flags: superreview?(benjamin)
Comment 12•17 years ago
|
||
Filed bug 511984 for the Firefox part.
Comment 13•17 years ago
|
||
Comment on attachment 395885 [details] [diff] [review]
just the component, ma'am.
>+++ b/toolkit/components/faststart/FastStartupComponent.js
I'm being a bit pedantic, but drop the "Component" suffix ? "FastStartup.js"
>+const kBrowserURI = "chrome://browser/content/browser.xul";
It would be nice to have this in a pref. In fact we already have "toolkit.defaultChromeURI"
>+ // wait 30s until firing off the memory cleanup, in case the user
>+ // opens another window right away
>+ this._memCleanupTimer = Timer(memoryCleanup, 30000, Ci.nsITimer.TYPE_ONE_SHOT);
this._memCleanupTimer = new Timer(memoryCleanup, 30000, Ci.nsITimer.TYPE_ONE_SHOT);
don't we need a "new" in there?
>+ let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"]
>+ .getService(Components.interfaces.nsIAppStartup);
Use Ci here
>+ // nsIClassInfo
>+ flags: 0,
>+ implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
>+ getHelperForLanguage: function(language) null,
>+ getInterfaces: function(count) {
>+ var interfaces = [Ci.nsICommandLineHandler];
>+ count.value = interfaces.length;
>+ return interfaces;
>+ },
Do you need nsIClassInfo for something?
Just looked at the component
Attachment #395885 -
Flags: review+
| Assignee | ||
Comment 14•17 years ago
|
||
Attachment #395885 -
Attachment is obsolete: true
Attachment #395885 -
Flags: superreview?(benjamin)
| Assignee | ||
Comment 15•17 years ago
|
||
Attachment #395966 -
Attachment is obsolete: true
Comment 16•17 years ago
|
||
The formatting in your file is odd. Toolkit follows the form:
let foo = Cc["@mozilla..."].
getService(Ci...);
In general, see https://developer.mozilla.org/En/Developer_Guide/Coding_Style#Naming_and_Formatting_code
| Assignee | ||
Updated•17 years ago
|
Attachment #395969 -
Flags: review?(gavin.sharp)
| Assignee | ||
Comment 17•17 years ago
|
||
Attachment #395969 -
Attachment is obsolete: true
Attachment #395971 -
Flags: review?(gavin.sharp)
Attachment #395969 -
Flags: review?(gavin.sharp)
Comment 18•17 years ago
|
||
(In reply to comment #16)
> The formatting in your file is odd. Toolkit follows the form:
> let foo = Cc["@mozilla..."].
> getService(Ci...);
>
> In general, see
> https://developer.mozilla.org/En/Developer_Guide/Coding_Style#Naming_and_Formatting_code
I edited that recently based on a bug Dao cited that seems to favor .getService (dot would underhang the C in Cc, though). The bug is based on an accidentally deleted line combined with context-sensitive keywords. But it would bite no matter which line you put the dot on. Hmm.
Anyway, current style guide favored dot on continuation line at the front, and that goes for operators (not logical connectives tho).
/be
Comment 19•17 years ago
|
||
"and that goes for other operators" I meant to write.
/be
Comment 20•17 years ago
|
||
We've been using the style sdwilsh cited fairly consistently since we started using Cc/Ci in 2006 or so. I think Ben started that, actually, and while it's definitely different from previous practice, it seems cleaner, once you get used to it. http://mxr.mozilla.org/mozilla-central/search?string=Cc[ if anyone wants to look. It's definitely a special case, and we still use leading dot when not using the Cc/Ci consts, but I generally think it's better and more readable, and we've been using it for quite a while as prevailing style.
Updated•17 years ago
|
Attachment #395971 -
Flags: review?(gavin.sharp) → review+
Comment 21•17 years ago
|
||
Comment on attachment 395971 [details] [diff] [review]
w/ sdwilsh's whitespace fixes
[Checkin: Comment 24]
couple of general comments:
-bsmedberg should probably approve the addition of the component to toolkit
-should prefer function foo() {} rather than var foo = function() {}
-some tabs crept into that patch
-typo: s/ahs/has/
-would much prefer two-space indentation to match common toolkit style
-probably want to remove (most of?) the dump()s before landing
-kind of odd to set up a prototype but then have the methods use a hardcoded specific instance (gFastStartObserver). how about just defining the methods on a gFastStartObserver object directly and using a property to keep track of whether it's been initialized in handle()?
>diff --git a/toolkit/components/faststart/FastStartup.js b/toolkit/components/faststart/FastStartup.js
>+function getPreferredBrowserURI() {
>+ let chromeURI;
>+ try {
>+ chromeURI = prefs.getCharPref("toolkit.defaultChromeURI");
>+ } catch (e) { }
>+ return chromeURI;
Tab and trailing whitespace crept in here...
Note that this won't work for Firefox, since it doesn't use that pref (uses its own command line handler instead).
>+ scheduleMemoryCleanup: function() {
>+ // Do this 3 times, because of a comment in TestGtkEmbed that says this
>+ // gives the cycle collector the best chance at purging things.
Are you sure this is still necessary? I'm wary of using TestGtkEmbed code as a primary source, especially since AFAICT the cycle collector doesn't respond to that notification (though various other modules do).
>+ handle: function fs_handle(cmdLine) {
>+ // eat -nosplash if we're faststarting
>+ cmdLine.handleFlag("nosplash", false);
Why is this necessary? Won't the only code that checks this have already run by now?
>+ let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"].
>+ getService(Ci.nsIAppStartup);
>+ appstartup.enterLastWindowClosingSurvivalArea();
Might be good to get someone who knows this code better to check this out (bsmedberg, mossop).
>+ // nsIClassInfo
why did you need this?
>diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
>- MOZ_SPLASHSCREEN_UPDATE(10);
Shouldn't you put this somewhere else, then, or adjust the numbers for the others? I guess uneven updating doesn't matter too much.
>+ // check to see if we need to do a splash screen
>+ PRBool wantsSplash = PR_TRUE;
>+ PRBool isNoSplash = PR_FALSE;
>+ PRBool isNoRemote = PR_FALSE;
>+ for (int i = 0; i < argc; i++) {
>+ if (strcmp(argv[i], "-nosplash") == 0)
>+ isNoSplash = PR_TRUE;
>+ else if (strcmp(argv[i], "-no-remote") == 0)
>+ isNoRemote = PR_TRUE;
>+ }
Any reason not to use CheckArg() for these instead?
Could you put most of this new code in a static method? Would make things a bit more readable and avoid a bit of work if nosplash is set.
r=me with those addressed.
Comment 22•17 years ago
|
||
(In reply to comment #20)
> We've been using the style sdwilsh cited fairly consistently since we started
> using Cc/Ci in 2006 or so.
Did you check out the bug cited in the style guide?
/be
| Assignee | ||
Comment 23•17 years ago
|
||
The previous patch has landed, this cleans up some bugs therein, and fixes a stylistic suggestion from gavin on irc.
Attachment #395971 -
Attachment is obsolete: true
Attachment #396048 -
Flags: review?(gavin.sharp)
Updated•17 years ago
|
Attachment #396048 -
Flags: review?(gavin.sharp) → review+
| Assignee | ||
Comment 24•17 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/72cfa869f6d3
http://hg.mozilla.org/mozilla-central/rev/0ad893d220db
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 26•17 years ago
|
||
This includes the two sets from comment #24 and also the build fix contained in bug 512383.
| Assignee | ||
Comment 27•17 years ago
|
||
This includes the patch from bug 512728
Attachment #396737 -
Attachment is obsolete: true
| Assignee | ||
Updated•17 years ago
|
| Assignee | ||
Comment 28•17 years ago
|
||
Comment on attachment 396764 [details] [diff] [review]
newer roll-up
[Checkin: Comment 32]
This includes all of the bugs created by the original patch and is safe to take on 1.9.2 because it has baked on trunk for a few days now and will be disabled on all shipping configurations except for Fennec (which requires this feature on 1.9.2)
Attachment #396764 -
Flags: approval1.9.2?
| Reporter | ||
Updated•17 years ago
|
Attachment #396764 -
Flags: approval1.9.2? → approval1.9.2+
| Assignee | ||
Updated•17 years ago
|
Keywords: fixed1.9.2
Updated•17 years ago
|
status1.9.2:
--- → beta1-fixed
Keywords: fixed1.9.2
| Reporter | ||
Comment 29•17 years ago
|
||
Ugh, so "generalized" apparently meant "broken for firefox" -- my fault, I didn't catch that in the reviews. We need to fall back to browser.chromeURL if it's available and toolkit.defaultChromeURI isn't, with appropriate fixes (possibly fixing chromeURL). Continuing in bug 511984.
Comment 30•16 years ago
|
||
The window opened for faststart.xul is invisible on the desktop (maybe?) but
it's a 1x1 pixel dot in the upper left of my netbook<a href="http://www.lexique-mode.com/">.</a> I really just want it to
be hidden, but not sure how to make that happen.
| Assignee | ||
Comment 31•16 years ago
|
||
The version of this which landed does not include faststart.xul
Updated•16 years ago
|
Whiteboard: [nv] → [nv] [fixed mozilla1.9.2a2 on m-1.9.2]
Target Milestone: mozilla1.9.2 → mozilla1.9.3a1
Comment 32•16 years ago
|
||
Comment on attachment 396764 [details] [diff] [review]
newer roll-up
[Checkin: Comment 32]
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/b808639b8b18
Attachment #396764 -
Attachment description: newer roll-up → newer roll-up
[Checkin: Comment 32]
Updated•16 years ago
|
Attachment #396048 -
Attachment description: better component → better component
[Checkin: See comment 24]
Updated•16 years ago
|
Attachment #395971 -
Attachment description: w/ sdwilsh's whitespace fixes. → w/ sdwilsh's whitespace fixes
[Checkin: Comment 24]
Attachment #395971 -
Attachment is obsolete: false
Comment 33•16 years ago
|
||
Attachment #428629 -
Flags: review?(bugspam.Callek)
Updated•16 years ago
|
Attachment #428629 -
Flags: review?(bugspam.Callek) → review+
Comment 34•16 years ago
|
||
Comment on attachment 428629 [details] [diff] [review]
(Dv1-CC) Copy (the useful part of) it to comm-central
[Checkin: Comment 34]
http://hg.mozilla.org/comm-central/rev/a624c40f8917
Attachment #428629 -
Attachment description: (Dv1-CC) Copy (the useful part of) it to comm-central → (Dv1-CC) Copy (the useful part of) it to comm-central
[Checkin: Comment 34]
Updated•16 years ago
|
Blocks: C192ConfSync
Updated•10 years ago
|
Product: Toolkit → Toolkit Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•