GS Cache: Stream multiple responses content as JSON

When extract files, we stream the result content in JSON. There's no
problem when files number is limited. However, when extracting many
files, say > 700, we have to split the requests into sub-requests. We
have to consolidate all response together and stream all of them into
*one* JSON stream.

This change refactor the old iter_content_as_json function to a class
which add queue the response multiple times. Finally, we call `stream`
to stream all responses in JSON.

BUG=chromium:824580
TEST=Ran unit tests.

Change-Id: Ib1ab2f7ed2437c5c5f62412e2b9e92e18af413a3
Reviewed-on: https://chromium-review.googlesource.com/1105482
Commit-Ready: Congbin Guo <guocb@chromium.org>
Tested-by: Congbin Guo <guocb@chromium.org>
Reviewed-by: Congbin Guo <guocb@chromium.org>
2 files changed