<!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>[191168] branches/safari-601.1.46-branch</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/191168">191168</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2015-10-15 23:28:51 -0700 (Thu, 15 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/190434">r190434</a>. rdar://problem/22865007</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601146branchLayoutTestsChangeLog">branches/safari-601.1.46-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari601146branchLayoutTestsmediavideointerruptionwithresumeallowingplayexpectedtxt">branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt</a></li>
<li><a href="#branchessafari601146branchLayoutTestsmediavideointerruptionwithresumeallowingplayhtml">branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play.html</a></li>
<li><a href="#branchessafari601146branchLayoutTestsmediavideointerruptionwithresumenotallowingplayexpectedtxt">branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt</a></li>
<li><a href="#branchessafari601146branchLayoutTestsmediavideointerruptionwithresumenotallowingplayhtml">branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreChangeLog">branches/safari-601.1.46-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreModuleswebaudioAudioContexth">branches/safari-601.1.46-branch/Source/WebCore/Modules/webaudio/AudioContext.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCorehtmlHTMLMediaElementcpp">branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCorehtmlHTMLMediaElementh">branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreplatformaudioPlatformMediaSessioncpp">branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreplatformaudioPlatformMediaSessionh">branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreplatformaudioPlatformMediaSessionManagercpp">branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreplatformaudioPlatformMediaSessionManagerh">branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreplatformaudioiosMediaSessionManagerIOSh">branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm">branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm</a></li>
<li><a href="#branchessafari601146branchSourceWebCoretestingInternalscpp">branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#branchessafari601146branchSourceWebCoretestingInternalsh">branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#branchessafari601146branchSourceWebCoretestingInternalsidl">branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601146branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2015-10-15 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r190434. rdar://problem/22865007
+
+ 2015-10-01 Eric Carlson <eric.carlson@apple.com>
+
+ [iOS] AirPlay should not stop when the screen locks
+ https://bugs.webkit.org/show_bug.cgi?id=148315
+ <rdar://problem/22770703>
+
+ Reviewed by Jer Noble.
+
+ * media/video-interruption-with-resume-allowing-play.html:
+ * media/video-interruption-with-resume-not-allowing-play.html:
+
+2015-10-15 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Merge r191077. rdar://problem/22993325
</span><span class="cx">
</span><span class="cx"> 2015-10-14 Alex Christensen <achristensen@webkit.org>
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestsmediavideointerruptionwithresumeallowingplayexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx">
</span><span class="cx"> EVENT(playing)
</span><span class="cx"> EXPECTED (video.paused == 'false') OK
</span><del>-RUN(internals.beginMediaSessionInterruption())
</del><ins>+RUN(internals.beginMediaSessionInterruption('System'))
</ins><span class="cx">
</span><span class="cx"> 100ms timer fired...
</span><span class="cx"> EXPECTED (video.paused == 'true') OK
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx"> EXPECTED (video.paused == 'false') OK
</span><span class="cx">
</span><span class="cx"> EXPECTED (video.paused == 'false') OK
</span><del>-RUN(internals.beginMediaSessionInterruption())
</del><ins>+RUN(internals.beginMediaSessionInterruption('System'))
</ins><span class="cx">
</span><span class="cx"> 100ms timer fired...
</span><span class="cx"> EXPECTED (video.paused == 'true') OK
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestsmediavideointerruptionwithresumeallowingplayhtml"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play.html (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play.html        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-allowing-play.html        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx"> case "playing":
</span><span class="cx"> testExpected("video.paused", false);
</span><span class="cx"> state = "interrupted";
</span><del>- run("internals.beginMediaSessionInterruption()");;
</del><ins>+ run("internals.beginMediaSessionInterruption('System')");;
</ins><span class="cx"> setTimeout(checkState, 100);
</span><span class="cx"> consoleWrite("");
</span><span class="cx"> break;
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestsmediavideointerruptionwithresumenotallowingplayexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> RUN(video.play())
</span><span class="cx">
</span><span class="cx"> EVENT(playing)
</span><del>-RUN(internals.beginMediaSessionInterruption())
</del><ins>+RUN(internals.beginMediaSessionInterruption('System'))
</ins><span class="cx">
</span><span class="cx"> 100ms timer fired...
</span><span class="cx"> EXPECTED (video.paused == 'true') OK
</span></span></pre></div>
<a id="branchessafari601146branchLayoutTestsmediavideointerruptionwithresumenotallowingplayhtml"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -7,7 +7,7 @@
</span><span class="cx">
</span><span class="cx"> function playing()
</span><span class="cx"> {
</span><del>- run("internals.beginMediaSessionInterruption()");;
</del><ins>+ run("internals.beginMediaSessionInterruption('System')");;
</ins><span class="cx"> setTimeout(checkState, 100);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -1,5 +1,51 @@
</span><span class="cx"> 2015-10-15 Matthew Hanson <matthew_hanson@apple.com>
</span><span class="cx">
</span><ins>+ Merge r190434. rdar://problem/22865007
+
+ 2015-10-01 Eric Carlson <eric.carlson@apple.com>
+
+ [iOS] AirPlay should not stop when the screen locks
+ https://bugs.webkit.org/show_bug.cgi?id=148315
+ <rdar://problem/22770703>
+
+ Reviewed by Jer Noble.
+
+ Tested by media/video-interruption-with-resume-allowing-play.html
+ media/video-interruption-with-resume-not-allowing-play.html
+
+ * Modules/webaudio/AudioContext.h: overrideBackgroundPlaybackRestriction ->
+ shouldOverrideBackgroundPlaybackRestriction.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::suspendPlayback): Fix a typo in the logging.
+ (WebCore::HTMLMediaElement::mayResumePlayback): Ditto.
+ (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction): Renamed from
+ overrideBackgroundPlaybackRestriction.
+ (WebCore::HTMLMediaElement::overrideBackgroundPlaybackRestriction): Deleted.
+ * html/HTMLMediaElement.h:
+
+ * platform/audio/PlatformMediaSession.cpp:
+ (WebCore::stateName):
+ (WebCore::interruptionName): New, log the name of the interruption.
+ (WebCore::PlatformMediaSession::beginInterruption): Log the interruption type. Don't
+ increment the interruption counter if we are going to ignore it. Incorporate logic
+ from doInterruption.
+ (WebCore::PlatformMediaSession::doInterruption): Deleted.
+ (WebCore::PlatformMediaSession::shouldDoInterruption): Deleted.
+ (WebCore::PlatformMediaSession::forceInterruption): Deleted.
+
+ * platform/audio/PlatformMediaSession.h: Add SuspendedUnderLock interruption type.
+ * platform/audio/PlatformMediaSessionManager.cpp:
+ (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground): Deleted.
+ * platform/audio/PlatformMediaSessionManager.h:
+
+ * platform/audio/ios/MediaSessionManagerIOS.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManageriOS::applicationDidEnterBackground): Call beginInterruption
+ when appropriate.
+
+2015-10-15 Matthew Hanson <matthew_hanson@apple.com>
+
</ins><span class="cx"> Rollout r188486. rdar://problem/22707497
</span><span class="cx">
</span><span class="cx"> 2015-10-15 Matthew Hanson <matthew_hanson@apple.com>
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreModuleswebaudioAudioContexth"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/Modules/webaudio/AudioContext.h (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/Modules/webaudio/AudioContext.h        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/Modules/webaudio/AudioContext.h        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -322,7 +322,7 @@
</span><span class="cx"> virtual void suspendPlayback() override;
</span><span class="cx"> virtual bool canReceiveRemoteControlCommands() const override { return false; }
</span><span class="cx"> virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override { }
</span><del>- virtual bool overrideBackgroundPlaybackRestriction() const override { return false; }
</del><ins>+ bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override { return false; }
</ins><span class="cx">
</span><span class="cx"> // EventTarget
</span><span class="cx"> virtual void refEventTarget() override { ref(); }
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.cpp        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -6348,14 +6348,14 @@
</span><span class="cx">
</span><span class="cx"> void HTMLMediaElement::suspendPlayback()
</span><span class="cx"> {
</span><del>- LOG(Media, "HTMLMediaElement::pausePlayback(%p) - paused = %s", this, boolString(paused()));
</del><ins>+ LOG(Media, "HTMLMediaElement::suspendPlayback(%p) - paused = %s", this, boolString(paused()));
</ins><span class="cx"> if (!paused())
</span><span class="cx"> pause();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void HTMLMediaElement::mayResumePlayback(bool shouldResume)
</span><span class="cx"> {
</span><del>- LOG(Media, "HTMLMediaElement::resumePlayback(%p) - paused = %s", this, boolString(paused()));
</del><ins>+ LOG(Media, "HTMLMediaElement::mayResumePlayback(%p) - paused = %s", this, boolString(paused()));
</ins><span class="cx"> if (paused() && shouldResume)
</span><span class="cx"> play();
</span><span class="cx"> }
</span><span class="lines">@@ -6397,8 +6397,11 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool HTMLMediaElement::overrideBackgroundPlaybackRestriction() const
</del><ins>+bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType type) const
</ins><span class="cx"> {
</span><ins>+ if (type != PlatformMediaSession::EnteringBackground)
+ return false;
+
</ins><span class="cx"> #if ENABLE(WIRELESS_PLAYBACK_TARGET)
</span><span class="cx"> if (m_player && m_player->isCurrentPlaybackTargetWireless())
</span><span class="cx"> return true;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.h (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.h        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLMediaElement.h        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -725,7 +725,7 @@
</span><span class="cx"> virtual double mediaSessionCurrentTime() const override { return currentTime(); }
</span><span class="cx"> virtual bool canReceiveRemoteControlCommands() const override { return true; }
</span><span class="cx"> virtual void didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType) override;
</span><del>- virtual bool overrideBackgroundPlaybackRestriction() const override;
</del><ins>+ bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const override;
</ins><span class="cx">
</span><span class="cx"> virtual void pageMutedStateDidChange() override;
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreplatformaudioPlatformMediaSessioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.cpp        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -39,17 +39,31 @@
</span><span class="cx"> #if !LOG_DISABLED
</span><span class="cx"> static const char* stateName(PlatformMediaSession::State state)
</span><span class="cx"> {
</span><del>-#define CASE(state) case PlatformMediaSession::state: return #state
</del><ins>+#define STATE_CASE(state) case PlatformMediaSession::state: return #state
</ins><span class="cx"> switch (state) {
</span><del>- CASE(Idle);
- CASE(Playing);
- CASE(Paused);
- CASE(Interrupted);
</del><ins>+ STATE_CASE(Idle);
+ STATE_CASE(Playing);
+ STATE_CASE(Paused);
+ STATE_CASE(Interrupted);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> return "";
</span><span class="cx"> }
</span><ins>+
+static const char* interruptionName(PlatformMediaSession::InterruptionType type)
+{
+#define INTERRUPTION_CASE(type) case PlatformMediaSession::type: return #type
+ switch (type) {
+ INTERRUPTION_CASE(SystemSleep);
+ INTERRUPTION_CASE(EnteringBackground);
+ INTERRUPTION_CASE(SystemInterruption);
+ INTERRUPTION_CASE(SuspendedUnderLock);
+ }
+
+ ASSERT_NOT_REACHED();
+ return "";
+}
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<PlatformMediaSession> PlatformMediaSession::create(PlatformMediaSessionClient& client)
</span><span class="lines">@@ -79,47 +93,21 @@
</span><span class="cx"> m_state = state;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void PlatformMediaSession::doInterruption()
-{
- m_stateToRestore = state();
- m_notifyingClient = true;
- setState(Interrupted);
- client().suspendPlayback();
- m_notifyingClient = false;
-}
-
-bool PlatformMediaSession::shouldDoInterruption(InterruptionType type)
-{
- return type != EnteringBackground || !client().overrideBackgroundPlaybackRestriction();
-}
-
</del><span class="cx"> void PlatformMediaSession::beginInterruption(InterruptionType type)
</span><span class="cx"> {
</span><del>- LOG(Media, "PlatformMediaSession::beginInterruption(%p), state = %s, interruption count = %i", this, stateName(m_state), m_interruptionCount);
</del><ins>+ LOG(Media, "PlatformMediaSession::beginInterruption(%p), state = %s, interruption type = %s, interruption count = %i", this, stateName(m_state), interruptionName(type), m_interruptionCount);
</ins><span class="cx">
</span><del>- if (++m_interruptionCount > 1 || !shouldDoInterruption(type))
</del><ins>+ if (++m_interruptionCount > 1)
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- doInterruption();
-}
-
-void PlatformMediaSession::forceInterruption(InterruptionType type)
-{
- LOG(Media, "PlatformMediaSession::forceInterruption(%p), state = %s, interruption count = %i", this, stateName(m_state), m_interruptionCount);
-
- // beginInterruption() must have been called before calling this function.
- if (!m_interruptionCount) {
- ASSERT_NOT_REACHED();
</del><ins>+ if (client().shouldOverrideBackgroundPlaybackRestriction(type))
</ins><span class="cx"> return;
</span><del>- }
</del><span class="cx">
</span><del>- // The purpose of this function is to override the decision which was made by
- // beginInterruption(). If it was decided to interrupt the media session there,
- // then nothing should be done here.
- if (shouldDoInterruption(type))
- return;
-
- doInterruption();
</del><ins>+ m_stateToRestore = state();
+ m_notifyingClient = true;
+ setState(Interrupted);
+ client().suspendPlayback();
+ m_notifyingClient = false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PlatformMediaSession::endInterruption(EndInterruptionFlags flags)
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreplatformaudioPlatformMediaSessionh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSession.h        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -74,16 +74,14 @@
</span><span class="cx"> SystemSleep,
</span><span class="cx"> EnteringBackground,
</span><span class="cx"> SystemInterruption,
</span><ins>+ SuspendedUnderLock,
</ins><span class="cx"> };
</span><span class="cx"> enum EndInterruptionFlags {
</span><span class="cx"> NoFlags = 0,
</span><span class="cx"> MayResumePlaying = 1 << 0,
</span><span class="cx"> };
</span><span class="cx">
</span><del>- void doInterruption();
- bool shouldDoInterruption(InterruptionType);
</del><span class="cx"> void beginInterruption(InterruptionType);
</span><del>- void forceInterruption(InterruptionType);
</del><span class="cx"> void endInterruption(EndInterruptionFlags);
</span><span class="cx">
</span><span class="cx"> void applicationWillEnterForeground() const;
</span><span class="lines">@@ -179,7 +177,7 @@
</span><span class="cx"> virtual void setShouldBufferData(bool) { }
</span><span class="cx"> virtual bool elementIsHidden() const { return false; }
</span><span class="cx">
</span><del>- virtual bool overrideBackgroundPlaybackRestriction() const = 0;
</del><ins>+ virtual bool shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType) const = 0;
</ins><span class="cx">
</span><span class="cx"> virtual void wirelessRoutesAvailableDidChange() { }
</span><span class="cx"> virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) { }
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreplatformaudioPlatformMediaSessionManagercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -289,20 +289,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void PlatformMediaSessionManager::applicationDidEnterBackground(bool isSuspendedUnderLock) const
-{
- LOG(Media, "PlatformMediaSessionManager::applicationDidEnterBackground");
-
- if (!isSuspendedUnderLock)
- return;
-
- Vector<PlatformMediaSession*> sessions = m_sessions;
- for (auto* session : sessions) {
- if (m_restrictions[session->mediaType()] & BackgroundProcessPlaybackRestricted)
- session->forceInterruption(PlatformMediaSession::EnteringBackground);
- }
-}
-
</del><span class="cx"> void PlatformMediaSessionManager::applicationWillEnterForeground() const
</span><span class="cx"> {
</span><span class="cx"> LOG(Media, "PlatformMediaSessionManager::applicationWillEnterForeground");
</span><span class="lines">@@ -324,8 +310,8 @@
</span><span class="cx"> if (!m_isApplicationInBackground || !(m_restrictions[session.mediaType()] & BackgroundProcessPlaybackRestricted))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (session.state() != PlatformMediaSession::Interrupted && session.shouldDoInterruption(PlatformMediaSession::EnteringBackground))
- session.doInterruption();
</del><ins>+ if (session.state() != PlatformMediaSession::Interrupted)
+ session.beginInterruption(PlatformMediaSession::EnteringBackground);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if !PLATFORM(COCOA)
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreplatformaudioPlatformMediaSessionManagerh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/PlatformMediaSessionManager.h        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -56,7 +56,6 @@
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT void applicationWillEnterForeground() const;
</span><span class="cx"> WEBCORE_EXPORT void applicationWillEnterBackground() const;
</span><del>- WEBCORE_EXPORT void applicationDidEnterBackground(bool isSuspendedUnderLock) const;
</del><span class="cx">
</span><span class="cx"> void stopAllMediaPlaybackForDocument(const Document*);
</span><span class="cx"> WEBCORE_EXPORT void stopAllMediaPlaybackForProcess();
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreplatformaudioiosMediaSessionManagerIOSh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx">
</span><span class="cx"> void externalOutputDeviceAvailableDidChange();
</span><span class="cx"> virtual bool hasWirelessTargetsAvailable() override;
</span><ins>+ void applicationDidEnterBackground(bool isSuspendedUnderLock);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> friend class PlatformMediaSessionManager;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -248,6 +248,21 @@
</span><span class="cx"> session->externalOutputDeviceAvailableDidChange(haveTargets);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MediaSessionManageriOS::applicationDidEnterBackground(bool isSuspendedUnderLock)
+{
+ LOG(Media, "MediaSessionManageriOS::applicationDidEnterBackground");
+
+ if (!isSuspendedUnderLock)
+ return;
+
+ Vector<PlatformMediaSession*> sessions = this->sessions();
+ for (auto* session : sessions) {
+ if (restrictions(session->mediaType()) & BackgroundProcessPlaybackRestricted)
+ session->beginInterruption(PlatformMediaSession::SuspendedUnderLock);
+ }
+}
+
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> @implementation WebMediaSessionHelper
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.cpp        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -2614,8 +2614,21 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>-void Internals::beginMediaSessionInterruption()
</del><ins>+void Internals::beginMediaSessionInterruption(const String& interruptionString, ExceptionCode& ec)
</ins><span class="cx"> {
</span><ins>+ PlatformMediaSession::InterruptionType interruption = PlatformMediaSession::SystemInterruption;
+
+ if (equalIgnoringCase(interruptionString, "System"))
+ interruption = PlatformMediaSession::SystemInterruption;
+ else if (equalIgnoringCase(interruptionString, "SystemSleep"))
+ interruption = PlatformMediaSession::SystemSleep;
+ else if (equalIgnoringCase(interruptionString, "EnteringBackground"))
+ interruption = PlatformMediaSession::EnteringBackground;
+ else {
+ ec = INVALID_ACCESS_ERR;
+ return;
+ }
+
</ins><span class="cx"> PlatformMediaSessionManager::sharedManager().beginInterruption(PlatformMediaSession::SystemInterruption);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.h        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -382,7 +382,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span><del>- void beginMediaSessionInterruption();
</del><ins>+ void beginMediaSessionInterruption(const String&, ExceptionCode&);
</ins><span class="cx"> void endMediaSessionInterruption(const String&);
</span><span class="cx"> void applicationWillEnterForeground() const;
</span><span class="cx"> void applicationWillEnterBackground() const;
</span></span></pre></div>
<a id="branchessafari601146branchSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl (191167 => 191168)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl        2015-10-16 04:26:43 UTC (rev 191167)
+++ branches/safari-601.1.46-branch/Source/WebCore/testing/Internals.idl        2015-10-16 06:28:51 UTC (rev 191168)
</span><span class="lines">@@ -349,7 +349,7 @@
</span><span class="cx"> [Conditional=MEDIA_SOURCE] void initializeMockMediaSource();
</span><span class="cx"> [Conditional=MEDIA_SOURCE] DOMString[] bufferedSamplesForTrackID(SourceBuffer buffer, DOMString trackID);
</span><span class="cx">
</span><del>- [Conditional=VIDEO] void beginMediaSessionInterruption();
</del><ins>+ [Conditional=VIDEO, RaisesException] void beginMediaSessionInterruption(DOMString interruptionType);
</ins><span class="cx"> [Conditional=VIDEO] void endMediaSessionInterruption(DOMString flags);
</span><span class="cx"> [Conditional=VIDEO] void applicationWillEnterForeground();
</span><span class="cx"> [Conditional=VIDEO] void applicationWillEnterBackground();
</span></span></pre>
</div>
</div>
</body>
</html>