Closed Bug 887394 Opened 7 years ago Closed 7 years ago

[Session Restore] Don't collect state right after startup when restoring the initial session

Categories

(Firefox :: Session Restore, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 25

People

(Reporter: ttaubert, Assigned: ttaubert)

References

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

http://mxr.mozilla.org/mozilla-central/source/browser/components/sessionstore/src/SessionStore.jsm#712

Right after restoring the initial state for the first window loaded after startup, we call .saveState() only to set the session state from STOPPED to RUNNING to count startup crashes correctly.

It would be great to just change the state without writing the whole file but we cannot do that. What we can do is at least not collect the browser state at a point where probably nothing has even finished restoring, yet.
Comment on attachment 767900 [details] [diff] [review]
don't collect state right after startup when restoring the initial session

Review of attachment 767900 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/sessionstore/src/SessionStore.jsm
@@ +714,5 @@
>  
>            // _loadState changed from "stopped" to "running"
>            // force a save operation so that crashes happening during startup are correctly counted
> +          this._initialState.session.state = STATE_RUNNING_STR;
> +          this._saveStateObject(this._initialState);

Do we actually need the call to saveStateObject?

@@ +715,5 @@
>            // _loadState changed from "stopped" to "running"
>            // force a save operation so that crashes happening during startup are correctly counted
> +          this._initialState.session.state = STATE_RUNNING_STR;
> +          this._saveStateObject(this._initialState);
> +          delete this._initialState;

Could we take the opportunity to remove that |delete| and replace it with an assignment? Calling |delete| destroys inline caching.
Attachment #767900 - Flags: review?(dteller) → feedback+
Summary: Don't collect state right after startup when restoring the initial session → [Session Restore] Don't collect state right after startup when restoring the initial session
Comment on attachment 768277 [details] [diff] [review]
don't collect state right after startup when restoring the initial session

Review of attachment 768277 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good.
It might also prove useful for the day saveState becomes async.
Attachment #768277 - Flags: review?(dteller) → review+
https://hg.mozilla.org/mozilla-central/rev/086465524970
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Depends on: 890421
Depends on: 889711
Depends on: 889206
Depends on: 890034
Duplicate of this bug: 891023
Depends on: 919532
You need to log in before you can comment on or make changes to this bug.