Skip to content

Commit 05843e8

Browse files
Chris LordCwiiis
authored andcommitted
Allow tile transaction callbacks to call immediately
Previously we waited for all tile transactions to finish before calling all the callbacks at once, but this is no longer necessary. Signed-off-by: Chris Lord <chris.lord@collabora.com> Change-Id: Id81076e5740ca2add69b7c40788248e797c81d00
1 parent 04a3b12 commit 05843e8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

browser/src/app/TilesMiddleware.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,19 @@ class TileManager {
412412
if (!tile.hasPendingUpdate()) this.tileReady(tile.coords, visibleRanges);
413413
}
414414

415-
if (this.pendingTransactions === 0)
415+
if (this.pendingTransactions <= 0)
416416
window.app.console.warn('Unexpectedly received decompressed deltas');
417-
else --this.pendingTransactions;
417+
else {
418+
--this.pendingTransactions;
419+
var callback = this.transactionCallbacks.pop();
420+
if (callback) callback();
418421

419-
if (!this.hasPendingTransactions()) {
420-
while (this.transactionCallbacks.length) {
421-
var callback = this.transactionCallbacks.pop();
422-
if (callback) callback();
422+
if (this.pendingTransactions === 0 && this.transactionCallbacks.length) {
423+
window.app.console.warn('Transaction callback mismatch');
424+
while (this.transactionCallbacks.length) {
425+
var callback = this.transactionCallbacks.pop();
426+
if (callback) callback();
427+
}
423428
}
424429
}
425430

0 commit comments

Comments
 (0)