Always update buffer and send signal when ReadChunk is done.

There is a chance that VolumeReaderJavaScriptStream::Read() waits a response of
ReadChunk forever.
The problematic scenario is illustrated in
https://bugs.chromium.org/p/chromium/issues/detail?id=457448#c28

VolumeReaderJavaScriptStream can request ReadChunk without a client's request to
read ahead.
It expects a response through VolumeReaderJavaScriptStream::SetBufferAndSignal,
but a response can be ignored in Volume::Volume::ReadChunkDone() if the file for
previous Read request is already closed. This can cause Read() to be hanged.

Considering the case of reading ahead (without explicit Read requests from
client), I think we should always set buffer and signal
VolumeReaderJavaScriptStream when ReadChunk is done.

scrolling randomly.

Bug: 457448
Test: Open a zip file which contains 1000 photos, and browse photos by
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Iade702bf06042d9687f0a5793833d2486a3d761a
Reviewed-on: https://chromium-review.googlesource.com/784692
Reviewed-by: Tatsuhisa Yamaguchi <yamaguchi@chromium.org>
Reviewed-by: Tomasz Mikolajewski <mtomasz@chromium.org>
Commit-Queue: Naoki Fukino <fukino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518576}
1 file changed