Use a load optimizer for some sites
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Jan 2019 20:44:05 +0000 (20:44 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Jan 2019 20:44:05 +0000 (20:44 +0000)
commit118c1acfe009f434b124825c27248808009cb1a2
tree3c0f628687a059d78b2109399f5ac49a6dc45882
parent6a2030d54b7a18330dc804a72e98d1836e7ea8aa
Use a load optimizer for some sites
https://bugs.webkit.org/show_bug.cgi?id=193881
<rdar://problem/46325455>

Reviewed by Brent Fulgham.

Source/WebCore:

Expose FormData::flatten to be used by the load optimizer.

* WebCore.xcodeproj/project.pbxproj:
* platform/network/FormData.h:

Source/WebKit:

We will try to speed up some sites with a dedicated load optimizer. The load optimizer lives
within the WebsiteDataStore as one client instance should have only one and it should live
as long as the client lives. How does the load optimizer work? It intercepts every load in
the navigation state. If a request meets some requirements, it will then fetch the request
from its own cache. Once the fetch succeeds, the original load will be ignored and the
optimizer will display the cached content.

Covered by API tests.

* SourcesCocoa.txt:
* UIProcess/Cocoa/LoadOptimizer.h: Added.
* UIProcess/Cocoa/LoadOptimizer.mm: Added.
* UIProcess/Cocoa/MediaCaptureUtilities.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::tryInterceptNavigation):
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
(WebKit::tryAppLink): Deleted.
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::WebsiteDataStore):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::loadOptimizer):
* WebKit.xcodeproj/project.pbxproj:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/network/FormData.h
Source/WebKit/ChangeLog
Source/WebKit/SourcesCocoa.txt
Source/WebKit/UIProcess/Cocoa/LoadOptimizer.h [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/LoadOptimizer.mm [new file with mode: 0644]
Source/WebKit/UIProcess/Cocoa/MediaCaptureUtilities.h
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/TestLoadOptimizer.mm [new file with mode: 0644]