Bug 1391707: Part 2 - Use idle dispatch in DeferredSave. r=florian

MozReview-Commit-ID: Fffz9Qgom52

--HG--
extra : rebase_source : acf72f72463135a06a0b461876213f68292050a5
This commit is contained in:
Kris Maglione 2017-09-01 14:58:34 -07:00
parent 80178f8d4d
commit ed1a6e6084

View File

@ -188,7 +188,7 @@ this.DeferredSave.prototype = {
this.logger.debug("Starting timer");
if (!this._timer)
this._timer = MakeTimer();
this._timer.initWithCallback(() => this._deferredSave(),
this._timer.initWithCallback(() => this._timerCallback(),
this._delay, Ci.nsITimer.TYPE_ONE_SHOT);
},
@ -212,6 +212,10 @@ this.DeferredSave.prototype = {
return this._pending.promise;
},
_timerCallback() {
Services.tm.idleDispatchToMainThread(() => this._deferredSave());
},
_deferredSave() {
let pending = this._pending;
this._pending = null;