Add a new DownloadMap type that manages taking an assertion automatically.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2019 21:27:21 +0000 (21:27 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2019 21:27:21 +0000 (21:27 +0000)
commitb0ccd5ae62eb7f7966a88b2e69d9f0e4057918c5
treecfe4844d8f5ab6e93a160c88eed2f64a7e825b9b
parentec970e39c0aea0517f59c680e59d45fc78278341
Add a new DownloadMap type that manages taking an assertion automatically.
https://bugs.webkit.org/show_bug.cgi?id=194294

Reviewed by Alex Christensen.

If we don't need the download assertion, we use a vanilla HashMap like today.
If we need the download assertion, we use the new DownloadMap class instead.

The new DownloadMap is a wrapper around a HashMap that also creates/destroys the assertion as needed.

* NetworkProcess/Downloads/DownloadManager.cpp:
(WebKit::DownloadManager::dataTaskBecameDownloadTask):
(WebKit::DownloadManager::downloadFinished):
* NetworkProcess/Downloads/DownloadManager.h:

* NetworkProcess/Downloads/DownloadMap.cpp: Added.
(WebKit::DownloadMap::get const):
(WebKit::DownloadMap::isEmpty const):
(WebKit::DownloadMap::size const):
(WebKit::DownloadMap::contains const):
(WebKit::DownloadMap::add):
(WebKit::DownloadMap::remove):
* NetworkProcess/Downloads/DownloadMap.h: Added.

* Sources.txt:

* UIProcess/ios/ProcessAssertionIOS.mm:
(WebKit::ProcessAssertion::ProcessAssertion):

* WebKit.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240990 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Downloads/DownloadManager.cpp
Source/WebKit/NetworkProcess/Downloads/DownloadManager.h
Source/WebKit/NetworkProcess/Downloads/DownloadMap.cpp [new file with mode: 0644]
Source/WebKit/NetworkProcess/Downloads/DownloadMap.h [new file with mode: 0644]
Source/WebKit/Sources.txt
Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj