| OLD | NEW |
| (Empty) | |
| 1 The network stack implements support for Content-Encodings using |
| 2 "source streams", which can be composed together and mutate all the incoming |
| 3 bytes from a URLRequestJob. Currently, the following streams are implemented: |
| 4 |
| 5 * gzip (handling "deflate" and "gzip" Content-Encodings) |
| 6 * sdch (handling "sdch" Content-Encoding) |
| 7 * brotli (handling "br" Content-Encoding) |
| 8 |
| 9 Source streams conceptually form a chain, with the URLRequestJob as both the |
| 10 beginning and end of the chain, meaning the URLRequestJob produces raw bytes at |
| 11 the end and consumes unencoded bytes at the beginning. For example, to support a |
| 12 hypothetical "Content-Encoding: bar,foo", streams would be arranged like so, |
| 13 with "X <-- Y" meaning "data flows from Y to X", "X reads data from Y", or |
| 14 "X is downstream from Y". |
| 15 |
| 16 URLRequestJob <-- BarSourceStream <-- FooSourceStream <-- URLRequestJob |
| 17 (URLRequestSourceStream) |
| 18 |
| 19 Here URLRequestJob pulls filtered bytes from its upstream, BarSourceStream, |
| 20 which pulls filtered bytes from FooSourceStream, which in turn pulls raw bytes |
| 21 from URLRequestJob. URLRequestSourceStream is the ultimate upstream, which |
| 22 produces the raw data. Every stream in the chain owns its upstream. In this |
| 23 case, the ultimate downstream, URLRequestJob, owns its upstream, |
| 24 BarSourceStream, which in turn owns FooSourceStream. FooSourceStream owns its |
| 25 upstream, URLRequestSourceStream. |
| 26 |
| 27 All source streams conform to the following interface (named SourceStream in the |
| 28 tree): |
| 29 |
| 30 int Read(IOBuffer* dest_buffer, size_t buffer_size, |
| 31 const OnReadCompleteCallback& callback); |
| 32 |
| 33 This function can return either synchronously or asynchronously via the supplied |
| 34 callback. The source stream chain is "pull-based", in that data does not |
| 35 propagate through the chain until requested by the final consumer of the |
| 36 filtered data. |
| OLD | NEW |