RESOLVED FIXED 195785
Implement DownloadMonitor to prevent long-running slow downloads from background apps
https://bugs.webkit.org/show_bug.cgi?id=195785
Summary Implement DownloadMonitor to prevent long-running slow downloads from backgro...
Alex Christensen
Reported 2019-03-14 17:34:16 PDT
Implement DownloadMonitor to prevent long-running slow downloads from background apps
Attachments
Patch (20.38 KB, patch)
2019-03-14 17:36 PDT, Alex Christensen
no flags
Patch (76.86 KB, patch)
2019-03-15 21:55 PDT, Alex Christensen
no flags
Patch (78.91 KB, patch)
2019-03-16 09:40 PDT, Alex Christensen
no flags
Patch (81.70 KB, patch)
2019-03-16 09:58 PDT, Alex Christensen
no flags
Patch (82.50 KB, patch)
2019-03-16 20:36 PDT, Alex Christensen
no flags
Patch (83.68 KB, patch)
2019-03-18 10:25 PDT, Alex Christensen
no flags
Patch (83.74 KB, patch)
2019-03-18 14:59 PDT, Alex Christensen
no flags
Alex Christensen
Comment 1 2019-03-14 17:36:05 PDT
Geoffrey Garen
Comment 2 2019-03-14 20:06:43 PDT
Comment on attachment 364730 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=364730&action=review Please fix EWS build failures. > Source/WebKit/NetworkProcess/Downloads/Download.h:103 > + friend class DownloadMonitor; > bool isAlwaysOnLoggingAllowed() const; Can we just make this interface public? Seems less bad than making all our data members public to DownloadMonitor. > Source/WebKit/NetworkProcess/Downloads/DownloadMonitor.cpp:86 > + while (m_timestamps.size() > maxTimestampsSize) > + m_timestamps.removeFirst(); Can we do this before the append, to avoid out-of-line storage? Does this need to be a loop, or can we just remove one when we're at capacity? > Source/WebKit/NetworkProcess/Downloads/DownloadMonitor.cpp:97 > +void DownloadMonitor::applicationNoLongerInForeground() Let's call this applicationEnteredBackground. > Source/WebKit/NetworkProcess/Downloads/DownloadMonitor.cpp:116 > + RELEASE_LOG_IF_ALLOWED("timerFired: Download reached threshold to not be terminated (id = %" PRIu64 ")", m_download.downloadID().downloadID()); So, if you survive past 60 minutes, you survive forever? Is that how other downloads behave? > Source/WebKit/NetworkProcess/Downloads/DownloadMonitor.h:53 > + static constexpr size_t maxTimestampsSize = 10; Let's call this timestampCapacity.
Alex Christensen
Comment 3 2019-03-15 21:55:50 PDT
Alex Christensen
Comment 4 2019-03-16 09:40:24 PDT
Alex Christensen
Comment 5 2019-03-16 09:58:19 PDT
EWS Watchlist
Comment 6 2019-03-16 09:59:42 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Alex Christensen
Comment 7 2019-03-16 20:36:07 PDT
Alex Christensen
Comment 8 2019-03-18 10:25:49 PDT
Geoffrey Garen
Comment 9 2019-03-18 14:04:45 PDT
Comment on attachment 365025 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365025&action=review r=me > Source/WebKit/NetworkProcess/Downloads/DownloadManager.cpp:208 > +void DownloadManager::applicationDidEnterBackground() > +{ > + for (auto& download : m_downloads.values()) > + download->applicationEnteredBackground(); > +} > + > +void DownloadManager::applicationWillEnterForeground() > +{ > + for (auto& download : m_downloads.values()) > + download->applicationEnteredForeground(); > +} Nit: You can resolve the small differences in these names. applicationEnteredForeground => applicationWillEnterForeground applicationEnteredBackground => applicationDidEnterBackground > Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:72 > +@property (nonatomic) NSUInteger downloadMonitorSpeedMultiplier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); Maybe put "ForDebugging" on the ends of this name and its related names, to clarify the purpose.
Alex Christensen
Comment 10 2019-03-18 14:59:56 PDT
WebKit Commit Bot
Comment 11 2019-03-18 15:39:01 PDT
Comment on attachment 365070 [details] Patch Clearing flags on attachment: 365070 Committed r243110: <https://trac.webkit.org/changeset/243110>
WebKit Commit Bot
Comment 12 2019-03-18 15:39:03 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 13 2019-03-18 15:40:34 PDT
Alex Christensen
Comment 14 2019-03-18 22:47:21 PDT
Alex Christensen
Comment 15 2019-03-20 12:33:35 PDT
Note You need to log in before you can comment on or make changes to this bug.