Pass SegmentedBuffer to Resource
Currently if a BackgroundResponseProcessor consumed the body data, a SegmentedBuffer is passed to ResourceLoader::DidReceiveResponse() from the background thread without memory copying the body data. But this method is calling DidReceiveData() method for each segments, and Resource::AppendData() method is copying the segments to Resource's `data_` if `data_buffering_policy` is `kBufferData. To avoid this memory copying, this CL changes the argument of Resource::AppendData() from `base::span<const char>` to `absl::variant<SegmentedBuffer, base::span<const char>>`. And ResourceLoader::DidReceiveResponse() will pass the SegmentedBuffer to the Resource. Bug: 342859647 Change-Id: Ia612e46e6ba143ba63dd57f01c5b8ac19b340a11 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5599363 Reviewed-by:Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Tsuyoshi Horo <horo@chromium.org> Cr-Commit-Position: refs/heads/main@{#1313162}
Loading
Please register or sign in to comment