mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
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:
parent
80178f8d4d
commit
ed1a6e6084
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user