<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200379] tags/Safari-602.1.30.4/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200379">200379</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-05-03 10:31:04 -0700 (Tue, 03 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/200157">r200157</a>. rdar://problem/25841037</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#tagsSafari6021304SourceWebCoreChangeLog">tags/Safari-602.1.30.4/Source/WebCore/ChangeLog</a></li>
<li><a href="#tagsSafari6021304SourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementmm">tags/Safari-602.1.30.4/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm</a></li>
<li><a href="#tagsSafari6021304SourceWebCoreplatformmacWebPlaybackSessionInterfaceMach">tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h</a></li>
<li><a href="#tagsSafari6021304SourceWebCoreplatformmacWebPlaybackSessionInterfaceMacmm">tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm</a></li>
<li><a href="#tagsSafari6021304SourceWebCoreplatformmacWebVideoFullscreenInterfaceMach">tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h</a></li>
<li><a href="#tagsSafari6021304SourceWebCoreplatformmacWebVideoFullscreenInterfaceMacmm">tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm</a></li>
<li><a href="#tagsSafari6021304SourceWebKit2ChangeLog">tags/Safari-602.1.30.4/Source/WebKit2/ChangeLog</a></li>
<li><a href="#tagsSafari6021304SourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymm">tags/Safari-602.1.30.4/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm</a></li>
<li><a href="#tagsSafari6021304SourceWebKit2WebProcesscocoaWebPlaybackSessionManagermm">tags/Safari-602.1.30.4/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.mm</a></li>
<li><a href="#tagsSafari6021304SourceWebKit2WebProcesscocoaWebVideoFullscreenManagermm">tags/Safari-602.1.30.4/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="tagsSafari6021304SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebCore/ChangeLog (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebCore/ChangeLog        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebCore/ChangeLog        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2016-05-03 Babak Shafiei <bshafiei@apple.com>
+
+ Merge r200157.
+
+ 2016-04-26 Ada Chan <adachan@apple.com>
+
+ Set WebVideoFullscreenInterfaceMac up as a client of WebPlaybackSessionInterfaceMac to listen for playback state changes
+ https://bugs.webkit.org/show_bug.cgi?id=157008
+
+ Reviewed by Jer Noble.
+
+ For WebVideoFullscreenInterfaceMac to be notified when the playback rate changes in
+ WebPlaybackSessionInterfaceMac, add a new WebPlaybackSessionInterfaceMacClient base
+ class that WebVideoFullscreenInterfaceMac implements, similar to the WebPlaybackSessionInterfaceAVKitClient
+ on iOS. WebVideoFullscreenInterfaceMac sets itself as a client of WebPlaybackSessionInterfaceMac
+ so WebPlaybackSessionInterfaceMac can notify WebVideoFullscreenInterfaceMac whenever the
+ playback rate changes.
+
+ * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
+ (WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface):
+ We should not change the WebPlaybackSessionModelMediaElement's interface here since WebPlaybackSessionManager
+ has already set that up when creating the context for this media element.
+ (WebVideoFullscreenModelVideoElement::setVideoElement):
+ We should not change the WebPlaybackSessionModelMediaElement's media element here because
+ this will be called with NULL when the fullscreen context is cleaned up, but the
+ WebPlaybackSessionModelMediaElement might still need to stay around. We'll make sure the
+ WebPlaybackSessionModelMediaElement's media element is set when setting up the fullscreen
+ context in WebVideoFullscreenManager::enterVideoFullscreenForVideoElement().
+
+ * platform/mac/WebPlaybackSessionInterfaceMac.h:
+ (WebCore::WebPlaybackSessionInterfaceMacClient::~WebPlaybackSessionInterfaceMacClient):
+
+ * platform/mac/WebPlaybackSessionInterfaceMac.mm:
+ (WebCore::WebPlaybackSessionInterfaceMac::setClient):
+ Set the client. Notify the client about the current playback state.
+ (WebCore::WebPlaybackSessionInterfaceMac::setRate):
+ If a client is set, let that client know about the change in playback rate.
+
+ * platform/mac/WebVideoFullscreenInterfaceMac.h:
+ * platform/mac/WebVideoFullscreenInterfaceMac.mm:
+ (WebCore::WebVideoFullscreenInterfaceMac::WebVideoFullscreenInterfaceMac):
+ Set itself as a client of WebPlaybackSessionInterfaceMac.
+ (WebCore::WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac):
+ Make sure WebPlaybackSessionInterfaceMac won't hold onto a stale pointer to itself.
+ (WebCore::WebVideoFullscreenInterfaceMac::setRate):
+ We don't have to update the WebVideoFullscreenInterfaceMac's rate here anymore. The change
+ in playback rate in WebPlaybackSessionInterfaceMac should trigger
+ WebVideoFullscreenInterfaceMac::rateChanged() to be called.
+ (WebCore::WebVideoFullscreenInterfaceMac::rateChanged):
+ Pass in both the isPlaying state and the playback rate to WebVideoFullscreenInterfaceMacObjC.
+
</ins><span class="cx"> 2016-04-28 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r200201. rdar://problem/25995376
</span></span></pre></div>
<a id="tagsSafari6021304SourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -67,7 +67,6 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_videoFullscreenInterface = interface;
</span><del>- m_playbackSessionModel->setWebPlaybackSessionInterface(interface);
</del><span class="cx">
</span><span class="cx"> if (m_videoFullscreenInterface && m_videoElement)
</span><span class="cx"> m_videoFullscreenInterface->setVideoDimensions(true, m_videoElement->videoWidth(), m_videoElement->videoHeight());
</span><span class="lines">@@ -75,7 +74,6 @@
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenModelVideoElement::setVideoElement(HTMLVideoElement* videoElement)
</span><span class="cx"> {
</span><del>- m_playbackSessionModel->setMediaElement(videoElement);
</del><span class="cx"> if (m_videoElement == videoElement)
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="tagsSafari6021304SourceWebCoreplatformmacWebPlaybackSessionInterfaceMach"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -40,6 +40,13 @@
</span><span class="cx"> class IntRect;
</span><span class="cx"> class WebPlaybackSessionModel;
</span><span class="cx">
</span><ins>+class WebPlaybackSessionInterfaceMacClient {
+public:
+ virtual ~WebPlaybackSessionInterfaceMacClient() { }
+
+ virtual void rateChanged(bool isPlaying, float playbackRate) = 0;
+};
+
</ins><span class="cx"> class WEBCORE_EXPORT WebPlaybackSessionInterfaceMac final
</span><span class="cx"> : public WebPlaybackSessionInterface
</span><span class="cx"> , public RefCounted<WebPlaybackSessionInterfaceMac> {
</span><span class="lines">@@ -51,6 +58,8 @@
</span><span class="cx"> virtual ~WebPlaybackSessionInterfaceMac();
</span><span class="cx"> WebPlaybackSessionModel* webPlaybackSessionModel() const { return m_playbackSessionModel; }
</span><span class="cx"> WEBCORE_EXPORT void setWebPlaybackSessionModel(WebPlaybackSessionModel*);
</span><ins>+ WebPlaybackSessionInterfaceMacClient* client() const { return m_client; }
+ void setClient(WebPlaybackSessionInterfaceMacClient*);
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void resetMediaState() final { }
</span><span class="cx"> WEBCORE_EXPORT void setDuration(double) final;
</span><span class="lines">@@ -70,6 +79,7 @@
</span><span class="cx"> private:
</span><span class="cx"> WebPlaybackSessionModel* m_playbackSessionModel { nullptr };
</span><span class="cx"> RetainPtr<WebPlaybackControlsManager> m_playbackControlsManager;
</span><ins>+ WebPlaybackSessionInterfaceMacClient* m_client { nullptr };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="tagsSafari6021304SourceWebCoreplatformmacWebPlaybackSessionInterfaceMacmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -132,6 +132,16 @@
</span><span class="cx"> m_playbackSessionModel = model;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebPlaybackSessionInterfaceMac::setClient(WebPlaybackSessionInterfaceMacClient* client)
+{
+ m_client = client;
+
+ if (m_client) {
+ float rate = [playBackControlsManager() rate];
+ m_client->rateChanged(!!rate, rate);
+ }
+}
+
</ins><span class="cx"> void WebPlaybackSessionInterfaceMac::setDuration(double duration)
</span><span class="cx"> {
</span><span class="cx"> WebPlaybackControlsManager* controlsManager = playBackControlsManager();
</span><span class="lines">@@ -157,8 +167,10 @@
</span><span class="cx"> void WebPlaybackSessionInterfaceMac::setRate(bool isPlaying, float playbackRate)
</span><span class="cx"> {
</span><span class="cx"> WebPlaybackControlsManager* controlsManager = playBackControlsManager();
</span><ins>+ [controlsManager setRate:isPlaying ? playbackRate : 0.];
</ins><span class="cx">
</span><del>- [controlsManager setRate:isPlaying ? playbackRate : 0.];
</del><ins>+ if (m_client)
+ m_client->rateChanged(isPlaying, playbackRate);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPlaybackSessionInterfaceMac::setSeekableRanges(const TimeRanges& timeRanges)
</span></span></pre></div>
<a id="tagsSafari6021304SourceWebCoreplatformmacWebVideoFullscreenInterfaceMach"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
</span><span class="cx">
</span><span class="cx"> #include "HTMLMediaElementEnums.h"
</span><ins>+#include "WebPlaybackSessionInterfaceMac.h"
</ins><span class="cx"> #include "WebVideoFullscreenInterface.h"
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="lines">@@ -48,6 +49,7 @@
</span><span class="cx">
</span><span class="cx"> class WEBCORE_EXPORT WebVideoFullscreenInterfaceMac
</span><span class="cx"> : public WebVideoFullscreenInterface
</span><ins>+ , private WebPlaybackSessionInterfaceMacClient
</ins><span class="cx"> , public RefCounted<WebVideoFullscreenInterfaceMac> {
</span><span class="cx">
</span><span class="cx"> public:
</span><span class="lines">@@ -93,6 +95,8 @@
</span><span class="cx"> WEBCORE_EXPORT bool mayAutomaticallyShowVideoPictureInPicture() const { return false; }
</span><span class="cx"> void applicationDidBecomeActive() { }
</span><span class="cx">
</span><ins>+ void rateChanged(bool isPlaying, float playbackRate) override;
+
</ins><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx"> WEBCORE_EXPORT WebVideoFullscreenInterfaceMacObjC *videoFullscreenInterfaceObjC();
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="tagsSafari6021304SourceWebCoreplatformmacWebVideoFullscreenInterfaceMacmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.mm        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -51,16 +51,18 @@
</span><span class="cx"> WebVideoFullscreenInterfaceMac::WebVideoFullscreenInterfaceMac(WebPlaybackSessionInterfaceMac& playbackSessionInterface)
</span><span class="cx"> : m_playbackSessionInterface(playbackSessionInterface)
</span><span class="cx"> {
</span><ins>+ m_playbackSessionInterface->setClient(this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WebVideoFullscreenInterfaceMac::~WebVideoFullscreenInterfaceMac()
</span><span class="cx"> {
</span><ins>+ if (m_playbackSessionInterface->client() == this)
+ m_playbackSessionInterface->setClient(nullptr);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenInterfaceMac::setWebVideoFullscreenModel(WebVideoFullscreenModel* model)
</span><span class="cx"> {
</span><span class="cx"> m_videoFullscreenModel = model;
</span><del>- m_playbackSessionInterface->setWebPlaybackSessionModel(model);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebVideoFullscreenInterfaceMac::setWebVideoFullscreenChangeObserver(WebVideoFullscreenChangeObserver* observer)
</span><span class="lines">@@ -103,9 +105,12 @@
</span><span class="cx"> void WebVideoFullscreenInterfaceMac::setRate(bool isPlaying, float playbackRate)
</span><span class="cx"> {
</span><span class="cx"> m_playbackSessionInterface->setRate(isPlaying, playbackRate);
</span><ins>+}
</ins><span class="cx">
</span><ins>+void WebVideoFullscreenInterfaceMac::rateChanged(bool isPlaying, float playbackRate)
+{
</ins><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><del>- [videoFullscreenInterfaceObjC() setRate:isPlaying ? playbackRate : 0.];
</del><ins>+ [videoFullscreenInterfaceObjC() updateIsPlaying:isPlaying newPlaybackRate:playbackRate];
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="tagsSafari6021304SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebKit2/ChangeLog (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebKit2/ChangeLog        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebKit2/ChangeLog        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2016-05-03 Babak Shafiei <bshafiei@apple.com>
+
+ Merge r200157.
+
+ 2016-04-26 Ada Chan <adachan@apple.com>
+
+ Set WebVideoFullscreenInterfaceMac up as a client of WebPlaybackSessionInterfaceMac to listen for playback state changes
+ https://bugs.webkit.org/show_bug.cgi?id=157008
+
+ Reviewed by Jer Noble.
+
+ Since WebVideoFullscreenInterfaceMac holds onto WebPlaybackSessionInterfaceMac, we can't let
+ WebPlaybackSessionManagerProxy unregister the context for that media element while
+ WebVideoFullscreenInterfaceMac is still using it. WebVideoFullscreenInterfaceMac should add
+ to the client count for that WebPlaybackSession context.
+
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
+ (WebKit::WebVideoFullscreenManagerProxy::createModelAndInterface):
+ When the context for the media element is created with the WebVideoFullscreenManagerProxy, it should
+ add one to the client count for the media element context in WebPlaybackSessionManagerProxy.
+ (WebKit::WebVideoFullscreenManagerProxy::removeClientForContext):
+ When WebVideoFullscreenManagerProxy unregisters the context for this media element, it should
+ subtract one from the client count for the media element context in WebPlaybackSessionManagerProxy.
+
+ * WebProcess/cocoa/WebPlaybackSessionManager.mm:
+ (WebKit::WebPlaybackSessionManager::clearPlaybackControlsManager):
+ Bail early if m_controlsManagerContextId is zero. Otherwise, we'd end up sending a
+ ClearPlaybackControlsManager message to the UI process inadvertently.
+ (WebKit::WebPlaybackSessionManager::contextIdForMediaElement):
+ Make sure the model element for the context ID is set to the media element.
+
+ * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+ (WebKit::WebVideoFullscreenManager::createModelAndInterface):
+ When the context for the media element is created with the WebVideoFullscreenManager, it should
+ add one to the client count for the media element context in WebPlaybackSessionManager.
+ (WebKit::WebVideoFullscreenManager::removeContext):
+ When WebVideoFullscreenManager unregisters the context for this media element, it should
+ subtract one from the client count for the media element context in WebPlaybackSessionManager.
+
</ins><span class="cx"> 2016-04-28 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r200201. rdar://problem/25995376
</span></span></pre></div>
<a id="tagsSafari6021304SourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymm"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -318,6 +318,7 @@
</span><span class="cx"> Ref<WebVideoFullscreenModelContext> model = WebVideoFullscreenModelContext::create(*this, playbackSessionModel, contextId);
</span><span class="cx"> auto& playbackSessionInterface = m_playbackSessionManagerProxy->ensureInterface(contextId);
</span><span class="cx"> Ref<PlatformWebVideoFullscreenInterface> interface = PlatformWebVideoFullscreenInterface::create(playbackSessionInterface);
</span><ins>+ m_playbackSessionManagerProxy->addClientForContext(contextId);
</ins><span class="cx">
</span><span class="cx"> interface->setWebVideoFullscreenModel(&model.get());
</span><span class="cx"> interface->setWebVideoFullscreenChangeObserver(&model.get());
</span><span class="lines">@@ -359,6 +360,7 @@
</span><span class="cx"> clientCount--;
</span><span class="cx">
</span><span class="cx"> if (clientCount <= 0) {
</span><ins>+ m_playbackSessionManagerProxy->removeClientForContext(contextId);
</ins><span class="cx"> m_clientCounts.remove(contextId);
</span><span class="cx"> m_contextMap.remove(contextId);
</span><span class="cx"> return;
</span></span></pre></div>
<a id="tagsSafari6021304SourceWebKit2WebProcesscocoaWebPlaybackSessionManagermm"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.mm (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.mm        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.mm        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -261,7 +261,7 @@
</span><span class="cx"> if (foundIterator == m_mediaElements.end())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (m_controlsManagerContextId != foundIterator->value)
</del><ins>+ if (!m_controlsManagerContextId || m_controlsManagerContextId != foundIterator->value)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> removeClientForContext(m_controlsManagerContextId);
</span><span class="lines">@@ -273,7 +273,9 @@
</span><span class="cx"> uint64_t WebPlaybackSessionManager::contextIdForMediaElement(WebCore::HTMLMediaElement& mediaElement)
</span><span class="cx"> {
</span><span class="cx"> auto addResult = m_mediaElements.ensure(&mediaElement, [&] { return nextContextId(); });
</span><del>- return addResult.iterator->value;
</del><ins>+ uint64_t contextId = addResult.iterator->value;
+ ensureModel(contextId).setMediaElement(&mediaElement);
+ return contextId;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark Interface to WebPlaybackSessionInterfaceContext:
</span></span></pre></div>
<a id="tagsSafari6021304SourceWebKit2WebProcesscocoaWebVideoFullscreenManagermm"></a>
<div class="modfile"><h4>Modified: tags/Safari-602.1.30.4/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (200378 => 200379)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-602.1.30.4/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm        2016-05-03 17:24:48 UTC (rev 200378)
+++ tags/Safari-602.1.30.4/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm        2016-05-03 17:31:04 UTC (rev 200379)
</span><span class="lines">@@ -179,6 +179,7 @@
</span><span class="cx"> RefPtr<WebVideoFullscreenModelVideoElement> model = WebVideoFullscreenModelVideoElement::create(playbackSessionModel);
</span><span class="cx"> auto& playbackSessionInterface = m_playbackSessionManager->ensureInterface(contextId);
</span><span class="cx"> RefPtr<WebVideoFullscreenInterfaceContext> interface = WebVideoFullscreenInterfaceContext::create(*this, playbackSessionInterface, contextId);
</span><ins>+ m_playbackSessionManager->addClientForContext(contextId);
</ins><span class="cx">
</span><span class="cx"> interface->setLayerHostingContext(LayerHostingContext::createForExternalHostingProcess());
</span><span class="cx"> model->setWebVideoFullscreenInterface(interface.get());
</span><span class="lines">@@ -210,6 +211,8 @@
</span><span class="cx"> RefPtr<WebVideoFullscreenInterfaceContext> interface;
</span><span class="cx"> std::tie(model, interface) = ensureModelAndInterface(contextId);
</span><span class="cx">
</span><ins>+ m_playbackSessionManager->removeClientForContext(contextId);
+
</ins><span class="cx"> RefPtr<HTMLVideoElement> videoElement = model->videoElement();
</span><span class="cx"> model->setVideoElement(nullptr);
</span><span class="cx"> model->setWebVideoFullscreenInterface(nullptr);
</span></span></pre>
</div>
</div>
</body>
</html>