Title: [276156] branches/safari-611-branch/Source/WebCore
Revision
276156
Author
[email protected]
Date
2021-04-16 12:26:13 -0700 (Fri, 16 Apr 2021)

Log Message

Cherry-pick r274819. rdar://problem/76373741

    AVAudioSessionCaptureDeviceManager should use crossThreadCopy
    https://bugs.webkit.org/show_bug.cgi?id=223565
    <rdar://75480589>

    Reviewed by Youenn Fablet.

    Tested manually, this can only be tested on device.

    * platform/mediastream/CaptureDevice.h: Change access restriction for member
    variables from `private:` to `protected:` so derived classes can access them
    directly.

    * platform/mediastream/ios/AVAudioSessionCaptureDevice.h:
    * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
    (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): New constructor.
    (WebCore::AVAudioSessionCaptureDevice::isolatedCopy const): New.

    * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
    (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): Use
    `WTFMove(deviceList).isolatedCopy()` when moving from AVAudioSession queue
    to main thread.
    (WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): Ditto.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274819 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (276155 => 276156)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-04-16 19:24:22 UTC (rev 276155)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-04-16 19:26:13 UTC (rev 276156)
@@ -1,5 +1,59 @@
 2021-04-16  Russell Epstein  <[email protected]>
 
+        Cherry-pick r274819. rdar://problem/76373741
+
+    AVAudioSessionCaptureDeviceManager should use crossThreadCopy
+    https://bugs.webkit.org/show_bug.cgi?id=223565
+    <rdar://75480589>
+    
+    Reviewed by Youenn Fablet.
+    
+    Tested manually, this can only be tested on device.
+    
+    * platform/mediastream/CaptureDevice.h: Change access restriction for member
+    variables from `private:` to `protected:` so derived classes can access them
+    directly.
+    
+    * platform/mediastream/ios/AVAudioSessionCaptureDevice.h:
+    * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
+    (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): New constructor.
+    (WebCore::AVAudioSessionCaptureDevice::isolatedCopy const): New.
+    
+    * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
+    (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): Use
+    `WTFMove(deviceList).isolatedCopy()` when moving from AVAudioSession queue
+    to main thread.
+    (WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): Ditto.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-03-22  Eric Carlson  <[email protected]>
+
+            AVAudioSessionCaptureDeviceManager should use crossThreadCopy
+            https://bugs.webkit.org/show_bug.cgi?id=223565
+            <rdar://75480589>
+
+            Reviewed by Youenn Fablet.
+
+            Tested manually, this can only be tested on device.
+
+            * platform/mediastream/CaptureDevice.h: Change access restriction for member
+            variables from `private:` to `protected:` so derived classes can access them
+            directly.
+
+            * platform/mediastream/ios/AVAudioSessionCaptureDevice.h:
+            * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
+            (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): New constructor.
+            (WebCore::AVAudioSessionCaptureDevice::isolatedCopy const): New.
+
+            * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
+            (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): Use
+            `WTFMove(deviceList).isolatedCopy()` when moving from AVAudioSession queue
+            to main thread.
+            (WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): Ditto.
+
+2021-04-16  Russell Epstein  <[email protected]>
+
         Apply patch. rdar://problem/76375504
 
     2021-04-16  Antti Koivisto  <[email protected]>

Modified: branches/safari-611-branch/Source/WebCore/platform/mediastream/CaptureDevice.h (276155 => 276156)


--- branches/safari-611-branch/Source/WebCore/platform/mediastream/CaptureDevice.h	2021-04-16 19:24:22 UTC (rev 276155)
+++ branches/safari-611-branch/Source/WebCore/platform/mediastream/CaptureDevice.h	2021-04-16 19:26:13 UTC (rev 276156)
@@ -130,7 +130,7 @@
     }
 #endif
 
-private:
+protected:
     String m_persistentId;
     DeviceType m_type { DeviceType::Unknown };
     String m_label;

Modified: branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.h (276155 => 276156)


--- branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.h	2021-04-16 19:24:22 UTC (rev 276155)
+++ branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.h	2021-04-16 19:26:13 UTC (rev 276156)
@@ -39,8 +39,11 @@
     static AVAudioSessionCaptureDevice create(AVAudioSessionPortDescription *deviceInput, AVAudioSessionPortDescription *defaultInput);
     virtual ~AVAudioSessionCaptureDevice() = default;
 
+    AVAudioSessionCaptureDevice isolatedCopy() &&;
+
 private:
     AVAudioSessionCaptureDevice(AVAudioSessionPortDescription *deviceInput, AVAudioSessionPortDescription *defaultInput);
+    AVAudioSessionCaptureDevice(const String& persistentId, DeviceType, const String& label, const String& groupId, bool isEnabled, bool isDefault, bool isMock);
 };
 
 } // namespace WebCore

Modified: branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm (276155 => 276156)


--- branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm	2021-04-16 19:24:22 UTC (rev 276155)
+++ branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm	2021-04-16 19:26:13 UTC (rev 276156)
@@ -44,6 +44,27 @@
     setIsDefault(defaultInput && [defaultInput.UID isEqualToString:deviceInput.UID]);
 }
 
+AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice(const String& persistentId, DeviceType type, const String& label, const String& groupId, bool isEnabled, bool isDefault, bool isMock)
+    : CaptureDevice(persistentId, type, label, groupId)
+{
+    setEnabled(isEnabled);
+    setIsDefault(isDefault);
+    setIsMockDevice(isMock);
 }
 
+AVAudioSessionCaptureDevice AVAudioSessionCaptureDevice::isolatedCopy() &&
+{
+    return {
+        WTFMove(m_persistentId).isolatedCopy(),
+        m_type,
+        WTFMove(m_label).isolatedCopy(),
+        WTFMove(m_groupId).isolatedCopy(),
+        m_enabled,
+        m_default,
+        m_isMockDevice,
+    };
+}
+
+}
+
 #endif // ENABLE(MEDIA_STREAM) && PLATFORM(IOS_FAMILY)

Modified: branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm (276155 => 276156)


--- branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm	2021-04-16 19:24:22 UTC (rev 276155)
+++ branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm	2021-04-16 19:26:13 UTC (rev 276156)
@@ -167,7 +167,7 @@
     dispatch_sync(m_dispatchQueue, makeBlockPtr([&] {
         newAudioDevices = retrieveAudioSessionCaptureDevices();
     }).get());
-    setAudioCaptureDevices(WTFMove(newAudioDevices));
+    setAudioCaptureDevices(WTFMove(newAudioDevices).isolatedCopy());
 }
 
 void AVAudioSessionCaptureDeviceManager::getCaptureDevices(CompletionHandler<void(Vector<CaptureDevice>&&)>&& completion)
@@ -182,7 +182,7 @@
 
     dispatch_async(m_dispatchQueue, makeBlockPtr([this, completion = WTFMove(completion)] () mutable {
         auto newAudioDevices = retrieveAudioSessionCaptureDevices();
-        callOnWebThreadOrDispatchAsyncOnMainThread(makeBlockPtr([this, completion = WTFMove(completion), newAudioDevices = WTFMove(newAudioDevices)] () mutable {
+        callOnWebThreadOrDispatchAsyncOnMainThread(makeBlockPtr([this, completion = WTFMove(completion), newAudioDevices = WTFMove(newAudioDevices).isolatedCopy()] () mutable {
             setAudioCaptureDevices(WTFMove(newAudioDevices));
             completion(copyToVector(*m_devices));
         }).get());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to