[Mac] Refactor MediaPlaybackTarget
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Apr 2015 14:31:48 +0000 (14:31 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Apr 2015 14:31:48 +0000 (14:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143571

Reviewed by Jer Noble.

Source/WebCore/:

* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::addPlaybackTargetPickerClient): Don't call client if page playback target
    is NULL.
(WebCore::Document::didChoosePlaybackTarget): MediaPlaybackTarget is passed as a Ref<>
* dom/Document.h:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setWirelessPlaybackTarget): MediaPlaybackTarget is passed as a Ref<>
* html/HTMLMediaElement.h:

* html/HTMLMediaSession.cpp:
(WebCore::HTMLMediaSession::HTMLMediaSession): Don't initialize m_playbackTarget.
(WebCore::HTMLMediaSession::didChoosePlaybackTarget): MediaPlaybackTarget is passed as a Ref<>
* html/HTMLMediaSession.h:

* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::playbackTarget): m_playbackTarget is a RefPtr<MediaPlaybackTarget>
(WebCore::Page::didChoosePlaybackTarget): Ditto.
* page/Page.h:

* platform/audio/MediaSession.h:
(WebCore::MediaSessionClient::setWirelessPlaybackTarget): Take a Ref<MediaPlaybackTarget>&&.

Make MediaPlaybackTarget RefCounted, and don't require it to be serializable so it can be
subclassed to keep port-specific iformation out of the base class.
* platform/graphics/MediaPlaybackTarget.h:
(WebCore::MediaPlaybackTarget::targetType):
(WebCore::MediaPlaybackTarget::targetContext):
(WebCore::MediaPlaybackTarget::hasActiveRoute):
(WebCore::MediaPlaybackTarget::MediaPlaybackTarget):
(WebCore::MediaPlaybackTarget::setDevicePickerContext): Deleted.
(WebCore::MediaPlaybackTarget::devicePickerContext): Deleted.

MediaPlaybackTargetContext is the struct that is serialized to pass across the process boudary.
It has union to hold port-specific data.
* platform/graphics/MediaPlaybackTargetContext.h: Added.

* platform/graphics/MediaPlaybackTargetPicker.h: didChoosePlaybackTarget takes a Ref<MediaPlaybackTarget>&&
* platform/graphics/MediaPlaybackTargetPickerClient.h: Ditto.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::setWirelessPlaybackTarget): Ditto.
* platform/graphics/MediaPlayer.h:

* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::setWirelessPlaybackTarget):

* platform/graphics/avfoundation/MediaPlaybackTargetMac.h: Added.
(WebCore::MediaPlaybackTargetMac::targetType):
(WebCore::MediaPlaybackTargetMac::outputContext):
* platform/graphics/avfoundation/MediaPlaybackTargetMac.mm:
(WebCore::MediaPlaybackTargetMac::create):
(WebCore::MediaPlaybackTargetMac::MediaPlaybackTargetMac):
(WebCore::MediaPlaybackTargetMac::~MediaPlaybackTargetMac):
(WebCore::MediaPlaybackTargetMac::targetContext):
(WebCore::MediaPlaybackTargetMac::hasActiveRoute):
(WebCore::toMediaPlaybackTargetMac):
(WebCore::MediaPlaybackTarget::encode): Deleted.
(WebCore::MediaPlaybackTarget::decode): Deleted.
(WebCore::MediaPlaybackTarget::hasActiveRoute): Deleted.

* platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
(WebCore::MediaPlaybackTargetPickerMac::currentDeviceDidChange): Allocate and pass a MediaPlaybackTargetMac
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget): Take a Ref<MediaPlaybackTarget&&

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setWirelessPlaybackTarget): Ditto.

* platform/graphics/mac/MediaPlayerPrivateQTKit.h:
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivateQTKit::setWirelessPlaybackTarget): Ditto.

Source/WebKit2:

Pass a MediaPlaybackTargetContext across process boundary instead of a MediaPlaybackTarget.
* Shared/WebCoreArgumentCoders.h:
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::encode): New.
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::decode): New.
* Shared/mac/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): New.
(IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): New.
(IPC::ArgumentCoder<MediaPlaybackTarget>::encode): Deleted.
(IPC::ArgumentCoder<MediaPlaybackTarget>::decode): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didChoosePlaybackTarget): Take a Ref<MediaPlaybackTarget>&&.
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::playbackTargetSelected): Take a Ref<MediaPlaybackTarget>&&.

Source/WebKit/mac/:

* WebView/WebMediaPlaybackTargetPicker.h:
* WebView/WebMediaPlaybackTargetPicker.mm:
(WebMediaPlaybackTargetPicker::didChoosePlaybackTarget): Take a Ref<MediaPlaybackTarget>&&.

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

39 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLMediaSession.cpp
Source/WebCore/html/HTMLMediaSession.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/platform/audio/MediaSession.h
Source/WebCore/platform/graphics/MediaPlaybackTarget.h
Source/WebCore/platform/graphics/MediaPlaybackTargetContext.h [new file with mode: 0644]
Source/WebCore/platform/graphics/MediaPlaybackTargetPicker.h
Source/WebCore/platform/graphics/MediaPlaybackTargetPickerClient.h
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetMac.h [new file with mode: 0644]
Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetMac.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebMediaPlaybackTargetPicker.h
Source/WebKit/mac/WebView/WebMediaPlaybackTargetPicker.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Source/WebKit2/Shared/WebCoreArgumentCoders.h
Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

index a471196..da81fc7 100644 (file)
@@ -1,3 +1,87 @@
+2015-04-10  Eric Carlson  <eric.carlson@apple.com>
+
+        [Mac] Refactor MediaPlaybackTarget
+        https://bugs.webkit.org/show_bug.cgi?id=143571
+
+        Reviewed by Jer Noble.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Document.cpp:
+        (WebCore::Document::addPlaybackTargetPickerClient): Don't call client if page playback target
+            is NULL.
+        (WebCore::Document::didChoosePlaybackTarget): MediaPlaybackTarget is passed as a Ref<>
+        * dom/Document.h:
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::setWirelessPlaybackTarget): MediaPlaybackTarget is passed as a Ref<>
+        * html/HTMLMediaElement.h:
+
+        * html/HTMLMediaSession.cpp:
+        (WebCore::HTMLMediaSession::HTMLMediaSession): Don't initialize m_playbackTarget.
+        (WebCore::HTMLMediaSession::didChoosePlaybackTarget): MediaPlaybackTarget is passed as a Ref<>
+        * html/HTMLMediaSession.h:
+
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::playbackTarget): m_playbackTarget is a RefPtr<MediaPlaybackTarget>
+        (WebCore::Page::didChoosePlaybackTarget): Ditto.
+        * page/Page.h:
+
+        * platform/audio/MediaSession.h:
+        (WebCore::MediaSessionClient::setWirelessPlaybackTarget): Take a Ref<MediaPlaybackTarget>&&.
+
+        Make MediaPlaybackTarget RefCounted, and don't require it to be serializable so it can be
+        subclassed to keep port-specific iformation out of the base class.
+        * platform/graphics/MediaPlaybackTarget.h: 
+        (WebCore::MediaPlaybackTarget::targetType):
+        (WebCore::MediaPlaybackTarget::targetContext):
+        (WebCore::MediaPlaybackTarget::hasActiveRoute):
+        (WebCore::MediaPlaybackTarget::MediaPlaybackTarget):
+        (WebCore::MediaPlaybackTarget::setDevicePickerContext): Deleted.
+        (WebCore::MediaPlaybackTarget::devicePickerContext): Deleted.
+
+        MediaPlaybackTargetContext is the struct that is serialized to pass across the process boudary.
+        It has union to hold port-specific data.
+        * platform/graphics/MediaPlaybackTargetContext.h: Added.
+
+        * platform/graphics/MediaPlaybackTargetPicker.h: didChoosePlaybackTarget takes a Ref<MediaPlaybackTarget>&&
+        * platform/graphics/MediaPlaybackTargetPickerClient.h: Ditto.
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::setWirelessPlaybackTarget): Ditto.
+        * platform/graphics/MediaPlayer.h:
+
+        * platform/graphics/MediaPlayerPrivate.h:
+        (WebCore::MediaPlayerPrivateInterface::setWirelessPlaybackTarget):
+
+        * platform/graphics/avfoundation/MediaPlaybackTargetMac.h: Added.
+        (WebCore::MediaPlaybackTargetMac::targetType):
+        (WebCore::MediaPlaybackTargetMac::outputContext):
+        * platform/graphics/avfoundation/MediaPlaybackTargetMac.mm:
+        (WebCore::MediaPlaybackTargetMac::create):
+        (WebCore::MediaPlaybackTargetMac::MediaPlaybackTargetMac):
+        (WebCore::MediaPlaybackTargetMac::~MediaPlaybackTargetMac):
+        (WebCore::MediaPlaybackTargetMac::targetContext):
+        (WebCore::MediaPlaybackTargetMac::hasActiveRoute):
+        (WebCore::toMediaPlaybackTargetMac):
+        (WebCore::MediaPlaybackTarget::encode): Deleted.
+        (WebCore::MediaPlaybackTarget::decode): Deleted.
+        (WebCore::MediaPlaybackTarget::hasActiveRoute): Deleted.
+
+        * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
+        (WebCore::MediaPlaybackTargetPickerMac::currentDeviceDidChange): Allocate and pass a MediaPlaybackTargetMac
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget): Take a Ref<MediaPlaybackTarget&&
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setWirelessPlaybackTarget): Ditto.
+
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+        (WebCore::MediaPlayerPrivateQTKit::setWirelessPlaybackTarget): Ditto.
+
 2015-04-09  Sergio Villar Senin  <svillar@igalia.com>
 
         [CSS Grid Layout] Fix raw function pointer usages
index b31b375..2008c7d 100644 (file)
                0711589117DF6F6600EDFE2B /* MediaStreamPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0711588F17DF633700EDFE2B /* MediaStreamPrivate.cpp */; };
                071A9EC2168FBC43002629F9 /* TextTrackCueGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 071A9EC0168FB56C002629F9 /* TextTrackCueGeneric.cpp */; };
                071A9EC3168FBC55002629F9 /* TextTrackCueGeneric.h in Headers */ = {isa = PBXBuildFile; fileRef = 071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               071E496E1AD5AA0D008A50B4 /* MediaPlaybackTargetMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 071E496D1AD5AA0D008A50B4 /* MediaPlaybackTargetMac.mm */; };
+               071E49701AD5AB5E008A50B4 /* MediaPlaybackTargetMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 071E496F1AD5AB5E008A50B4 /* MediaPlaybackTargetMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0720B0A014D3323500642955 /* GenericEventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0720B09E14D3323500642955 /* GenericEventQueue.cpp */; };
                0720B0A114D3323500642955 /* GenericEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0720B09F14D3323500642955 /* GenericEventQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07277E4C17D018CC0015534D /* JSMediaStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07277E4017D018CC0015534D /* JSMediaStream.cpp */; };
                074E82BB18A69F0E007EF54C /* PlatformTimeRanges.h in Headers */ = {isa = PBXBuildFile; fileRef = 074E82B918A69F0E007EF54C /* PlatformTimeRanges.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0753860014489E9800B78452 /* CachedTextTrack.cpp */; };
                0753860314489E9800B78452 /* CachedTextTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = 0753860114489E9800B78452 /* CachedTextTrack.h */; };
-               0760C17A1AA8FC7D009ED7B8 /* MediaPlaybackTargetMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07E3DFD21A9E78A500764CA8 /* MediaPlaybackTargetMac.mm */; };
                076306D017E1478D005A7C4E /* MediaStreamTrackSourcesCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 076306CC17E1478D005A7C4E /* MediaStreamTrackSourcesCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
                076306D217E1478D005A7C4E /* MediaStreamTrackSourcesRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 076306CE17E1478D005A7C4E /* MediaStreamTrackSourcesRequest.cpp */; };
                076306D317E1478D005A7C4E /* MediaStreamTrackSourcesRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 076306CF17E1478D005A7C4E /* MediaStreamTrackSourcesRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07E9E13018F62B370011A3A4 /* InbandMetadataTextTrackPrivateAVF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E9E12F18F62B370011A3A4 /* InbandMetadataTextTrackPrivateAVF.cpp */; };
                07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.cpp */; };
                07F0B97A1AC5DB3300E535D9 /* AVKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F0B9791AC5DB3300E535D9 /* AVKitSPI.h */; };
-               07F0B97C1AC5DB4600E535D9 /* AVFoundationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F0B97B1AC5DB4600E535D9 /* AVFoundationSPI.h */; };
+               07F0B97C1AC5DB4600E535D9 /* AVFoundationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F0B97B1AC5DB4600E535D9 /* AVFoundationSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               07F876841AD580F900905849 /* MediaPlaybackTargetContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07F944161864D046005D31CB /* MediaSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAE8C081746B95700532D78 /* MediaSessionManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07FBDE2C18FED178001A7CFF /* JSDataCueCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07FBDE2B18FED178001A7CFF /* JSDataCueCustom.cpp */; };
                07FE99DC18807A7D00256648 /* HTMLMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07FE99DA18807A7D00256648 /* HTMLMediaSession.cpp */; };
                0711588F17DF633700EDFE2B /* MediaStreamPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamPrivate.cpp; sourceTree = "<group>"; };
                071A9EC0168FB56C002629F9 /* TextTrackCueGeneric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextTrackCueGeneric.cpp; sourceTree = "<group>"; };
                071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackCueGeneric.h; sourceTree = "<group>"; };
+               071E496D1AD5AA0D008A50B4 /* MediaPlaybackTargetMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaPlaybackTargetMac.mm; sourceTree = "<group>"; };
+               071E496F1AD5AB5E008A50B4 /* MediaPlaybackTargetMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlaybackTargetMac.h; sourceTree = "<group>"; };
                0720B09E14D3323500642955 /* GenericEventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericEventQueue.cpp; sourceTree = "<group>"; };
                0720B09F14D3323500642955 /* GenericEventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericEventQueue.h; sourceTree = "<group>"; };
                07221B4A17CEC32700848E51 /* MediaConstraintsImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaConstraintsImpl.cpp; sourceTree = "<group>"; };
                07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCustom.cpp; sourceTree = "<group>"; };
                07E117061489EBEB00EC5ACE /* JSTextTrackCueCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCueCustom.cpp; sourceTree = "<group>"; };
                07E3DFD01A9E786500764CA8 /* MediaPlaybackTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlaybackTarget.h; sourceTree = "<group>"; };
-               07E3DFD21A9E78A500764CA8 /* MediaPlaybackTargetMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MediaPlaybackTargetMac.mm; path = platform/graphics/avfoundation/MediaPlaybackTargetMac.mm; sourceTree = SOURCE_ROOT; };
                07E9E12D18F5E2760011A3A4 /* InbandMetadataTextTrackPrivateAVF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandMetadataTextTrackPrivateAVF.h; sourceTree = "<group>"; };
                07E9E12F18F62B370011A3A4 /* InbandMetadataTextTrackPrivateAVF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InbandMetadataTextTrackPrivateAVF.cpp; sourceTree = "<group>"; };
                07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSessionManagerMac.cpp; sourceTree = "<group>"; };
                07F0B9791AC5DB3300E535D9 /* AVKitSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVKitSPI.h; sourceTree = "<group>"; };
                07F0B97B1AC5DB4600E535D9 /* AVFoundationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVFoundationSPI.h; sourceTree = "<group>"; };
+               07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlaybackTargetContext.h; sourceTree = "<group>"; };
                07FBDE2B18FED178001A7CFF /* JSDataCueCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDataCueCustom.cpp; sourceTree = "<group>"; };
                07FE99DA18807A7D00256648 /* HTMLMediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMediaSession.cpp; sourceTree = "<group>"; };
                07FE99DB18807A7D00256648 /* HTMLMediaSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMediaSession.h; sourceTree = "<group>"; };
                076F0D0812B8192700C26AA4 /* avfoundation */ = {
                        isa = PBXGroup;
                        children = (
+                               071E496F1AD5AB5E008A50B4 /* MediaPlaybackTargetMac.h */,
+                               071E496D1AD5AA0D008A50B4 /* MediaPlaybackTargetMac.mm */,
                                DF9AFD6F13FC31B00015FEB7 /* objc */,
                                CDE3A85217F5FCE600C5BE20 /* AudioTrackPrivateAVF.h */,
                                07E9E12F18F62B370011A3A4 /* InbandMetadataTextTrackPrivateAVF.cpp */,
                                07B442D5166C70B000556CAD /* InbandTextTrackPrivateAVF.h */,
                                078E43DB1ABB6F6F001C2FA6 /* MediaPlaybackTargetPickerMac.h */,
                                078E43DC1ABB6F6F001C2FA6 /* MediaPlaybackTargetPickerMac.mm */,
-                               07E3DFD21A9E78A500764CA8 /* MediaPlaybackTargetMac.mm */,
                                076F0D0912B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.cpp */,
                                076F0D0A12B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.h */,
                                CD641EBD1819B35900EE4C41 /* MediaTimeAVFoundation.cpp */,
                                141DC04E164834B900371E5A /* LayoutSize.h */,
                                6C568CAE19DAFEA000430CA2 /* MaskImageOperation.cpp */,
                                6C568CAF19DAFEA000430CA2 /* MaskImageOperation.h */,
+                               07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */,
                                078E43D71ABB6C7E001C2FA6 /* MediaPlaybackTargetPicker.cpp */,
                                078E43D81ABB6C7E001C2FA6 /* MediaPlaybackTargetPicker.h */,
                                079216531AA560AA00A3C049 /* MediaPlaybackTargetPickerClient.h */,
                                B2FA3D9D0AB75A6F000E5AC4 /* JSSVGGradientElement.h in Headers */,
                                7BE7427381FA906FBB4F0F2C /* JSSVGGraphicsElement.h in Headers */,
                                8485227C1190162C006EDC7F /* JSSVGHKernElement.h in Headers */,
+                               07F876841AD580F900905849 /* MediaPlaybackTargetContext.h in Headers */,
                                B2FA3D9F0AB75A6F000E5AC4 /* JSSVGImageElement.h in Headers */,
                                B2FA3DA10AB75A6F000E5AC4 /* JSSVGLength.h in Headers */,
                                B2FA3DA30AB75A6F000E5AC4 /* JSSVGLengthList.h in Headers */,
                                CDC8B5A3180463470016E685 /* MediaPlayerPrivateMediaSourceAVFObjC.h in Headers */,
                                E44613E60CD681A900FADA75 /* MediaPlayerPrivateQTKit.h in Headers */,
                                4E19592A0A39DACC00220FE5 /* MediaQuery.h in Headers */,
+                               071E49701AD5AB5E008A50B4 /* MediaPlaybackTargetMac.h in Headers */,
                                4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */,
                                4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */,
                                D3A94A39122DABAC00A37BBC /* MediaQueryList.h in Headers */,
                                9BAB6C6D12550631001626D4 /* EditingStyle.cpp in Sources */,
                                4B3043CC0AE0373B00A82647 /* Editor.cpp in Sources */,
                                93A38B4B0D0E5808006872C2 /* EditorCommand.cpp in Sources */,
-                               0760C17A1AA8FC7D009ED7B8 /* MediaPlaybackTargetMac.mm in Sources */,
                                FED13D3A0CEA934600D89466 /* EditorIOS.mm in Sources */,
                                ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */,
                                A8C4A80809D563270003AC8D /* Element.cpp in Sources */,
                                A7D6B34A0F61104500B79FD1 /* WorkerScriptLoader.cpp in Sources */,
                                2E4346540F546A8200B0F1BA /* WorkerThread.cpp in Sources */,
                                0B9056F80F2685F30095FF6A /* WorkerThreadableLoader.cpp in Sources */,
+                               071E496E1AD5AA0D008A50B4 /* MediaPlaybackTargetMac.mm in Sources */,
                                97AABD2C14FA09D5007457AE /* WorkerThreadableWebSocketChannel.cpp in Sources */,
                                93309E23099E64920056E581 /* WrapContentsInDummySpanCommand.cpp in Sources */,
                                51B45D201AB8D1E200117CD2 /* ContentExtension.cpp in Sources */,
index 36571e4..37800f6 100644 (file)
@@ -6539,7 +6539,9 @@ void Document::addPlaybackTargetPickerClient(MediaPlaybackTargetPickerClient& cl
 
     m_playbackTargetClients.add(&client);
 
-    client.didChoosePlaybackTarget(page->playbackTarget());
+    RefPtr<MediaPlaybackTarget> target = page->playbackTarget();
+    if (target)
+        client.didChoosePlaybackTarget(*target);
     client.externalOutputDeviceAvailableDidChange(page->hasWirelessPlaybackTarget());
 }
 
@@ -6580,10 +6582,10 @@ void Document::playbackTargetAvailabilityDidChange(bool available)
         client->externalOutputDeviceAvailableDidChange(available);
 }
 
-void Document::didChoosePlaybackTarget(const MediaPlaybackTarget& device)
+void Document::didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&& device)
 {
     for (auto* client : m_playbackTargetClients)
-        client->didChoosePlaybackTarget(device);
+        client->didChoosePlaybackTarget(device.copyRef());
 }
 
 #endif
index 2649d95..dff8e70 100644 (file)
@@ -1235,7 +1235,7 @@ public:
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     void showPlaybackTargetPicker(const HTMLMediaElement&);
-    void didChoosePlaybackTarget(const MediaPlaybackTarget&);
+    void didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&&);
     void addPlaybackTargetPickerClient(MediaPlaybackTargetPickerClient&);
     void removePlaybackTargetPickerClient(MediaPlaybackTargetPickerClient&);
     bool requiresPlaybackTargetRouteMonitoring();
index 15e4b83..75b173d 100644 (file)
@@ -4886,11 +4886,11 @@ void HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent()
     m_asyncEventQueue.enqueueEvent(event.release());
 }
 
-void HTMLMediaElement::setWirelessPlaybackTarget(const MediaPlaybackTarget& device)
+void HTMLMediaElement::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& device)
 {
     LOG(Media, "HTMLMediaElement::setWirelessPlaybackTarget(%p)", this);
     if (m_player)
-        m_player->setWirelessPlaybackTarget(device);
+        m_player->setWirelessPlaybackTarget(WTF::move(device));
 }
 
 bool HTMLMediaElement::canPlayToWirelessPlaybackTarget() const
index 7d1a603..452c343 100644 (file)
@@ -363,7 +363,7 @@ public:
     virtual void wirelessRoutesAvailableDidChange() override;
     virtual bool canPlayToWirelessPlaybackTarget() const override;
     virtual bool isPlayingToWirelessPlaybackTarget() const override;
-    virtual void setWirelessPlaybackTarget(const MediaPlaybackTarget&) override;
+    virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) override;
     virtual void startPlayingToPlaybackTarget() override;
     virtual void stopPlayingToPlaybackTarget() override;
 #endif
index da80629..ac03f3f 100644 (file)
@@ -76,7 +76,6 @@ HTMLMediaSession::HTMLMediaSession(MediaSessionClient& client)
     , m_restrictions(NoRestrictions)
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     , m_targetAvailabilityChangedTimer(*this, &HTMLMediaSession::targetAvailabilityChangedTimerFired)
-    , m_playbackTarget(std::make_unique<MediaPlaybackTarget>())
 #endif
 {
 }
@@ -286,11 +285,11 @@ void HTMLMediaSession::setHasPlaybackTargetAvailabilityListeners(const HTMLMedia
 #endif
 }
 
-void HTMLMediaSession::didChoosePlaybackTarget(const MediaPlaybackTarget& device)
+void HTMLMediaSession::didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&& device)
 {
-    m_playbackTarget->setDevicePickerContext(device.devicePickerContext());
-    client().setWirelessPlaybackTarget(*m_playbackTarget.get());
-    if (device.hasActiveRoute() && MediaSessionManager::sharedManager().currentSession() == this)
+    m_playbackTarget = WTF::move(device);
+    client().setWirelessPlaybackTarget(*m_playbackTarget.copyRef());
+    if (m_playbackTarget->hasActiveRoute() && MediaSessionManager::sharedManager().currentSession() == this)
         startPlayingToPlaybackTarget();
     else
         stopPlayingToPlaybackTarget();
index bdc46f2..015a5df 100644 (file)
@@ -104,7 +104,7 @@ private:
     void targetAvailabilityChangedTimerFired();
 
     // MediaPlaybackTargetPickerClient
-    virtual void didChoosePlaybackTarget(const MediaPlaybackTarget&) override;
+    virtual void didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&&) override;
     virtual void externalOutputDeviceAvailableDidChange(bool) const override;
     virtual bool requiresPlaybackTargetRouteMonitoring() const override;
 #endif
@@ -113,7 +113,7 @@ private:
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     mutable Timer m_targetAvailabilityChangedTimer;
-    std::unique_ptr<MediaPlaybackTarget> m_playbackTarget;
+    RefPtr<MediaPlaybackTarget> m_playbackTarget;
     bool m_hasPlaybackTargetAvailabilityListeners { false };
     mutable bool m_hasPlaybackTargets { false };
 #endif
index 4dd4142..52146f6 100644 (file)
@@ -214,9 +214,6 @@ Page::Page(PageConfiguration& pageConfiguration)
     , m_userContentController(WTF::move(pageConfiguration.userContentController))
     , m_visitedLinkStore(*WTF::move(pageConfiguration.visitedLinkStore))
     , m_sessionID(SessionID::defaultSessionID())
-#if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    , m_playbackTarget(std::make_unique<MediaPlaybackTarget>())
-#endif
     , m_isClosing(false)
     , m_isPlayingAudio(false)
 {
@@ -1686,6 +1683,14 @@ void Page::setSessionID(SessionID sessionID)
 }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
+RefPtr<MediaPlaybackTarget> Page::playbackTarget() const
+{
+    if (!m_playbackTarget)
+        return nullptr;
+
+    return m_playbackTarget.copyRef();
+}
+
 void Page::showPlaybackTargetPicker(const WebCore::IntPoint& location, bool isVideo)
 {
 #if PLATFORM(IOS)
@@ -1697,11 +1702,11 @@ void Page::showPlaybackTargetPicker(const WebCore::IntPoint& location, bool isVi
 #endif
 }
 
-void Page::didChoosePlaybackTarget(const MediaPlaybackTarget& target)
+void Page::didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&& target)
 {
-    m_playbackTarget->setDevicePickerContext(target.devicePickerContext());
+    m_playbackTarget = WTF::move(target);
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext())
-        frame->document()->didChoosePlaybackTarget(target);
+        frame->document()->didChoosePlaybackTarget(*m_playbackTarget.copyRef());
 }
 
 void Page::playbackTargetAvailabilityDidChange(bool available)
index 947f81a..cde9310 100644 (file)
@@ -430,10 +430,10 @@ public:
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     void showPlaybackTargetPicker(const WebCore::IntPoint&, bool);
     bool hasWirelessPlaybackTarget() const { return m_hasWirelessPlaybackTarget; }
-    MediaPlaybackTarget& playbackTarget() const { return *m_playbackTarget.get(); }
+    RefPtr<MediaPlaybackTarget> playbackTarget() const;
     void configurePlaybackTargetMonitoring();
 
-    WEBCORE_EXPORT void didChoosePlaybackTarget(const MediaPlaybackTarget&);
+    WEBCORE_EXPORT void didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&&);
     WEBCORE_EXPORT void playbackTargetAvailabilityDidChange(bool);
 #endif
 
@@ -590,7 +590,7 @@ private:
     SessionID m_sessionID;
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    std::unique_ptr<MediaPlaybackTarget> m_playbackTarget;
+    RefPtr<MediaPlaybackTarget> m_playbackTarget;
     bool m_hasWirelessPlaybackTarget { false };
 #endif
 
index bfe7efb..9990cea 100644 (file)
@@ -124,7 +124,7 @@ public:
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     // MediaPlaybackTargetPickerClient
-    virtual void didChoosePlaybackTarget(const MediaPlaybackTarget&) override { }
+    virtual void didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&&) override { }
     virtual void externalOutputDeviceAvailableDidChange(bool) const override { }
     virtual bool requiresPlaybackTargetRouteMonitoring() const override { return false; }
 #endif
@@ -169,7 +169,7 @@ public:
     virtual bool overrideBackgroundPlaybackRestriction() const = 0;
 
     virtual void wirelessRoutesAvailableDidChange() { }
-    virtual void setWirelessPlaybackTarget(const MediaPlaybackTarget&) { }
+    virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) { }
     virtual bool canPlayToWirelessPlaybackTarget() const { return false; }
     virtual bool isPlayingToWirelessPlaybackTarget() const { return false; }
     virtual void startPlayingToPlaybackTarget() { }
index b24fce4..34f59a6 100644 (file)
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 
-#include <wtf/RetainPtr.h>
-
-#if PLATFORM(COCOA)
-OBJC_CLASS NSKeyedArchiver;
-OBJC_CLASS NSKeyedUnarchiver;
-OBJC_CLASS AVOutputContext;
-#endif
+#include "MediaPlaybackTargetContext.h"
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-class MediaPlaybackTarget {
+class MediaPlaybackTarget : public RefCounted<MediaPlaybackTarget> {
 public:
     virtual ~MediaPlaybackTarget() { }
 
-#if PLATFORM(COCOA)
-    WEBCORE_EXPORT MediaPlaybackTarget(AVOutputContext *context = nil) { m_devicePickerContext = context; }
-
-    WEBCORE_EXPORT void encode(NSKeyedArchiver *) const;
-    WEBCORE_EXPORT static bool decode(NSKeyedUnarchiver *, MediaPlaybackTarget&);
-
-    void setDevicePickerContext(AVOutputContext *context) { m_devicePickerContext = context; }
-    AVOutputContext *devicePickerContext() const { return m_devicePickerContext.get(); }
+    enum TargetType {
+        None,
+        AVFoundation,
+    };
+    virtual TargetType targetType() const { return None; }
 
-#if PLATFORM(IOS)
-    bool hasActiveRoute() const { return false; }
-#else
-    bool hasActiveRoute() const;
-#endif
-
-#else
-    void setDevicePickerContext(AVOutputContext *) { }
-    AVOutputContext *devicePickerContext() const { return nullptr; }
-    bool hasActiveRoute() const { return false; }
-#endif
+    virtual const MediaPlaybackTargetContext& targetContext() const { return NoMediaPlaybackTargetContext; }
+    virtual bool hasActiveRoute() const { return false; }
 
 protected:
-#if PLATFORM(COCOA)
-    RetainPtr<AVOutputContext> m_devicePickerContext;
-#endif
+    MediaPlaybackTarget() { }
 };
 
 }
diff --git a/Source/WebCore/platform/graphics/MediaPlaybackTargetContext.h b/Source/WebCore/platform/graphics/MediaPlaybackTargetContext.h
new file mode 100644 (file)
index 0000000..b76f07c
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef MediaPlaybackTargetContext_h
+#define MediaPlaybackTargetContext_h
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+
+OBJC_CLASS AVOutputContext;
+
+#if PLATFORM(COCOA)
+OBJC_CLASS NSKeyedArchiver;
+OBJC_CLASS NSKeyedUnarchiver;
+#endif
+
+namespace WebCore {
+
+struct MediaPlaybackTargetContext {
+
+    enum ContextType : int32_t {
+        None,
+        AVOutputContextType,
+    } type;
+
+    union {
+        AVOutputContext* avOutputContext;
+    } context;
+
+    bool encodingRequiresPlatformData() const { return type == AVOutputContextType; }
+};
+
+const MediaPlaybackTargetContext NoMediaPlaybackTargetContext = { MediaPlaybackTargetContext::None, {nullptr} };
+
+}
+
+#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
+
+#endif // MediaPlaybackTargetContext 
index 7d14020..0ed1d37 100644 (file)
@@ -28,6 +28,8 @@
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 
+#include <wtf/Ref.h>
+
 namespace WebCore {
 
 class FloatRect;
@@ -40,7 +42,7 @@ public:
         virtual ~Client() { }
 
     public:
-        virtual void didChoosePlaybackTarget(const MediaPlaybackTarget&) = 0;
+        virtual void didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&&) = 0;
         virtual void externalOutputDeviceAvailableDidChange(bool) = 0;
 
         void invalidate();
index 162936a..8ca9f13 100644 (file)
@@ -38,7 +38,7 @@ class MediaPlaybackTargetPickerClient {
 public:
     virtual ~MediaPlaybackTargetPickerClient() { }
 
-    virtual void didChoosePlaybackTarget(const MediaPlaybackTarget&) = 0;
+    virtual void didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&&) = 0;
     virtual void externalOutputDeviceAvailableDidChange(bool) const = 0;
 
     virtual bool requiresPlaybackTargetRouteMonitoring() const = 0;
index a52adc2..15c02e2 100644 (file)
@@ -883,9 +883,9 @@ bool MediaPlayer::isPlayingToWirelessPlaybackTarget() const
     return m_private->isPlayingToWirelessPlaybackTarget();
 }
 
-void MediaPlayer::setWirelessPlaybackTarget(const MediaPlaybackTarget& device)
+void MediaPlayer::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& device)
 {
-    m_private->setWirelessPlaybackTarget(device);
+    m_private->setWirelessPlaybackTarget(WTF::move(device));
 }
 
 void MediaPlayer::startPlayingToPlaybackTarget()
index e0fb932..97c1613 100644 (file)
@@ -481,7 +481,7 @@ public:
 
     bool canPlayToWirelessPlaybackTarget() const;
     bool isPlayingToWirelessPlaybackTarget() const;
-    void setWirelessPlaybackTarget(const MediaPlaybackTarget&);
+    void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&);
 
     void startPlayingToPlaybackTarget();
     void stopPlayingToPlaybackTarget();
index 0bd1672..54460ad 100644 (file)
@@ -171,7 +171,7 @@ public:
 
     virtual bool canPlayToWirelessPlaybackTarget() const { return false; }
     virtual bool isPlayingToWirelessPlaybackTarget() { return false; }
-    virtual void setWirelessPlaybackTarget(const MediaPlaybackTarget&) { }
+    virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) { }
 
     virtual void startPlayingToPlaybackTarget() { }
     virtual void stopPlayingToPlaybackTarget() { }
diff --git a/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetMac.h b/Source/WebCore/platform/graphics/avfoundation/MediaPlaybackTargetMac.h
new file mode 100644 (file)
index 0000000..61b2a45
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef MediaPlaybackTargetMac_h
+#define MediaPlaybackTargetMac_h
+
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+
+#include "MediaPlaybackTarget.h"
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+class MediaPlaybackTargetMac : public MediaPlaybackTarget {
+public:
+    WEBCORE_EXPORT static Ref<MediaPlaybackTarget> create(AVOutputContext *);
+
+    virtual ~MediaPlaybackTargetMac();
+
+    virtual TargetType targetType() const { return AVFoundation; }
+
+    virtual const MediaPlaybackTargetContext& targetContext() const;
+    virtual bool hasActiveRoute() const;
+
+    AVOutputContext *outputContext() const { return m_outputContext.get(); }
+
+protected:
+    MediaPlaybackTargetMac(AVOutputContext *);
+
+    RetainPtr<AVOutputContext> m_outputContext;
+    mutable MediaPlaybackTargetContext m_context;
+};
+
+MediaPlaybackTargetMac* toMediaPlaybackTargetMac(MediaPlaybackTarget*);
+const MediaPlaybackTargetMac* toMediaPlaybackTargetMac(const MediaPlaybackTarget*);
+
+}
+
+#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
+
+#endif
index 9dd76fd..b506847 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #import "config.h"
-#import "MediaPlaybackTarget.h"
+#import "MediaPlaybackTargetMac.h"
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
 
@@ -37,37 +37,45 @@ SOFT_LINK_CLASS(AVFoundation, AVOutputContext)
 
 namespace WebCore {
 
-static NSString * const deviceContextKey = @"deviceContext";
+Ref<MediaPlaybackTarget> MediaPlaybackTargetMac::create(AVOutputContext *context)
+{
+    return adoptRef(*new MediaPlaybackTargetMac(context));
+}
 
-void MediaPlaybackTarget::encode(NSKeyedArchiver *archiver) const
+MediaPlaybackTargetMac::MediaPlaybackTargetMac(AVOutputContext *context)
+    : MediaPlaybackTarget()
+    , m_outputContext(context)
 {
-    if ([getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
-        [archiver encodeObject:m_devicePickerContext.get() forKey:deviceContextKey];
 }
 
-bool MediaPlaybackTarget::decode(NSKeyedUnarchiver *unarchiver, MediaPlaybackTarget& playbackTarget)
+MediaPlaybackTargetMac::~MediaPlaybackTargetMac()
 {
-    if (![getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
-        return false;
+}
 
-    AVOutputContext *context = nil;
-    @try {
-        context = [unarchiver decodeObjectOfClass:getAVOutputContextClass() forKey:deviceContextKey];
-    } @catch (NSException *exception) {
-        LOG_ERROR("The target picker being decoded is not a AVOutputContext.");
-        return false;
-    }
+const MediaPlaybackTargetContext& MediaPlaybackTargetMac::targetContext() const
+{
+    m_context.type = MediaPlaybackTargetContext::AVOutputContextType;
+    m_context.context.avOutputContext = m_outputContext.get();
 
-    playbackTarget.m_devicePickerContext = context;
+    return m_context;
+}
 
-    return true;
+bool MediaPlaybackTargetMac::hasActiveRoute() const
+{
+    return m_outputContext && m_outputContext.get().deviceName;
 }
 
-bool MediaPlaybackTarget::hasActiveRoute() const
+
+MediaPlaybackTargetMac* toMediaPlaybackTargetMac(MediaPlaybackTarget* rep)
 {
-    return m_devicePickerContext && m_devicePickerContext.get().deviceName;
+    return const_cast<MediaPlaybackTargetMac*>(toMediaPlaybackTargetMac(const_cast<const MediaPlaybackTarget*>(rep)));
 }
 
+const MediaPlaybackTargetMac* toMediaPlaybackTargetMac(const MediaPlaybackTarget* rep)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(rep->targetType() == MediaPlaybackTarget::AVFoundation);
+    return static_cast<const MediaPlaybackTargetMac*>(rep);
+}
 
 } // namespace WebCore
 
index 1e1308c..a441567 100644 (file)
@@ -31,7 +31,7 @@
 #import <WebCore/AVFoundationSPI.h>
 #import <WebCore/AVKitSPI.h>
 #import <WebCore/FloatRect.h>
-#import <WebCore/MediaPlaybackTarget.h>
+#import <WebCore/MediaPlaybackTargetMac.h>
 #import <WebCore/SoftLinking.h>
 #import <objc/runtime.h>
 #import <wtf/MainThread.h>
@@ -133,10 +133,7 @@ void MediaPlaybackTargetPickerMac::currentDeviceDidChange()
     if (!devicePicker)
         return;
 
-    if (devicePicker.isExternalOutputDevicePicked)
-        m_client->didChoosePlaybackTarget(WebCore::MediaPlaybackTarget([devicePicker outputContext]));
-    else
-        m_client->didChoosePlaybackTarget(WebCore::MediaPlaybackTarget(nil));
+    m_client->didChoosePlaybackTarget(WebCore::MediaPlaybackTargetMac::create([devicePicker outputContext]));
 }
 
 void MediaPlaybackTargetPickerMac::startingMonitoringPlaybackTargets()
index 08e47a6..ddead33 100644 (file)
@@ -282,7 +282,7 @@ private:
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
-    virtual void setWirelessPlaybackTarget(const MediaPlaybackTarget&) override;
+    virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) override;
     virtual void startPlayingToPlaybackTarget() override;
     virtual void stopPlayingToPlaybackTarget() override;
     virtual bool isPlayingToWirelessPlaybackTarget();
index 7d01093..6475a06 100644 (file)
@@ -47,7 +47,7 @@
 #import "OutOfBandTextTrackPrivateAVF.h"
 #import "URL.h"
 #import "Logging.h"
-#import "MediaPlaybackTarget.h"
+#import "MediaPlaybackTargetMac.h"
 #import "MediaSelectionGroupAVFObjC.h"
 #import "MediaTimeAVFoundation.h"
 #import "PlatformTimeRanges.h"
@@ -2777,9 +2777,11 @@ void MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled(bool d
 }
 
 #if !PLATFORM(IOS)
-void MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget(const MediaPlaybackTarget& target)
+void MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& target)
 {
-    m_outputContext = target.devicePickerContext();
+    MediaPlaybackTargetMac* macTarget = toMediaPlaybackTargetMac(&target.get());
+
+    m_outputContext = macTarget->outputContext();
     LOG(Media, "MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget(%p) - target = %p", this, m_outputContext.get());
 
     if (!m_outputContext || !m_outputContext.get().deviceName)
index ff741c1..8ab049f 100644 (file)
@@ -173,7 +173,7 @@ private:
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     virtual bool isCurrentPlaybackTargetSupported() const override;
-    virtual void setWirelessPlaybackTarget(const MediaPlaybackTarget&);
+    virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&);
     virtual void startPlayingToPlaybackTarget() override;
     virtual void stopPlayingToPlaybackTarget() override;
     void togglePlayingToPlaybackTarget();
@@ -221,7 +221,7 @@ private:
     mutable bool m_loadingProgressed;
     bool m_hasAvailableVideoFrame;
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    std::unique_ptr<MediaPlaybackTarget> m_playbackTarget;
+    RefPtr<MediaPlaybackTarget> m_playbackTarget;
     bool m_currentPlaybackTargetIsSupported { true };
 #endif
 };
index d581d0e..4bbc397 100644 (file)
@@ -815,11 +815,9 @@ bool MediaPlayerPrivateMediaSourceAVFObjC::isCurrentPlaybackTargetSupported() co
     return !m_playbackTarget->hasActiveRoute();
 }
 
-void MediaPlayerPrivateMediaSourceAVFObjC::setWirelessPlaybackTarget(const MediaPlaybackTarget& target)
+void MediaPlayerPrivateMediaSourceAVFObjC::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& target)
 {
-    if (!m_playbackTarget)
-        m_playbackTarget = std::make_unique<MediaPlaybackTarget>();
-    m_playbackTarget->setDevicePickerContext(target.devicePickerContext());
+    m_playbackTarget = WTF::move(target);
 }
 
 void MediaPlayerPrivateMediaSourceAVFObjC::togglePlayingToPlaybackTarget()
