Commit 4ff885a1 authored by Arthur Sonzogni's avatar Arthur Sonzogni Committed by Commit Bot

BlobUrlLoader: Instrument for bug 882661.

In bug 882661: one mojo::URLLoader is sending OnStartLoadingResponseBody
without sending OnReceiveResponse before.

Add instrumentation to check this never happen with this class.

Bug: 882661
Change-Id: Ia9df5debbc03f0a5296c64edbcf6d975806bc021
Reviewed-on: https://chromium-review.googlesource.com/c/1304435Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605181}
parent d3b77826
......@@ -133,6 +133,7 @@ void BlobURLLoader::DidReadSideData(net::IOBufferWithSize* data) {
void BlobURLLoader::DidRead(int num_bytes) {
if (response_body_consumer_handle_.is_valid()) {
// Send the data pipe on the first OnReadCompleted call.
CHECK(on_receive_response_sent_);
client_->OnStartLoadingResponseBody(
std::move(response_body_consumer_handle_));
}
......@@ -165,7 +166,7 @@ void BlobURLLoader::HeadersCompleted(net::HttpStatusCode status_code,
// TODO(jam): some of this code can be shared with
// services/network/url_loader.h
client_->OnReceiveResponse(response);
sent_headers_ = true;
on_receive_response_sent_ = true;
if (metadata) {
const uint8_t* data = reinterpret_cast<const uint8_t*>(metadata->data());
......
......@@ -68,11 +68,13 @@ class STORAGE_EXPORT BlobURLLoader : public storage::MojoBlobReader::Delegate,
net::HttpByteRange byte_range_;
uint64_t total_size_ = 0;
bool sent_headers_ = false;
std::unique_ptr<BlobDataHandle> blob_handle_;
mojo::ScopedDataPipeConsumerHandle response_body_consumer_handle_;
// TODO(https://crbug.com/882661): Remove this as soon as the bug is fixed.
bool on_receive_response_sent_ = false;
base::WeakPtrFactory<BlobURLLoader> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(BlobURLLoader);
......
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