Skip to content

Commit

Permalink
URLLoaderClientImpl stores OnTransferSizeUpdated() properly
Browse files Browse the repository at this point in the history
This CL fixes URLLoaderClientImpl::NeedsStoringMessage() by taking
|accumulated_transfer_size_diff_during_deferred_| into consideration. I hope
this fix crashes around NotifyResourceTransferSizeUpdated() when
ResourceLoadViaDataPipe is on.

Test: ./third_party/blink/tools/run_web_tests.py -t Debug -f external/wpt/webvtt/parsing/file-parsing/tests/header-regions.html --iteration=100
Bug: 926849, 894819, 927184
Change-Id: If5da458dd9eba29c0b47b458a5a09f90b3646b38
Reviewed-on: https://chromium-review.googlesource.com/c/1454344
Commit-Queue: Makoto Shimazu <[email protected]>
Commit-Queue: Yutaka Hirano <[email protected]>
Auto-Submit: Makoto Shimazu <[email protected]>
Reviewed-by: Yutaka Hirano <[email protected]>
Cr-Commit-Position: refs/heads/master@{#629070}
  • Loading branch information
makotoshimazu authored and Commit Bot committed Feb 5, 2019
1 parent 1fe00a4 commit 474920f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions content/renderer/loader/url_loader_client_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,17 @@ void URLLoaderClientImpl::OnComplete(
}

bool URLLoaderClientImpl::NeedsStoringMessage() const {
return is_deferred_ || deferred_messages_.size() > 0;
return is_deferred_ || deferred_messages_.size() > 0 ||
accumulated_transfer_size_diff_during_deferred_ > 0;
}

void URLLoaderClientImpl::StoreAndDispatch(
std::unique_ptr<DeferredMessage> message) {
DCHECK(NeedsStoringMessage());
if (is_deferred_) {
deferred_messages_.push_back(std::move(message));
} else if (deferred_messages_.size() > 0) {
} else if (deferred_messages_.size() > 0 ||
accumulated_transfer_size_diff_during_deferred_ > 0) {
deferred_messages_.push_back(std::move(message));
FlushDeferredMessages();
} else {
Expand Down

0 comments on commit 474920f

Please sign in to comment.