Skip to content

Commit

Permalink
Download: Check DownloadDriver guid before starting download.
Browse files Browse the repository at this point in the history
Check whether core download system already has a guid through
DownloadDriver right before staring a download in the same function
scope.

Currently if core download system doesn't have guid, we first try to
get upload data in an asynchronous callback, then use a DCHECK to
ensure core download still doesn't have this guid. This is not
reliable.

Bug: 1303354
Change-Id: I5fd12ebf31541fe5c57c7265022954d0ecbbcfd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3511085
Reviewed-by: Min Qin <qinmin@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#979277}
  • Loading branch information
Xing Liu authored and Chromium LUCI CQ committed Mar 9, 2022
1 parent 21a0a75 commit 9b811de
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,12 @@ void ControllerImpl::OnDownloadReadyToStart(
return;
}

DCHECK(!driver_->Find(guid).has_value());
auto driver_entry = driver_->Find(guid);
if (driver_entry.has_value()) {
DVLOG(1) << "Download already exists.";
return;
}

driver_->Start(entry->request_params, entry->guid, entry->target_file_path,
post_body,
net::NetworkTrafficAnnotationTag(entry->traffic_annotation));
Expand Down

0 comments on commit 9b811de

Please sign in to comment.