⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276044 in webkit


Ignore:
Timestamp:
Apr 15, 2021, 12:26:00 PM (5 years ago)
Author:
Russell Epstein
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

Location:
branches/safari-611-branch/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-611-branch/Source/WebCore/ChangeLog

    r276043 r276044  
     12021-04-15  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r274819. rdar://problem/76373741
     4
     5    AVAudioSessionCaptureDeviceManager should use crossThreadCopy
     6    https://bugs.webkit.org/show_bug.cgi?id=223565
     7    <rdar://75480589>
     8   
     9    Reviewed by Youenn Fablet.
     10   
     11    Tested manually, this can only be tested on device.
     12   
     13    * platform/mediastream/CaptureDevice.h: Change access restriction for member
     14    variables from `private:` to `protected:` so derived classes can access them
     15    directly.
     16   
     17    * platform/mediastream/ios/AVAudioSessionCaptureDevice.h:
     18    * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
     19    (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): New constructor.
     20    (WebCore::AVAudioSessionCaptureDevice::isolatedCopy const): New.
     21   
     22    * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
     23    (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): Use
     24    `WTFMove(deviceList).isolatedCopy()` when moving from AVAudioSession queue
     25    to main thread.
     26    (WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): Ditto.
     27   
     28    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274819 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     29
     30    2021-03-22  Eric Carlson  <eric.carlson@apple.com>
     31
     32            AVAudioSessionCaptureDeviceManager should use crossThreadCopy
     33            https://bugs.webkit.org/show_bug.cgi?id=223565
     34            <rdar://75480589>
     35
     36            Reviewed by Youenn Fablet.
     37
     38            Tested manually, this can only be tested on device.
     39
     40            * platform/mediastream/CaptureDevice.h: Change access restriction for member
     41            variables from `private:` to `protected:` so derived classes can access them
     42            directly.
     43
     44            * platform/mediastream/ios/AVAudioSessionCaptureDevice.h:
     45            * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
     46            (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice): New constructor.
     47            (WebCore::AVAudioSessionCaptureDevice::isolatedCopy const): New.
     48
     49            * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
     50            (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices): Use
     51            `WTFMove(deviceList).isolatedCopy()` when moving from AVAudioSession queue
     52            to main thread.
     53            (WebCore::AVAudioSessionCaptureDeviceManager::getCaptureDevices): Ditto.
     54
    1552021-04-15  Russell Epstein  <repstein@apple.com>
    256
  • branches/safari-611-branch/Source/WebCore/platform/mediastream/CaptureDevice.h

    r275958 r276044  
    131131#endif
    132132
    133 private:
     133protected:
    134134    String m_persistentId;
    135135    DeviceType m_type { DeviceType::Unknown };
  • branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.h

    r275958 r276044  
    4040    virtual ~AVAudioSessionCaptureDevice() = default;
    4141
     42    AVAudioSessionCaptureDevice isolatedCopy() &&;
     43
    4244private:
    4345    AVAudioSessionCaptureDevice(AVAudioSessionPortDescription *deviceInput, AVAudioSessionPortDescription *defaultInput);
     46    AVAudioSessionCaptureDevice(const String& persistentId, DeviceType, const String& label, const String& groupId, bool isEnabled, bool isDefault, bool isMock);
    4447};
    4548
  • branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm

    r275958 r276044  
    4545}
    4646
     47AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice(const String& persistentId, DeviceType type, const String& label, const String& groupId, bool isEnabled, bool isDefault, bool isMock)
     48    : CaptureDevice(persistentId, type, label, groupId)
     49{
     50    setEnabled(isEnabled);
     51    setIsDefault(isDefault);
     52    setIsMockDevice(isMock);
     53}
     54
     55AVAudioSessionCaptureDevice AVAudioSessionCaptureDevice::isolatedCopy() &&
     56{
     57    return {
     58        WTFMove(m_persistentId).isolatedCopy(),
     59        m_type,
     60        WTFMove(m_label).isolatedCopy(),
     61        WTFMove(m_groupId).isolatedCopy(),
     62        m_enabled,
     63        m_default,
     64        m_isMockDevice,
     65    };
     66}
     67
    4768}
    4869
  • branches/safari-611-branch/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm

    r275958 r276044  
    167167    dispatch_sync(m_dispatchQueue, makeBlockPtr([&] {
    168168        newAudioDevices = retrieveAudioSessionCaptureDevices();
    169     }).get());
    170     setAudioCaptureDevices(WTFMove(newAudioDevices));
     169    });
     170    setAudioCaptureDevices(WTFMove(newAudioDevices).isolatedCopy());
    171171}
    172172
     
    183183    dispatch_async(m_dispatchQueue, makeBlockPtr([this, completion = WTFMove(completion)] () mutable {
    184184        auto newAudioDevices = retrieveAudioSessionCaptureDevices();
    185         callOnWebThreadOrDispatchAsyncOnMainThread(makeBlockPtr([this, completion = WTFMove(completion), newAudioDevices = WTFMove(newAudioDevices)] () mutable {
     185        callOnWebThreadOrDispatchAsyncOnMainThread(makeBlockPtr([this, completion = WTFMove(completion), newAudioDevices = WTFMove(newAudioDevices).isolatedCopy()] () mutable {
    186186            setAudioCaptureDevices(WTFMove(newAudioDevices));
    187187            completion(copyToVector(*m_devices));
Note: See TracChangeset for help on using the changeset viewer.