Title: [206288] branches/safari-602-branch/Source/WebCore

Diff

Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/ChangeLog	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog	2016-09-23 02:10:59 UTC (rev 206288)
@@ -1,5 +1,34 @@
 2016-09-22  Babak Shafiei  <bshaf...@apple.com>
 
+        Merge r206193. rdar://problem/28376161
+
+    2016-09-20  Jer Noble  <jer.no...@apple.com>
+
+            Adopt MRMediaRemoteSetParentApplication.
+            https://bugs.webkit.org/show_bug.cgi?id=162259
+            <rdar://problem/28376161>
+
+            Reviewed by Anders Carlsson.
+
+            Allow MediaSessionManagerMac to retrieve the correct parent application identifier
+            from a PlatformMediaSession so that it can pass that identifier through to MediaRemote
+            via MRMediaRemoteSetParentApplication.
+
+            * Modules/webaudio/AudioContext.cpp:
+            (WebCore::AudioContext::sourceApplicationIdentifier):
+            * Modules/webaudio/AudioContext.h:
+            * platform/audio/PlatformMediaSession.cpp:
+            (WebCore::PlatformMediaSession::sourceApplicationIdentifier):
+            * platform/audio/PlatformMediaSession.h:
+            (WebCore::PlatformMediaSession::resetPlaybackSessionState): Deleted.
+            * platform/audio/mac/MediaSessionManagerMac.mm:
+            (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
+            * platform/mac/MediaRemoteSoftLink.cpp:
+            * platform/mac/MediaRemoteSoftLink.h:
+
+
+2016-09-22  Babak Shafiei  <bshaf...@apple.com>
+
         Merge r206027. rdar://problem/28366812
 
     2016-09-16  Per Arne Vollan  <pvol...@apple.com>

Modified: branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.cpp (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-09-23 02:10:59 UTC (rev 206288)
@@ -48,11 +48,13 @@
 #include "EventNames.h"
 #include "ExceptionCode.h"
 #include "FFTFrame.h"
+#include "Frame.h"
 #include "GainNode.h"
 #include "GenericEventQueue.h"
 #include "HRTFDatabaseLoader.h"
 #include "HRTFPanner.h"
 #include "JSDOMPromise.h"
+#include "NetworkingContext.h"
 #include "OfflineAudioCompletionEvent.h"
 #include "OfflineAudioDestinationNode.h"
 #include "OscillatorNode.h"
@@ -356,6 +358,16 @@
     return downcast<Document>(m_scriptExecutionContext);
 }
 
+String AudioContext::sourceApplicationIdentifier() const
+{
+    Document* document = this->document();
+    if (Frame* frame = document ? document->frame() : nullptr) {
+        if (NetworkingContext* networkingContext = frame->loader().networkingContext())
+            return networkingContext->sourceApplicationIdentifier();
+    }
+    return emptyString();
+}
+
 RefPtr<AudioBuffer> AudioContext::createBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode& ec)
 {
     RefPtr<AudioBuffer> audioBuffer = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate);

Modified: branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.h (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.h	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/Modules/webaudio/AudioContext.h	2016-09-23 02:10:59 UTC (rev 206288)
@@ -316,6 +316,7 @@
     bool canReceiveRemoteControlCommands() const override { return false; }
     void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override { }
     bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override { return false; }
+    String sourceApplicationIdentifier() const override;
 
     // EventTarget
     void refEventTarget() override { ref(); }

Modified: branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.cpp	2016-09-23 02:10:59 UTC (rev 206288)
@@ -6508,7 +6508,7 @@
     return true;
 }
 
-String HTMLMediaElement::mediaPlayerSourceApplicationIdentifier() const
+String HTMLMediaElement::sourceApplicationIdentifier() const
 {
     if (Frame* frame = document().frame()) {
         if (NetworkingContext* networkingContext = frame->loader().networkingContext())

Modified: branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/html/HTMLMediaElement.h	2016-09-23 02:10:59 UTC (rev 206288)
@@ -626,7 +626,8 @@
 
     bool mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&) override;
     void mediaPlayerHandlePlaybackCommand(PlatformMediaSession::RemoteControlCommandType command) override { didReceiveRemoteControlCommand(command); }
-    String mediaPlayerSourceApplicationIdentifier() const override;
+    String sourceApplicationIdentifier() const override;
+    String mediaPlayerSourceApplicationIdentifier() const override { return sourceApplicationIdentifier(); }
     Vector<String> mediaPlayerPreferredAudioCharacteristics() const override;
 
 #if PLATFORM(IOS)

Modified: branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp	2016-09-23 02:10:59 UTC (rev 206288)
@@ -284,6 +284,11 @@
     m_client.setShouldBufferData(PlatformMediaSessionManager::sharedManager().sessionCanLoadMedia(*this));
 }
 
