[Beacon] Add support for quota limitation
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2017 17:58:41 +0000 (17:58 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Aug 2017 17:58:41 +0000 (17:58 +0000)
commit0598f9b86b07da108f7ce3c123aeb2c228499482
treefb20e553803aa13acccb52b733c0538728e60d56
parent9c259df78e07e85a55f63c417c97cc06b5286cec
[Beacon] Add support for quota limitation
https://bugs.webkit.org/show_bug.cgi?id=175443
<rdar://problem/33729002>

Reviewed by Youenn Fablet.

Source/WebCore:

LoaderStrategy::startPingLoad() now takes a completion handler parameter, allowing CachedResource::load()
to know when a Beacon load is complete. This was needed in order for the fetch in-flight keepalive request
quota limit to work properly for beacon loads as well. We need to know when the beacon load completes in
order to know if the beacon is in-flight or not and only free up its allocated quota once it is no longer
in-flight.

No new tests, updated existing test.

* loader/LoaderStrategy.h:
* loader/PingLoader.cpp:
(WebCore::PingLoader::startPingLoad):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::load):
* platform/network/PingHandle.h:

Source/WebKit:

WebLoaderStrategy now generates an identifier for ping loads and keep
the completion handler in a local HashMap. Once the ping load is done,
the network process sends an IPC message back to the WebContent process
so that WebLoaderStrategy can look up the completion handler for the
ping load and call it.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::loadPing):
(WebKit::NetworkConnectionToWebProcess::didFinishPingLoad):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::PingLoad):
(WebKit::PingLoad::~PingLoad):
* NetworkProcess/PingLoad.h:
* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didFinishPingLoad):
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Network/NetworkProcessConnection.messages.in:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::generatePingLoadIdentifier):
(WebKit::WebLoaderStrategy::startPingLoad):
(WebKit::WebLoaderStrategy::didFinishPingLoad):
* WebProcess/Network/WebLoaderStrategy.h:

Source/WebKitLegacy:

* WebCoreSupport/WebResourceLoadScheduler.cpp:
(WebResourceLoadScheduler::startPingLoad):
* WebCoreSupport/WebResourceLoadScheduler.h:

LayoutTests:

Extend layout test coverage and rebaseline test.

* http/wpt/beacon/beacon-quota-expected.txt:
* http/wpt/beacon/beacon-quota.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220922 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
LayoutTests/ChangeLog
LayoutTests/http/wpt/beacon/beacon-quota-expected.txt
LayoutTests/http/wpt/beacon/beacon-quota.html
Source/WebCore/ChangeLog
Source/WebCore/loader/LoaderStrategy.h
Source/WebCore/loader/PingLoader.cpp
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/platform/network/PingHandle.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/PingLoad.cpp
Source/WebKit/NetworkProcess/PingLoad.h
Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp
Source/WebKit/WebProcess/Network/NetworkProcessConnection.h
Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in
Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
Source/WebKit/WebProcess/Network/WebLoaderStrategy.h
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.cpp
Source/WebKitLegacy/WebCoreSupport/WebResourceLoadScheduler.h