Skip to content

Commit

Permalink
Remove the deferred functions queue
Browse files Browse the repository at this point in the history
  • Loading branch information
bmschmidt committed Sep 9, 2024
1 parent 6493407 commit 3f1e0d5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
21 changes: 0 additions & 21 deletions src/regl_rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ export class ReglRenderer extends Renderer {
tile._buffer_manager || new TileBufferManager(this.regl, tile, this);

if (!tile._buffer_manager.ready()) {
// The 'ready' call also pushes a creation request into
// the deferred_functions queue.
continue;
}
const this_props = {
Expand Down Expand Up @@ -296,25 +294,6 @@ export class ReglRenderer extends Renderer {

const start = Date.now();

async function pop_deferred_functions(
deferred_functions: (() => void | Promise<void>)[],
) {
while (Date.now() - start < 10 && deferred_functions.length > 0) {
// Keep popping deferred functions off the queue until we've spent 10 milliseconds doing it.
const current = deferred_functions.shift();
if (current === undefined) {
continue;
}
try {
await current();
} catch (error) {
console.warn(error, current);
}
}
}
// Run 10 ms of deferred functions.
void pop_deferred_functions(this.deferred_functions);

try {
this.render_all(props);
} catch (error) {
Expand Down
3 changes: 0 additions & 3 deletions src/rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ export class Renderer {
public deeptable: Deeptable;
public width: number;
public height: number;
// The renderer handles periodic dispatches of calls
public deferred_functions: Array<() => Promise<void> | void>;
public _use_scale_to_download_tiles = true;
public aes?: AestheticSet;
public _zoom?: Zoom;
Expand All @@ -142,7 +140,6 @@ export class Renderer {
).node() as HTMLCanvasElement;
this.width = +select(this.canvas).attr('width');
this.height = +select(this.canvas).attr('height');
this.deferred_functions = [];
this._use_scale_to_download_tiles = true;
}

Expand Down

0 comments on commit 3f1e0d5

Please sign in to comment.