• Antonio Gomes's avatar
    Migrate components/update_client/url_fetcher_downloader.cc · 0807dd6f
    Antonio Gomes authored
    URLFetcher will stop working with advent of Network Service, and
    SimpleURLLoader is the replacement API for most clients.
    This CL migrates UrlFetcherDownloader away from URLFetcher.
    
    Note that UrlFetcherDownloader makes use of URLFetcher's "progress
    update" hook, in order to track fetch progresses. It turns out the
    progress values were not being used in production at all:
    
    UrlFetcherDownloader::OnURLFetchDownloadProgress used to instantiate
    a CrxDownloader::Result object, and pass it all the way to
    Component::StateDownloadingDiff::DownloadComplete and
    Component::StateDownloading::DownloadComplete. There, |result|
    parameter was being ignored in both methods.
    
    Given SimpleURLLoader's lack of ability to hook to a progress update
    callback at the time of doing this migration, and that the progress values
    were not being used in production code anyways, this CL replaces
    URLFetcher's progress upload hook by SimpleURLLoader's "response started"
    hook, to indicate that the load has been triggered, and update
    Component's status accordingly.
    
    Hence, references to |CrxDownloader::Result::downloaded_bytes| and
    |CrxDownloader::Result::total_bytes| were removed from CrxDownloaderTest.*
    (components/update_client/crx_downloader_unittest.cc).
    
    On the other hand, references to CrxDownloader::DownloadMetrics::downloaded_bytes
    and |CrxDownloader::DownloadMetrics::total_bytes| remain unchanged
    (update_client::BuildDownloadCompleteEventElement uses them).
    
    Bug:844972,871211
    
    Cq-Include-Trybots: luci.chromium.try:linux_mojo
    Change-Id: I50410b46576263aec9a9a4b648a8a627f4832702
    Reviewed-on: https://chromium-review.googlesource.com/1160725Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
    Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
    Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#582150}
    0807dd6f
update_client_unittest.cc 143 KB