()
| 354 | } |
| 355 | |
| 356 | #tryTrimBuffer() { |
| 357 | if (this.#cachedMinCursorConsumers === 0) { |
| 358 | this.#recomputeMinCursor(); |
| 359 | } |
| 360 | const trimCount = this.#cachedMinCursor - this.#bufferStart; |
| 361 | if (trimCount > 0) { |
| 362 | this.#buffer.trimFront(trimCount); |
| 363 | this.#bufferStart = this.#cachedMinCursor; |
| 364 | for (let i = 0; i < this.#pullWaiters.length; i++) { |
| 365 | this.#pullWaiters[i](); |
| 366 | } |
| 367 | this.#pullWaiters = []; |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | #recomputeMinCursor() { |
| 372 | const { minCursor, minCursorConsumers } = getMinCursor( |