Commit c26ff44a authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

Blob: Call callback with an empty vector when the size of side data is zero

disk_cache::Entry::GetDataSize() can return zero. If the size of
side data is zero, it doesn't make sense to try to read side data.
Call ReadSideDataCallback with an empty vector when the size is zero.
I don't expect this improves performance in general though.

Change-Id: I07237a1b41a4b95349a430806122270084f8b55d
Reviewed-on: https://chromium-review.googlesource.com/c/1307029Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605286}
parent e88769e4
......@@ -151,6 +151,10 @@ void BlobImpl::ReadSideData(ReadSideDataCallback callback) {
}
int32_t body_size =
entry->GetDataSize(item->disk_cache_side_stream_index());
if (body_size == 0) {
std::move(callback).Run(std::vector<uint8_t>());
return;
}
auto io_buffer = base::MakeRefCounted<net::IOBufferWithSize>(body_size);
auto io_callback = base::AdaptCallbackForRepeating(base::BindOnce(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment