Diff
Modified: trunk/Source/WebCore/ChangeLog (278521 => 278522)
--- trunk/Source/WebCore/ChangeLog 2021-06-05 04:47:23 UTC (rev 278521)
+++ trunk/Source/WebCore/ChangeLog 2021-06-05 05:35:21 UTC (rev 278522)
@@ -1,5 +1,28 @@
2021-06-04 Chris Dumez <[email protected]>
+ Reduce use of legacy MainThreadTaskQueue in media code
+ https://bugs.webkit.org/show_bug.cgi?id=226672
+
+ Reviewed by Darin Adler.
+
+ Reduce use of legacy MainThreadTaskQueue in media code. Simply use callOnMainThread()
+ for these instead.
+
+ * platform/graphics/cocoa/TextTrackRepresentationCocoa.h:
+ * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
+ (WebCore::TextTrackRepresentationCocoa::boundsChanged):
+ * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
+ * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
+ (WebCore::CoreAudioCaptureDeviceManager::scheduleUpdateCaptureDevices):
+ * platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
+ * platform/mock/MediaPlaybackTargetPickerMock.cpp:
+ (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
+ (WebCore::MediaPlaybackTargetPickerMock::startingMonitoringPlaybackTargets):
+ (WebCore::MediaPlaybackTargetPickerMock::setState):
+ * platform/mock/MediaPlaybackTargetPickerMock.h:
+
+2021-06-04 Chris Dumez <[email protected]>
+
FileSystem::readFromFile() should return data as `void*`
https://bugs.webkit.org/show_bug.cgi?id=226671
Modified: trunk/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.h (278521 => 278522)
--- trunk/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.h 2021-06-05 04:47:23 UTC (rev 278521)
+++ trunk/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.h 2021-06-05 05:35:21 UTC (rev 278522)
@@ -28,16 +28,16 @@
#if (PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))) && ENABLE(VIDEO)
-#include "GenericTaskQueue.h"
#include "TextTrackRepresentation.h"
#include <QuartzCore/CALayer.h>
#include <wtf/RetainPtr.h>
+#include <wtf/WeakPtr.h>
@class WebCoreTextTrackRepresentationCocoaHelper;
namespace WebCore {
-class TextTrackRepresentationCocoa final : public TextTrackRepresentation {
+class TextTrackRepresentationCocoa final : public TextTrackRepresentation, public CanMakeWeakPtr<TextTrackRepresentationCocoa, WeakPtrFactoryInitialization::Eager> {
public:
explicit TextTrackRepresentationCocoa(TextTrackRepresentationClient&);
virtual ~TextTrackRepresentationCocoa();
@@ -54,7 +54,6 @@
void setContentScale(float) final;
void setHidden(bool) const final;
- MainThreadTaskQueue m_taskQueue;
TextTrackRepresentationClient& m_client;
RetainPtr<CALayer> m_layer;
RetainPtr<WebCoreTextTrackRepresentationCocoaHelper> m_delegate;
Modified: trunk/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm (278521 => 278522)
--- trunk/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm 2021-06-05 04:47:23 UTC (rev 278521)
+++ trunk/Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm 2021-06-05 05:35:21 UTC (rev 278522)
@@ -150,8 +150,9 @@
void TextTrackRepresentationCocoa::boundsChanged()
{
- m_taskQueue.enqueueTask([this] () {
- client().textTrackRepresentationBoundsChanged(bounds());
+ callOnMainThread([weakThis = makeWeakPtr(*this)] {
+ if (weakThis)
+ weakThis->client().textTrackRepresentationBoundsChanged(weakThis->bounds());
});
}
Modified: trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h (278521 => 278522)
--- trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h 2021-06-05 04:47:23 UTC (rev 278521)
+++ trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h 2021-06-05 05:35:21 UTC (rev 278522)
@@ -75,7 +75,6 @@
std::optional<Vector<AVAudioSessionCaptureDevice>> m_audioSessionCaptureDevices;
RetainPtr<WebAVAudioSessionAvailableInputsListener> m_listener;
RetainPtr<AVAudioSession> m_audioSession;
- MainThreadTaskQueue m_updateDeviceStateQueue;
Ref<WorkQueue> m_dispatchQueue;
AudioSessionState m_audioSessionState { AudioSessionState::NotNeeded };
};
Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp (278521 => 278522)
--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp 2021-06-05 04:47:23 UTC (rev 278521)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp 2021-06-05 05:35:21 UTC (rev 278522)
@@ -175,11 +175,13 @@
void CoreAudioCaptureDeviceManager::scheduleUpdateCaptureDevices()
{
- if (m_updateDeviceStateQueue.hasPendingTasks())
+ if (m_wasRefreshAudioCaptureDevicesScheduled)
return;
- m_updateDeviceStateQueue.enqueueTask([this] {
+ m_wasRefreshAudioCaptureDevicesScheduled = true;
+ callOnMainThread([this] {
refreshAudioCaptureDevices(NotifyIfDevicesHaveChanged::Notify);
+ m_wasRefreshAudioCaptureDevicesScheduled = false;
});
}
Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.h (278521 => 278522)
--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.h 2021-06-05 04:47:23 UTC (rev 278521)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.h 2021-06-05 05:35:21 UTC (rev 278522)
@@ -29,7 +29,6 @@
#include "CaptureDevice.h"
#include "CaptureDeviceManager.h"
-#include "GenericTaskQueue.h"
#include <CoreAudio/CoreAudio.h>
#include <wtf/text/WTFString.h>
@@ -61,7 +60,7 @@
Vector<CaptureDevice> m_captureDevices;
Vector<CaptureDevice> m_speakerDevices;
Vector<CoreAudioCaptureDevice> m_coreAudioCaptureDevices;
- MainThreadTaskQueue m_updateDeviceStateQueue;
+ bool m_wasRefreshAudioCaptureDevicesScheduled { false };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp (278521 => 278522)
--- trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp 2021-06-05 04:47:23 UTC (rev 278521)
+++ trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.cpp 2021-06-05 05:35:21 UTC (rev 278522)
@@ -74,7 +74,10 @@
LOG(Media, "MediaPlaybackTargetPickerMock::showPlaybackTargetPicker - checkActiveRoute = %i, useDarkAppearance = %i", (int)checkActiveRoute, (int)useDarkAppearance);
m_showingMenu = true;
- m_taskQueue.enqueueTask([this] {
+ callOnMainThread([this, weakThis = makeWeakPtr(*this)] {
+ if (!weakThis)
+ return;
+
m_showingMenu = false;
currentDeviceDidChange();
});
@@ -84,7 +87,10 @@
{
LOG(Media, "MediaPlaybackTargetPickerMock::startingMonitoringPlaybackTargets");
- m_taskQueue.enqueueTask([this] {
+ callOnMainThread([this, weakThis = makeWeakPtr(*this)] {
+ if (!weakThis)
+ return;
+
if (m_state == MediaPlaybackTargetContext::MockState::OutputDeviceAvailable)
availableDevicesDidChange();
@@ -108,7 +114,10 @@
{
LOG(Media, "MediaPlaybackTargetPickerMock::setState - name = %s, state = 0x%x", deviceName.utf8().data(), (unsigned)state);
- m_taskQueue.enqueueTask([this, state, deviceName] {
+ callOnMainThread([this, weakThis = makeWeakPtr(*this), state, deviceName] {
+ if (!weakThis)
+ return;
+
if (deviceName != m_deviceName && state != MediaPlaybackTargetContext::MockState::Unknown) {
m_deviceName = deviceName;
currentDeviceDidChange();
Modified: trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h (278521 => 278522)
--- trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h 2021-06-05 04:47:23 UTC (rev 278521)
+++ trunk/Source/WebCore/platform/mock/MediaPlaybackTargetPickerMock.h 2021-06-05 05:35:21 UTC (rev 278522)
@@ -28,7 +28,6 @@
#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
-#include "GenericTaskQueue.h"
#include "MediaPlaybackTargetContext.h"
#include "MediaPlaybackTargetPicker.h"
#include <wtf/text/WTFString.h>
@@ -35,7 +34,7 @@
namespace WebCore {
-class MediaPlaybackTargetPickerMock final : public MediaPlaybackTargetPicker {
+class MediaPlaybackTargetPickerMock final : public MediaPlaybackTargetPicker, public CanMakeWeakPtr<MediaPlaybackTargetPickerMock> {
WTF_MAKE_FAST_ALLOCATED;
WTF_MAKE_NONCOPYABLE(MediaPlaybackTargetPickerMock);
public:
@@ -56,7 +55,6 @@
Ref<MediaPlaybackTarget> playbackTarget() override;
String m_deviceName;
- MainThreadTaskQueue m_taskQueue;
MediaPlaybackTargetContext::MockState m_state { MediaPlaybackTargetContext::MockState::Unknown };
bool m_showingMenu { false };
};