зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1064132 - Listen for wake_notification to evaluate whether to sync. r=markh
This commit is contained in:
Родитель
bbc795a223
Коммит
fc94bb9f69
|
@ -97,6 +97,7 @@ SyncScheduler.prototype = {
|
||||||
Svc.Obs.add("FxA:hawk:backoff:interval", this);
|
Svc.Obs.add("FxA:hawk:backoff:interval", this);
|
||||||
|
|
||||||
if (Status.checkSetup() == STATUS_OK) {
|
if (Status.checkSetup() == STATUS_OK) {
|
||||||
|
Svc.Obs.add("wake_notification", this);
|
||||||
Svc.Idle.addIdleObserver(this, Svc.Prefs.get("scheduler.idleTime"));
|
Svc.Idle.addIdleObserver(this, Svc.Prefs.get("scheduler.idleTime"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -213,6 +214,7 @@ SyncScheduler.prototype = {
|
||||||
case "weave:service:setup-complete":
|
case "weave:service:setup-complete":
|
||||||
Services.prefs.savePrefFile(null);
|
Services.prefs.savePrefFile(null);
|
||||||
Svc.Idle.addIdleObserver(this, Svc.Prefs.get("scheduler.idleTime"));
|
Svc.Idle.addIdleObserver(this, Svc.Prefs.get("scheduler.idleTime"));
|
||||||
|
Svc.Obs.add("wake_notification", this);
|
||||||
break;
|
break;
|
||||||
case "weave:service:start-over":
|
case "weave:service:start-over":
|
||||||
this.setDefaults();
|
this.setDefaults();
|
||||||
|
@ -248,6 +250,16 @@ SyncScheduler.prototype = {
|
||||||
}
|
}
|
||||||
}, IDLE_OBSERVER_BACK_DELAY, this, "idleDebouncerTimer");
|
}, IDLE_OBSERVER_BACK_DELAY, this, "idleDebouncerTimer");
|
||||||
break;
|
break;
|
||||||
|
case "wake_notification":
|
||||||
|
this._log.debug("Woke from sleep.");
|
||||||
|
Utils.nextTick(() => {
|
||||||
|
// Trigger a sync if we have multiple clients.
|
||||||
|
if (this.numClients > 1) {
|
||||||
|
this._log.debug("More than 1 client. Syncing.");
|
||||||
|
this.scheduleNextSync(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче