Add facility for tracking times and results of page and resource loading
authorkrollin@apple.com <krollin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 May 2018 00:31:50 +0000 (00:31 +0000)
committerkrollin@apple.com <krollin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 May 2018 00:31:50 +0000 (00:31 +0000)
commita3cd77b0fd1e67fb5dbe4c720fa3e97871a6f8bb
tree93be068efb3eef8c2fb005867317f2e8a394494e
parent1b43fcb14decfa85b6384084db280e41758bb5c7
Add facility for tracking times and results of page and resource loading
https://bugs.webkit.org/show_bug.cgi?id=184838
<rdar://problem/36548974>

Reviewed by Brent Fulgham.

Source/WebCore:

Update FrameProgressTracker to send the necessary page load start/stop
signals so that we can track the entire page load at a network level.
Add an empty override of the pure virtual
LoaderStrategy::pageLoadCompleted method.

No new tests. There is no testable effect from these changes. On
Cocoa, measurable changes take place in another (non-WebKit) process.
On non-Cocoa systems, this facility is currently disabled.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::FrameProgressTracker::progressCompleted):
* loader/LoaderStrategy.h:

Source/WebKit:

Add NetworkActivityTracker. The idea behind this facility is to create
and destroy them around networking activity that we want to track for
the purpose of measuring overall network health. They can be created
around the loading of pages or individual resources, and can be
arranged in a parent/child hierarchy to indicate what pages the
resources are part of. The NetworkActivity tracker tracks load times
and results. On Cocoa, it can be integrated with CFNetwork in order to
associate WebKit activity with low-level networking activity.

* CMakeLists.txt:
* Configurations/WebKit.xcconfig:
* NetworkProcess/NetworkActivityTracker.cpp: Copied from Source/WebKit/NetworkProcess/NetworkLoadParameters.h.
(WebKit::NetworkActivityTracker::NetworkActivityTracker):
(WebKit::NetworkActivityTracker::~NetworkActivityTracker):
(WebKit::NetworkActivityTracker::setParent):
(WebKit::NetworkActivityTracker::start):
(WebKit::NetworkActivityTracker::complete):
* NetworkProcess/NetworkActivityTracker.h: Added.
(WebKit::NetworkActivityTracker::getPlatformObject):
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::didClose):
(WebKit::NetworkConnectionToWebProcess::pageLoadCompleted):
(WebKit::networkActivityTrackingEnabled):
(WebKit::NetworkConnectionToWebProcess::startTrackingResourceLoad):
(WebKit::NetworkConnectionToWebProcess::stopTrackingResourceLoad):
(WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTracking):
(WebKit::NetworkConnectionToWebProcess::stopAllNetworkActivityTrackingForPage):
(WebKit::NetworkConnectionToWebProcess::findRootNetworkActivity):
(WebKit::NetworkConnectionToWebProcess::findNetworkActivityTracker):
* NetworkProcess/NetworkConnectionToWebProcess.h:
(WebKit::NetworkConnectionToWebProcess::ResourceNetworkActivityTracker::ResourceNetworkActivityTracker):
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::create):
* NetworkProcess/NetworkLoadParameters.h:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/NetworkProcess.h:
(WebKit::NetworkProcess::trackNetworkActivity const):
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::start):
(WebKit::NetworkResourceLoader::cleanup):
(WebKit::NetworkResourceLoader::abort):
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::didFailLoading):
(WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
(WebKit::NetworkResourceLoader::continueProcessingCachedEntryAfterDidReceiveResponse):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm: Added.
(WebKit::NetworkActivityTracker::NetworkActivityTracker):
(WebKit::NetworkActivityTracker::~NetworkActivityTracker):
(WebKit::NetworkActivityTracker::setParent):
(WebKit::NetworkActivityTracker::start):
(WebKit::NetworkActivityTracker::complete):
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/C/WKContextConfigurationRef.cpp:
(WKContextConfigurationTrackNetworkActivity):
(WKContextConfigurationSetTrackNetworkActivity):
* UIProcess/API/C/WKContextConfigurationRef.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration trackNetworkActivity]):
(-[_WKProcessPoolConfiguration setTrackNetworkActivity:]):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::pageLoadCompleted):
* WebProcess/Network/WebLoaderStrategy.h:

Source/WebKitLegacy:

Add an empty override of the pure virtual
LoaderStrategy::pageLoadCompleted method.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/LoaderStrategy.h
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/Configurations/WebKit.xcconfig
Source/WebKit/NetworkProcess/NetworkActivityTracker.cpp [new file with mode: 0644]
Source/WebKit/NetworkProcess/NetworkActivityTracker.h [new file with mode: 0644]
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
Source/WebKit/NetworkProcess/NetworkDataTask.cpp
Source/WebKit/NetworkProcess/NetworkLoadParameters.h
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/NetworkProcess/NetworkResourceLoader.h
Source/WebKit/NetworkProcess/cocoa/NetworkActivityTrackerCocoa.mm [new file with mode: 0644]
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.cpp
Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/WebKit.xcodeproj/project.pbxproj
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