mozilla/pdf.js — pull request #3461 by brendandahl (2013-07-10 23:30:58+00:00)
Title: Incrementally render by sending the operator list by chunks as they're ready.

To make this much easier I stripped out much of uneeded promise code for getting operator lists.

I've created RenderTask/InternalRenderTask to help with rendering that make it much easier to cancel the rendering and resume when more chunks are ready. I don't really like extending the Promise for page.render(), but this way we don't break anyone's code. I've also created an OperatorList class so we have one central one that we can flush as it is built. This also cleans up a lot of code since we had little pseudo operator list objects in a number of places.

Things we should further explore:

- Chunk size - played a bit not sure what's optimal yet.
- Render skipping images if they are ready, then restarting when they are.
- On the main thread empty the operator list as it comes in, instead of appending it. This would help with memory but complicates things if we have multiple renderTasks going at once.