[Mac] Gather some rudimentary statistics during resource load
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Feb 2016 05:36:38 +0000 (05:36 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Feb 2016 05:36:38 +0000 (05:36 +0000)
commitdc01ebf9b419ffbc9f4510092974c3d3711330b7
tree01c2a170d504d11415ec8e20db3f073cfdf33848
parent5deaa6644406e301472d253c41444accb40b5687
[Mac] Gather some rudimentary statistics during resource load
https://bugs.webkit.org/show_bug.cgi?id=153575
<rdar://problem/24075254>

Reviewed by Brady Eidson.

Source/WebCore:

Tested by: http/tests/navigation/statistics.html

* CMakeLists.txt:
* PlatformWin.cmake:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::updateLastHandledUserGestureTimestamp): Log user interaction
with the ResourceLoadObserver.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::willSendRequest): Track load statistics if the
user interacted with the document.
* loader/ResourceLoadObserver.cpp: Added.
* loader/ResourceLoadObserver.h: Added.
* loader/ResourceLoadStatistics.cpp: Added.
* loader/ResourceLoadStatistics.h: Added.
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal): Track load statistics.
* page/Settings.cpp:
(WebCore::Settings::setResourceLoadStatisticsEnabled): Added.
* page/Settings.h:
(WebCore::Settings::resourceLoadStatisticsEnabled): Added.
* platform/Logging.h:
* testing/Internals.cpp:
(WebCore::Internals::resourceLoadStatisticsForOrigin):
(WebCore::Internals::setResourceLoadStatisticsEnabled):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit/mac:

* Misc/WebKitNSStringExtras.h:
* Misc/WebKitNSStringExtras.mm:
(+[NSString _webkit_localStorageDirectoryWithBundleIdentifier:]): Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences resourceLoadStatisticsEnabled]): Added.
(-[WebPreferences setResourceLoadStatisticsEnabled:]): Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(WebKitInitializeApplicationCachePathIfNecessary):
(WebKitInitializeApplicationStatisticsStoragePathIfNecessary): Added.
(-[WebView _commonInitializationWithFrameName:groupName:]): Add call to new
initialization method.
(-[WebView _preferencesChanged:]): Track changes in the user's desire to
monitor resource load statistics.
(+[WebView _applicationWillTerminate]): Write statistics to disk (if preferences
say to do so.)

Tools:

* MiniBrowser/mac/SettingsController.h:
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]): Add menu item for new debug flag.
(-[SettingsController toggleResourceLoadStatisticsEnabled:]): Added.
(-[SettingsController resourceLoadStatisticsEnabled]): Added.
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController didChangeSettings]): React to changes in
users's desire to track resource load statistics.

LayoutTests:

* http/tests/navigation/resources/redirect-on-reload-updates-history-item-statistics.php: Added.
* http/tests/navigation/resources/redirect-updates-history-item-done-statistics.html: Added.
* http/tests/navigation/statistics-expected.txt: Added.
* http/tests/navigation/statistics.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196622 268f45cc-cd09-0410-ab3c-d52691b4dbfc
35 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/navigation/resources/redirect-on-reload-updates-history-item-statistics.php [new file with mode: 0644]
LayoutTests/http/tests/navigation/resources/redirect-updates-history-item-done-statistics.html [new file with mode: 0644]
LayoutTests/http/tests/navigation/statistics-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/navigation/statistics.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/PlatformWin.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Document.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/ResourceLoadObserver.cpp [new file with mode: 0644]
Source/WebCore/loader/ResourceLoadObserver.h [new file with mode: 0644]
Source/WebCore/loader/ResourceLoadStatistics.cpp [new file with mode: 0644]
Source/WebCore/loader/ResourceLoadStatistics.h [new file with mode: 0644]
Source/WebCore/loader/SubresourceLoader.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/platform/Logging.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Misc/WebKitNSStringExtras.h
Source/WebKit/mac/Misc/WebKitNSStringExtras.mm
Source/WebKit/mac/WebKit.exp
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/MiniBrowser/mac/SettingsController.h
Tools/MiniBrowser/mac/SettingsController.m
Tools/MiniBrowser/mac/WK1BrowserWindowController.m