Title: [242097] trunk/Source/WebKit
Revision
242097
Author
[email protected]
Date
2019-02-26 11:47:38 -0800 (Tue, 26 Feb 2019)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (242096 => 242097)


--- trunk/Source/WebKit/ChangeLog	2019-02-26 19:41:21 UTC (rev 242096)
+++ trunk/Source/WebKit/ChangeLog	2019-02-26 19:47:38 UTC (rev 242097)
@@ -1,3 +1,23 @@
+2019-02-26  Youenn Fablet  <[email protected]>
+
+        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.
+
 2019-02-26  Zalan Bujtas  <[email protected]>
 
         [ContentChangeObserver] Simplify content observation API by removing explicit DOMTimer observation.

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (242096 => 242097)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-02-26 19:41:21 UTC (rev 242096)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-02-26 19:47:38 UTC (rev 242097)
@@ -972,10 +972,6 @@
 
     m_isClosed = true;
 
-#if ENABLE(MEDIA_STREAM)
-    m_userMediaPermissionRequestManager = nullptr;
-#endif
-
     reportPageLoadResult(ResourceError { ResourceError::Type::Cancellation });
 
     if (m_activePopupMenu)
@@ -4293,7 +4289,8 @@
 void WebPageProxy::didChangeMainDocument(uint64_t frameID)
 {
 #if ENABLE(MEDIA_STREAM)
-    userMediaPermissionRequestManager().resetAccess(frameID);
+    if (m_userMediaPermissionRequestManager)
+        m_userMediaPermissionRequestManager->resetAccess(frameID);
 #else
     UNUSED_PARAM(frameID);
 #endif
@@ -4302,7 +4299,8 @@
 void WebPageProxy::viewIsBecomingVisible()
 {
 #if ENABLE(MEDIA_STREAM)
-    userMediaPermissionRequestManager().viewIsBecomingVisible();
+    if (m_userMediaPermissionRequestManager)
+        m_userMediaPermissionRequestManager->viewIsBecomingVisible();
 #endif
 }
 
@@ -7139,7 +7137,8 @@
 void WebPageProxy::clearUserMediaState()
 {
 #if ENABLE(MEDIA_STREAM)
-    userMediaPermissionRequestManager().clearCachedState();
+    if (m_userMediaPermissionRequestManager)
+        m_userMediaPermissionRequestManager->clearCachedState();
 #endif
 }
 
@@ -7869,7 +7868,7 @@
 #if ENABLE(MEDIA_STREAM)
     if (oldMediaCaptureState != newMediaCaptureState) {
         m_uiClient->mediaCaptureStateDidChange(m_mediaState);
-        userMediaPermissionRequestManager().captureStateChanged(oldMediaCaptureState, newMediaCaptureState);
+        m_userMediaPermissionRequestManager->captureStateChanged(oldMediaCaptureState, newMediaCaptureState);
     }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to