prepareChapter
Lays out chapter if it is not ready yet. The one expensive call.
Blocks until the chapter is ready. Safe to call from any thread and from several at once: callers for the same chapter wait for one layout rather than repeating it. Out-of-range chapters are ignored.
prepareChapter, with checkpoint called between two steps of the layout, so that a caller on a thread that must keep drawing frames, as in a browser, can suspend there and go on after a frame. A document that lays a chapter out in steps calls it; by default the chapter is prepared at once. No lock is held across a checkpoint, so two callers for one chapter may each lay it out, and the first to finish keeps its pages. A wrapper that overrides prepareChapter should override this one too: by delegation sends it straight to the wrapped document.