index 863fd36..3f4e6a3 100644 (file)
@@ -181,7 +181,7 @@ private:
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     virtual bool isCurrentPlaybackTargetSupported() const override;
-    virtual void setWirelessPlaybackTarget(const MediaPlaybackTarget&);
+    virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&);
     virtual void startPlayingToPlaybackTarget() override;
     virtual void stopPlayingToPlaybackTarget() override;
     void togglePlayingToPlaybackTarget();
@@ -215,7 +215,7 @@ private:
     mutable MediaTime m_maxTimeLoadedAtLastDidLoadingProgress;
     mutable FloatSize m_cachedNaturalSize;
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-    std::unique_ptr<MediaPlaybackTarget> m_playbackTarget;
+    RefPtr<MediaPlaybackTarget> m_playbackTarget;
     bool m_currentPlaybackTargetIsSupported { true };
 #endif
 };
index a5860ec..25d4d9c 100644 (file)
@@ -1549,11 +1549,9 @@ bool MediaPlayerPrivateQTKit::isCurrentPlaybackTargetSupported() const
     return !m_playbackTarget->hasActiveRoute();
 }
 
-void MediaPlayerPrivateQTKit::setWirelessPlaybackTarget(const MediaPlaybackTarget& target)
+void MediaPlayerPrivateQTKit::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& target)
 {
-    if (!m_playbackTarget)
-        m_playbackTarget = std::make_unique<MediaPlaybackTarget>();
-    m_playbackTarget->setDevicePickerContext(target.devicePickerContext());
+    m_playbackTarget = WTF::move(target);
 }
 
 void MediaPlayerPrivateQTKit::togglePlayingToPlaybackTarget()
index 5ec950d..6244cd0 100644 (file)
@@ -1,3 +1,14 @@
+2015-04-10  Eric Carlson  <eric.carlson@apple.com>
+
+        [Mac] Refactor MediaPlaybackTarget
+        https://bugs.webkit.org/show_bug.cgi?id=143571
+
+        Reviewed by Jer Noble.
+
+        * WebView/WebMediaPlaybackTargetPicker.h:
+        * WebView/WebMediaPlaybackTargetPicker.mm:
+        (WebMediaPlaybackTargetPicker::didChoosePlaybackTarget): Take a Ref<MediaPlaybackTarget>&&.
+
 2015-04-09  Andy Estes  <aestes@apple.com>
 
         [Cocoa] Add a HAVE(AVKIT) and use it
index af0db7f..f07b4d9 100644 (file)
@@ -44,7 +44,7 @@ public:
     void stopMonitoringPlaybackTargets();
 
     // WebCore::MediaPlaybackTargetPicker::Client
-    virtual void didChoosePlaybackTarget(const WebCore::MediaPlaybackTarget&) override;
+    virtual void didChoosePlaybackTarget(Ref<WebCore::MediaPlaybackTarget>&&) override;
     virtual void externalOutputDeviceAvailableDidChange(bool) override;
 
     void invalidate();
index 8720a7b..b56ab45 100644 (file)
@@ -55,12 +55,12 @@ void WebMediaPlaybackTargetPicker::stopMonitoringPlaybackTargets()
     targetPicker().stopMonitoringPlaybackTargets();
 }
 
-void WebMediaPlaybackTargetPicker::didChoosePlaybackTarget(const WebCore::MediaPlaybackTarget& target)
+void WebMediaPlaybackTargetPicker::didChoosePlaybackTarget(Ref<WebCore::MediaPlaybackTarget>&& target)
 {
     if (!m_page)
         return;
 
-    m_page->didChoosePlaybackTarget(target);
+    m_page->didChoosePlaybackTarget(WTF::move(target));
 }
 
 void WebMediaPlaybackTargetPicker::externalOutputDeviceAvailableDidChange(bool available)
index e67253c..80c2ef9 100644 (file)
@@ -1,3 +1,27 @@
+2015-04-10  Eric Carlson  <eric.carlson@apple.com>
+
+        [Mac] Refactor MediaPlaybackTarget
+        https://bugs.webkit.org/show_bug.cgi?id=143571
+
+        Reviewed by Jer Noble.
+
+        Pass a MediaPlaybackTargetContext across process boundary instead of a MediaPlaybackTarget.
+        * Shared/WebCoreArgumentCoders.h:
+        (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encode): New.
+        (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decode): New.
+        * Shared/mac/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData): New.
+        (IPC::ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData): New.
+        (IPC::ArgumentCoder<MediaPlaybackTarget>::encode): Deleted.
+        (IPC::ArgumentCoder<MediaPlaybackTarget>::decode): Deleted.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didChoosePlaybackTarget): Take a Ref<MediaPlaybackTarget>&&.
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::playbackTargetSelected): Take a Ref<MediaPlaybackTarget>&&.
+
 2015-04-10  Hunseop Jeong  <hs85.jeong@samsung.com>
 
         Fix some minor typos related to the WebProcessCreationParameter. 
index 6c4040d..7df4aea 100644 (file)
 #include <WebCore/SharedBuffer.h>
 #endif // PLATFORM(IOS)
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+#import <WebCore/MediaPlaybackTargetContext.h>
+#endif
+
 using namespace WebCore;
 using namespace WebKit;
 
@@ -2132,4 +2136,30 @@ bool ArgumentCoder<TextIndicatorData>::decode(ArgumentDecoder& decoder, TextIndi
     return true;
 }
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+void ArgumentCoder<MediaPlaybackTargetContext>::encode(ArgumentEncoder& encoder, const MediaPlaybackTargetContext& target)
+{
+    int32_t targetType = target.type;
+    encoder << targetType;
+
+    if (!target.encodingRequiresPlatformData())
+        return;
+
+    encodePlatformData(encoder, target);
+}
+
+bool ArgumentCoder<MediaPlaybackTargetContext>::decode(ArgumentDecoder& decoder, MediaPlaybackTargetContext& target)
+{
+    int32_t targetType;
+    if (!decoder.decode(targetType))
+        return false;
+
+    target.type = static_cast<MediaPlaybackTargetContext::ContextType>(targetType);
+    if (!target.encodingRequiresPlatformData())
+        return false;
+
+    return decodePlatformData(decoder, target);
+}
+#endif
+
 } // namespace IPC
index 81e83be..f978f12 100644 (file)
@@ -117,7 +117,7 @@ class ContentFilterUnblockHandler;
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 namespace WebCore {
-class MediaPlaybackTarget;
+struct MediaPlaybackTargetContext;
 }
 #endif
 
