0

Download: Stop sending updates when paused

When a download is paused, should stop the update timer, which posts UI
tasks to report progress to download item every kUpdatePeriodMs (500).
This is meaningleass since download is paused already.

BUG=1212928
R=qinmin@chromium.org, xingliu@chromium.org

Change-Id: I8d096ef1db158212c90c7dbcdb3b1d2653da6600
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2879640
Reviewed-by: Min Qin <qinmin@chromium.org>
Reviewed-by: Xing Liu <xingliu@chromium.org>
Commit-Queue: Min Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#902078}
This commit is contained in:
yangxiaobing
2021-07-15 19:38:24 +00:00
committed by Chromium LUCI CQ
parent e2d6962ead
commit 709be7ec29
2 changed files with 5 additions and 0 deletions
AUTHORS
components/download/internal/common

@ -1155,6 +1155,7 @@ Winston Chen <winston.c1@samsung.com>
Xiang Long <xiang.long@intel.com>
XiangYang <yangxiang12@huawei.com>
Xiangze Zhang <xiangze.zhang@intel.com>
Xiaobing Yang <yangxiaobing@qianxin.com>
Xiaofeng Zhang <xiaofeng.zhang@intel.com>
Xiaolei Yu <dreifachstein@gmail.com>
Xiaoshu Zhang <xiaoshu@amazon.com>

@ -548,6 +548,10 @@ void DownloadFileImpl::Pause() {
record_stream_bandwidth_ = false;
for (auto& stream : source_streams_)
stream.second->ClearDataReadyCallback();
// Stop sending updates since meaningless after paused.
if (update_timer_ && update_timer_->IsRunning())
update_timer_->Stop();
}
void DownloadFileImpl::Resume() {