Add a WebViewDidMoveToWindowObserver for WKWebView
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Mar 2019 04:38:26 +0000 (04:38 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Mar 2019 04:38:26 +0000 (04:38 +0000)
commit60c8ebcce647959268ad042f0ac285136e4c6792
tree64cc282685f106ce2d11b8a8872206f6071bc266
parentf4bcd4d3f626e1d36e27119bf9e68fb8d6f435da
Add a WebViewDidMoveToWindowObserver for WKWebView
https://bugs.webkit.org/show_bug.cgi?id=195223
<rdar://problem/48520161>

Reviewed by Darin Adler.

The load optimizer would only allow itself to optimize loads whenever the web view
who owns the page is (visible && focused), otherwises it will wait until the web view
becomes (visible && focused). Therefore, we need a way to notify the load optimizer
changes of statuses.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView didMoveToWindow]):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::viewDidMoveToWindow):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::addWebViewDidMoveToWindowObserver):
(WebKit::WebPageProxy::removeWebViewDidMoveToWindowObserver):
(WebKit::WebPageProxy::webViewDidMoveToWindow):
* UIProcess/WebPageProxy.h:
* UIProcess/WebViewDidMoveToWindowObserver.h: Added.
* WebKit.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242336 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebViewDidMoveToWindowObserver.h [new file with mode: 0644]
Source/WebKit/WebKit.xcodeproj/project.pbxproj