Create WebPageProxy::m_userMediaPermissionRequestManager only when needed
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 19:47:38 +0000 (19:47 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Feb 2019 19:47:38 +0000 (19:47 +0000)
commit152b1ecb1a7c7cce77b94a97622fd202f2847f86
tree0dd25c0a055877a55bd88881bbf89d5e02128e08
parent65346cd0b72ee349e1907519cc5fa4073616bd91
Create WebPageProxy::m_userMediaPermissionRequestManager only when needed
https://bugs.webkit.org/show_bug.cgi?id=195051

Reviewed by Eric Carlson.

Before the patch, WebPageProxy::m_userMediaPermissionRequestManager was created
in some methods to reset its state when main document is changing, view is becoming visible...
This code is unnecessary if the page did not create it already using JS APIs such as getUserMedia/enumerateDevices/ondevicechange.
This patch skips processing in the other cases if WebPageProxy::m_userMediaPermissionRequestManager is null.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close): No need to nullify it since it will be done in resetState shortly after.
(WebKit::WebPageProxy::didChangeMainDocument):
(WebKit::WebPageProxy::viewIsBecomingVisible):
(WebKit::WebPageProxy::clearUserMediaState):
(WebKit::WebPageProxy::updatePlayingMediaDidChange): m_userMediaPermissionRequestManager should not be null here
since there is or was some capturing done for the page.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageProxy.cpp