• Asami Doi's avatar
    ServiceWorker: Fix the lifetime of OnFetchEventFinished() · 90d08bbc
    Asami Doi authored
    SWFetchDispatcher is destroyed after response is reached. Once the
    dispatcher is destroyed, SWVersion::FinishRequest() in
    FetchEventFinished() is never called. A service worker can't be
    terminated without calling FinishRequest() and it leads to increase
    the memory usage.
    
    This CL makes OnFetchEventFinished() static to enable to call it after
    SWFetchDispatcher is destructed.
    
    The new browser tests introduced in this CL make sure
    SWVersion::StartRequest() and SWVersion::FinishRequest() are called the
    same number of times. Without this CL, the tests fail.
    
    Bug: 1145551
    Change-Id: I3f6ac9d2bdb19e58802f37650288b24e22bb7d54
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2543534
    Commit-Queue: Asami Doi <asamidoi@chromium.org>
    Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#834142}
    90d08bbc
BUILD.gn 107 KB