+String PlatformMediaSession::sourceApplicationIdentifier() const
+{
+    return m_client.sourceApplicationIdentifier();
+}
+
 bool PlatformMediaSession::isHidden() const
 {
     return m_client.elementIsHidden();

Modified: branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.h (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.h	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/platform/audio/PlatformMediaSession.h	2016-09-23 02:10:59 UTC (rev 206288)
@@ -160,6 +160,7 @@
 
     void scheduleClientDataBufferingCheck();
     virtual void resetPlaybackSessionState() { }
+    String sourceApplicationIdentifier() const;
 
 protected:
     PlatformMediaSessionClient& client() const { return m_client; }
@@ -217,6 +218,7 @@
     virtual void setShouldPlayToPlaybackTarget(bool) { }
 
     virtual const Document* hostingDocument() const = 0;
+    virtual String sourceApplicationIdentifier() const = 0;
 
 protected:
     virtual ~PlatformMediaSessionClient() { }

Modified: branches/safari-602-branch/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm	2016-09-23 02:10:59 UTC (rev 206288)
@@ -112,11 +112,6 @@
     if (!isMediaRemoteFrameworkAvailable())
         return;
 
-    if (!MRMediaRemoteSetCanBeNowPlayingApplication(true)) {
-        LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetCanBeNowPlayingApplication(true) failed");
-        return;
-    }
-
     const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession();
 
     LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - currentSession = %p", currentSession);
@@ -123,6 +118,7 @@
 
     if (!currentSession) {
         if (m_nowPlayingActive) {
+            MRMediaRemoteSetCanBeNowPlayingApplication(false);
             LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - clearing now playing info");
             MRMediaRemoteSetNowPlayingInfo(nullptr);
             m_nowPlayingActive = false;
@@ -138,6 +134,11 @@
         return;
     }
 
+    if (!MRMediaRemoteSetCanBeNowPlayingApplication(true)) {
+        LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetCanBeNowPlayingApplication(true) failed");
+        return;
+    }
+
     String title = currentSession->title();
     double duration = currentSession->duration();
     double rate = currentSession->state() == PlatformMediaSession::Playing ? 1 : 0;
@@ -172,6 +173,10 @@
     LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - title = \"%s\", rate = %f, duration = %f, now = %f",
         title.utf8().data(), rate, duration, currentTime);
 
+    String parentApplication = currentSession->sourceApplicationIdentifier();
+    if (canLoad_MediaRemote_MRMediaRemoteSetParentApplication() && !parentApplication.isEmpty())
+        MRMediaRemoteSetParentApplication(MRMediaRemoteGetLocalOrigin(), parentApplication.createCFString().get());
+
     m_nowPlayingActive = true;
     MRPlaybackState playbackState = (currentSession->state() == PlatformMediaSession::Playing) ? kMRPlaybackStatePlaying : kMRPlaybackStatePaused;
     MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MRMediaRemoteGetLocalOrigin(), playbackState, dispatch_get_main_queue(), ^(MRMediaRemoteError error) {

Modified: branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp	2016-09-23 02:10:59 UTC (rev 206288)
@@ -42,6 +42,7 @@
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetCanBeNowPlayingApplication, Boolean, (Boolean flag), (flag))
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingInfo, void, (CFDictionaryRef info), (info))
 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin, void, (MROriginRef origin, MRPlaybackState playbackState, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError)), (origin, playbackState, replyQ, completion))
+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetParentApplication, void, (MROriginRef origin, CFStringRef parentAppDisplayID), (origin, parentAppDisplayID))
 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoTitle, CFStringRef);
 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoDuration, CFStringRef);
 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoElapsedTime, CFStringRef);

Modified: branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.h (206287 => 206288)


--- branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.h	2016-09-23 02:10:53 UTC (rev 206287)
+++ branches/safari-602-branch/Source/WebCore/platform/mac/MediaRemoteSoftLink.h	2016-09-23 02:10:59 UTC (rev 206288)
@@ -53,6 +53,8 @@
 #define MRMediaRemoteSetNowPlayingInfo softLink_MediaRemote_MRMediaRemoteSetNowPlayingInfo
 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin, void, (MROriginRef origin, MRPlaybackState playbackState, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError)), (origin, playbackState, replyQ, completion))
 #define MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin softLink_MediaRemote_MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin
+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteSetParentApplication, void, (MROriginRef origin, CFStringRef parentAppDisplayID), (origin, parentAppDisplayID))
+#define MRMediaRemoteSetParentApplication softLink_MediaRemote_MRMediaRemoteSetParentApplication
 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoTitle, CFStringRef);
 #define kMRMediaRemoteNowPlayingInfoTitle get_MediaRemote_kMRMediaRemoteNowPlayingInfoTitle()
 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoDuration, CFStringRef);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to