@@ -461,9 +461,11 @@ template<> struct ArgumentCoder<WebCore::TextIndicatorData> {
 };
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-template<> struct ArgumentCoder<WebCore::MediaPlaybackTarget> {
-    static void encode(ArgumentEncoder&, const WebCore::MediaPlaybackTarget&);
-    static bool decode(ArgumentDecoder&, WebCore::MediaPlaybackTarget&);
+template<> struct ArgumentCoder<WebCore::MediaPlaybackTargetContext> {
+    static void encode(ArgumentEncoder&, const WebCore::MediaPlaybackTargetContext&);
+    static bool decode(ArgumentDecoder&, WebCore::MediaPlaybackTargetContext&);
+    static void encodePlatformData(ArgumentEncoder&, const WebCore::MediaPlaybackTargetContext&);
+    static bool decodePlatformData(ArgumentDecoder&, WebCore::MediaPlaybackTargetContext&);
 };
 #endif
 
index 55a2a9b..80a3558 100644 (file)
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-#import <WebCore/MediaPlaybackTarget.h>
+#import <WebCore/AVFoundationSPI.h>
+#import <WebCore/MediaPlaybackTargetContext.h>
+#import <WebCore/SoftLinking.h>
+#import <objc/runtime.h>
+
+SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
+SOFT_LINK_CLASS(AVFoundation, AVOutputContext)
 #endif
 
 using namespace WebCore;
@@ -437,26 +443,52 @@ bool ArgumentCoder<ContentFilterUnblockHandler>::decode(ArgumentDecoder& decoder
 }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-void ArgumentCoder<MediaPlaybackTarget>::encode(ArgumentEncoder& encoder, const MediaPlaybackTarget& target)
+
+static NSString *deviceContextKey()
+{
+    static NSString * const key = @"deviceContext";
+    return key;
+}
+
+void ArgumentCoder<MediaPlaybackTargetContext>::encodePlatformData(ArgumentEncoder& encoder, const MediaPlaybackTargetContext& target)
 {
+    ASSERT(target.type == MediaPlaybackTargetContext::AVOutputContextType);
+
     RetainPtr<NSMutableData> data = adoptNS([[NSMutableData alloc] init]);
     RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
     [archiver setRequiresSecureCoding:YES];
-    target.encode(archiver.get());
+
+    if ([getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
+        [archiver encodeObject:target.context.avOutputContext forKey:deviceContextKey()];
+
     [archiver finishEncoding];
     IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));
+
 }
 
-bool ArgumentCoder<MediaPlaybackTarget>::decode(ArgumentDecoder& decoder, MediaPlaybackTarget& target)
+bool ArgumentCoder<MediaPlaybackTargetContext>::decodePlatformData(ArgumentDecoder& decoder, MediaPlaybackTargetContext& target)
 {
+    ASSERT(target.type == MediaPlaybackTargetContext::AVOutputContextType);
+
+    if (![getAVOutputContextClass() conformsToProtocol:@protocol(NSSecureCoding)])
+        return false;
+
     RetainPtr<CFDataRef> data;
     if (!IPC::decode(decoder, data))
         return false;
 
     RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
     [unarchiver setRequiresSecureCoding:YES];
-    if (!MediaPlaybackTarget::decode(unarchiver.get(), target))
+
+    AVOutputContext *context = nil;
+    @try {
+        context = [unarchiver decodeObjectOfClass:getAVOutputContextClass() forKey:deviceContextKey()];
+    } @catch (NSException *exception) {
+        LOG_ERROR("The target picker being decoded is not a AVOutputContext.");
         return false;
+    }
+
+    target.context.avOutputContext = context;
     
     [unarchiver finishDecoding];
     return true;
index 6be7539..41da2c7 100644 (file)
 #include <WebCore/CairoUtilities.h>
 #endif
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
+#include <WebCore/MediaPlaybackTarget.h>
+#endif
+
 // This controls what strategy we use for mouse wheel coalescing.
 #define MERGE_WHEEL_EVENTS 1
 
@@ -5719,12 +5723,12 @@ void WebPageProxy::stopMonitoringPlaybackTargets()
     devicePickerProxy().stopMonitoringPlaybackTargets();
 }
 
-void WebPageProxy::didChoosePlaybackTarget(const WebCore::MediaPlaybackTarget& target)
+void WebPageProxy::didChoosePlaybackTarget(Ref<MediaPlaybackTarget>&& target)
 {
     if (!isValid())
         return;
 
-    m_process->send(Messages::WebPage::PlaybackTargetSelected(target), m_pageID);
+    m_process->send(Messages::WebPage::PlaybackTargetSelected(target->targetContext()), m_pageID);
 }
 
 void WebPageProxy::externalOutputDeviceAvailableDidChange(bool available)
index 7d11021..468f747 100644 (file)
@@ -1024,7 +1024,7 @@ public:
     void stopMonitoringPlaybackTargets();
 
     // WebCore::MediaPlaybackTargetPicker::Client
-    virtual void didChoosePlaybackTarget(const WebCore::MediaPlaybackTarget&) override;
+    virtual void didChoosePlaybackTarget(Ref<WebCore::MediaPlaybackTarget>&&) override;
     virtual void externalOutputDeviceAvailableDidChange(bool) override;
 #endif
 
index 963a873..9bc33f7 100644 (file)
@@ -126,7 +126,6 @@ class HTMLPlugInElement;
 class HTMLPlugInImageElement;
 class IntPoint;
 class KeyboardEvent;
-class MediaPlaybackTarget;
 class Page;
 class PrintContext;
 class Range;
@@ -139,6 +138,7 @@ class URL;
 class VisibleSelection;
 struct Highlight;
 struct KeypressCommand;
+struct MediaPlaybackTargetContext;
 struct TextCheckingResult;
 }
 
@@ -1105,7 +1105,7 @@ private:
     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
-    void playbackTargetSelected(const WebCore::MediaPlaybackTarget& outputDevice) const;
+    void playbackTargetSelected(const WebCore::MediaPlaybackTargetContext& outputDevice) const;
     void playbackTargetAvailabilityDidChange(bool);
 #endif
 
index 0022782..49a24e1 100644 (file)
@@ -418,7 +418,7 @@ messages -> WebPage LegacyReceiver {
     SetShouldDispatchFakeMouseMoveEvents(bool shouldDispatchFakeMouseMoveEvents)
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
-    PlaybackTargetSelected(WebCore::MediaPlaybackTarget target)
+    PlaybackTargetSelected(struct WebCore::MediaPlaybackTargetContext target)
     PlaybackTargetAvailabilityDidChange(bool available)
 #endif
 
index d8d71f6..24cd746 100644 (file)
@@ -88,7 +88,7 @@
 #import <WebKitSystemInterface.h>
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
-#include <WebCore/MediaPlaybackTarget.h>
+#include <WebCore/MediaPlaybackTargetMac.h>
 #endif
 
 using namespace WebCore;
@@ -1228,9 +1228,11 @@ void WebPage::setFont(const String& fontFamily, double fontSize, uint64_t fontTr
 }
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
-void WebPage::playbackTargetSelected(const WebCore::MediaPlaybackTarget& playbackTarget) const
+void WebPage::playbackTargetSelected(const WebCore::MediaPlaybackTargetContext& targetContext) const
 {
-    m_page->didChoosePlaybackTarget(playbackTarget);
+    ASSERT(targetContext.type == MediaPlaybackTargetContext::AVOutputContextType);
+
+    m_page->didChoosePlaybackTarget(WebCore::MediaPlaybackTargetMac::create(targetContext.context.avOutputContext));
 }
 
 void WebPage::playbackTargetAvailabilityDidChange(bool changed)