Finalize a throttled FileReader in stages.

File read operations are throttled, a controller keeping track of a
set of running readers, and those waiting for a turn. In the case of a
running FileReader just completing its operation and an onload* event
listener issuing a new read operation over the same reader, the
throttling controller must correctly handle the renewal of that
FileReader as a running (or now-pending) reader.

This includes signalling that there's pending activity starting (and
later on, completing) on the FileReader itself, something that wasn't
correctly in this nested case.

To address, a FileReader will now remove itself from its throttling
controller in two stages:

  - once the readyState transitions from LOADING, the FileReader is
    removed as a running reader.

  - once the FileReader has dispatched all the required events, the
    FileReader itself signals that the pending activity has completed.

In combination, this balances the reference counting on the underlying
object.

R=kinuko@chromium.org
BUG=345608

Review URL: https://codereview.chromium.org/174963002

git-svn-id: svn://svn.chromium.org/blink/trunk@167706 bbb929c8-8fbe-4397-9dbb-9b2b20218538
1 file changed
tree: 1e750e23a67cb1e25317823007f87b9f86809269
  1. third_party/