resize(newSize, idsToKeep = null) {
    this.#size = newSize;

    const buf = this.#buf;
    if (idsToKeep) {
      const ii = buf.size;
      let i = 1;
      for (const view of buf) {
        if (idsToKeep.has(view.id)) {
          buf.delete(view); // Move the view to the "end" of the buffer.
          buf.add(view);
        }
        if (++i > ii) {
          break;
        }
      }
    }

    while (buf.size > this.#size) {
      this.#destroyFirstView();
    }
  }
After calling resize, the size of the buffer will be `newSize`.
The optional parameter `idsToKeep` is, if present, a Set of page-ids to
push to the back of the buffer, delaying their destruction. The size of
`idsToKeep` has no impact on the final size of the buffer; if `idsToKeep`
is larger than `newSize`, some of those pages will be destroyed anyway.