Closed Bug 961603 Opened 10 years ago Closed 10 years ago

[Session Restore] Split SessionFile._writeState across several ticks

Categories

(Firefox :: Session Restore, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Yoric, Unassigned)

References

Details

(Whiteboard: [Async:ready])

At the moment, SessionSaver._writeState does the following:
1. serialize |state| to JSON;
2. notify observers;
3. call SessionFile.write(state).

Operations 1., 2. and 3. can be slow. It would, however, considerably alleviate the issue if we could execute them in different ticks.
Marking this as a mentored bug.
The code lives here: http://dxr.mozilla.org/mozilla-central/source/browser/components/sessionstore/src/SessionSaver.jsm#288

This will require calling Services.tm.dispatch (http://dxr.mozilla.org/mozilla-central/source/xpcom/threads/nsIEventTarget.idl#30) to delay execution to the next tick and playing a little with Task.jsm and promise.
Whiteboard: [Async:ready][mentor=Yoric][lang=js][mentored but not simple]
Summary: [Session Restore] Split _writeState across several ticks → [Session Restore] Split SessionFile._writeState across several ticks
Do we have any data that tells us this is a thing we should do? Why not bring bug 944557 forward or add a telemetry measurement before doing this micro-optimization?

It seems like this will complicate enough code to become awkward. For SessionSaver.run() writes wouldn't be dispatched synchronously anymore which could lead to dataloss if AsyncShutdown doesn't know there is a pending write.
Ok, let's wait for Telemetry.
Whiteboard: [Async:ready][mentor=Yoric][lang=js][mentored but not simple] → [Async:ready]
Indeed, looking at Telemetry, this doesn't look too useful.
Replaced by the almost equivalent but much more useful bug 984886.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.