Resource Load Statistics: Report user interaction immediately, but only when needed
https://bugs.webkit.org/show_bug.cgi?id=175090
<rdar://problem/
33685546>
Reviewed by Chris Dumez.
Source/WebCore:
Test: http/tests/loading/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html
* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::ResourceLoadObserver):
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
Now tells the UI process immediately but also records that it has
done so to avoid doing it when not needed.
(WebCore::ResourceLoadObserver::scheduleNotificationIfNeeded):
Conditional throttling gone, now always throttles.
(WebCore::ResourceLoadObserver::notifyObserver):
Renamed from ResourceLoadObserver::notificationTimerFired().
(WebCore::ResourceLoadObserver::clearState):
New function to allow the test runner to reset the web process'
statistics state now that we keep track of whether or not we've
reported user interaction to the UI process.
(WebCore::ResourceLoadObserver::setShouldThrottleObserverNotifications): Deleted.
(WebCore::ResourceLoadObserver::notificationTimerFired): Deleted.
* loader/ResourceLoadObserver.h:
(): Deleted.
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setResourceLoadStatisticsShouldThrottleObserverNotifications): Deleted.
No longer needed since user interaction is always communicated
immediately.
* testing/Internals.h:
* testing/Internals.idl:
Source/WebKit:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleClearResourceLoadStatistics):
Test infrastructure. Ends up calling
WebCore::ResourceLoadObserver::clearState().
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
Tools:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
Now calls WebCore::ResourceLoadObserver::clearState().
LayoutTests:
* http/tests/loading/resourceLoadStatistics/user-interaction-in-cross-origin-sub-frame.html:
Now no longer needs to disable throttling since reports of
user interaction happen immediately (when needed).
* http/tests/loading/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time-expected.txt: Added.
* http/tests/loading/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html: Added.
* platform/mac-wk2/TestExpectations:
user-interaction-only-reported-once-within-short-period-of-time.html marked as [ Pass ].
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220268
268f45cc-cd09-0410-ab3c-
d52691b4dbfc