Title: [243570] branches/safari-607-branch/Source/WebKit
Revision
243570
Author
alanc...@apple.com
Date
2019-03-27 16:43:28 -0700 (Wed, 27 Mar 2019)

Log Message

Apply patch. rdar://problem/49307967

    fix-radar-48878188

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (243569 => 243570)


--- branches/safari-607-branch/Source/WebKit/ChangeLog	2019-03-27 23:34:04 UTC (rev 243569)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog	2019-03-27 23:43:28 UTC (rev 243570)
@@ -1,3 +1,30 @@
+2019-03-27  Alan Coon  <alanc...@apple.com>
+
+        Apply patch. rdar://problem/49307967
+
+    fix-radar-48878188
+
+    2019-03-14  Youenn Fablet  <you...@apple.com>
+
+            v2: CrashTracer: MobileSafari at WebKit: WebKit::WebPageProxy::setMediaStreamCaptureMuted.
+            rdar://problem/48878188.
+
+            There are cases where we might not update correctly the stateMap in UserMediaProcessManager.cpp.
+            One such case is:
+            - UserMediaPermissionRequestManagerProxy registers itself at construction time in a map whose key is the page process
+            - UserMediaPermissionRequestManagerProxy unregisters itself at destruction time by using the page process as well.
+            - Page changed process in some cases without UserMediaPermissionRequestManagerProxy being destroyed.
+
+            In Jazzkon, a new model was implemented that removed the need for this map.
+
+            For F, to ensure that we do not use wrong managers, keep a Vector of WeakPtr instead of a Vector of raw pointers.
+            Whenever getting the managers, check whether some of them are destroyed and remove them from the vector.
+
+            * UIProcess/UserMediaProcessManager.cpp:
+            (WebKit::ProcessState::managers):
+            (WebKit::ProcessState::addRequestManager):
+            (WebKit::ProcessState::removeRequestManager):
+
 2019-03-18  Kocsen Chung  <kocsen_ch...@apple.com>
 
         Apply patch. rdar://problem/48839387

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/UserMediaProcessManager.cpp (243569 => 243570)


--- branches/safari-607-branch/Source/WebKit/UIProcess/UserMediaProcessManager.cpp	2019-03-27 23:34:04 UTC (rev 243569)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/UserMediaProcessManager.cpp	2019-03-27 23:43:28 UTC (rev 243570)
@@ -46,7 +46,11 @@
 
     void addRequestManager(UserMediaPermissionRequestManagerProxy&);
     void removeRequestManager(UserMediaPermissionRequestManagerProxy&);
-    Vector<UserMediaPermissionRequestManagerProxy*>& managers() { return m_managers; }
+    Vector<WeakPtr<UserMediaPermissionRequestManagerProxy>>& managers()
+    {
+        m_managers.removeAllMatching([](auto&& manager) { return !manager; });
+        return m_managers;
+    }
 
     enum SandboxExtensionType : uint32_t {
         None = 0,
@@ -64,8 +68,7 @@
     void revokeAudioExtension()  { m_pageSandboxExtensionsGranted &= ~Audio; }
 
 private:
-
-    Vector<UserMediaPermissionRequestManagerProxy*> m_managers;
+    Vector<WeakPtr<UserMediaPermissionRequestManagerProxy>> m_managers;
     SandboxExtensionsGranted m_pageSandboxExtensionsGranted { SandboxExtensionType::None };
 };
 
@@ -88,14 +91,14 @@
 void ProcessState::addRequestManager(UserMediaPermissionRequestManagerProxy& proxy)
 {
     ASSERT(!m_managers.contains(&proxy));
-    m_managers.append(&proxy);
+    m_managers.append(makeWeakPtr(proxy));
 }
 
 void ProcessState::removeRequestManager(UserMediaPermissionRequestManagerProxy& proxy)
 {
     ASSERT(m_managers.contains(&proxy));
-    m_managers.removeFirstMatching([&proxy](auto other) {
-        return other == &proxy;
+    m_managers.removeFirstMatching([&proxy](auto&& other) {
+        return other.get() == &proxy;
     });
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to