only populate DownloadHistoryData for inprogress download
When download history is not fully loaded, onDownloadCreated() can get called by downloads already created by the DownloadManager. And DownloadHistory will call set_info() to attach DownloadRow to the download item regardless of its state. However, this is not needed for non in-progress download. For non in-progress downloads, if set_info() is called, a later DownloadHistory::OnDownloadUpdated() call could still result in clear_info() gets called before DownloadHistory::ItemAdded(). So the assumption in the comments may not hold. This CL also removes the call to OnDownloadUpdated() in ItemAdded(). OnDownloadUpdated() can be called any time before ItemAdded(), and it will queue a sql update to the history db. So there is no need to call OnDownloadUpdated after ItemAdded(). This CL also exposes and fixes a bug in DownloadHistoryTest BUG=842245 Change-Id: I8d6da374671fa0e56d0c2eb57577ce5726812b3e Reviewed-on: https://chromium-review.googlesource.com/c/1294072Reviewed-by:Xing Liu <xingliu@chromium.org> Commit-Queue: Min Qin <qinmin@chromium.org> Cr-Commit-Position: refs/heads/master@{#601778}
Showing
Please register or sign in to comment