Bug 1360788 - Part 1: Move the new tab page update timer to idle dispatch; r=mconley

This commit is contained in:
Ehsan Akhgari 2017-04-29 01:24:21 -04:00
Родитель 66f333029f
Коммит 584faa1af2
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -94,14 +94,14 @@ var gPage = {
return;
}
this._scheduleUpdateTimeout = setTimeout(() => {
this._scheduleUpdateTimeout = requestIdleCallback(() => {
// Refresh if the grid is ready.
if (gGrid.ready) {
gGrid.refresh();
}
this._scheduleUpdateTimeout = null;
}, SCHEDULE_UPDATE_TIMEOUT_MS);
}, {timeout: SCHEDULE_UPDATE_TIMEOUT_MS});
},
/**
@ -221,7 +221,7 @@ var gPage = {
case "visibilitychange":
// Cancel any delayed updates for hidden pages now that we're visible.
if (this._scheduleUpdateTimeout) {
clearTimeout(this._scheduleUpdateTimeout);
cancelIdleCallback(this._scheduleUpdateTimeout);
this._scheduleUpdateTimeout = null;
// An update was pending so force an update now.