<!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>[161481] trunk</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/161481">161481</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2014-01-07 21:45:55 -0800 (Tue, 07 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Teach MediaSessionManager to manage interruptions
https://bugs.webkit.org/show_bug.cgi?id=126530

Reviewed by Sam Weinig.

Source/WebCore:

Tests: media/video-interruption-active-when-element-created.html
       media/video-interruption-with-resume-allowing-play.html
       media/video-interruption-with-resume-not-allowing-play.html

* WebCore.exp.in: Export functions needed by Internals.

Add MediaSession and MediaSessionManager.
* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:

Automatically pause/play for interruptions. Move media restriction management to a MediaSession.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Get rid of m_loadInitiatedByUserGesture and m_userStartedPlayback,
    they aren't needed.
(WebCore::HTMLMediaElement::load): Ditto.
(WebCore::HTMLMediaElement::loadInternal): Use the media session to manage restrictions.
(WebCore::HTMLMediaElement::play): Remove redundant iOS code. Postpone playback if called
    during an interruption.
(WebCore::HTMLMediaElement::pause): Remember to not resume playback when it ends if called during
    an interruption.
(WebCore::HTMLMediaElement::potentiallyPlaying): Rearrange code to make it easier to understand.
(WebCore::HTMLMediaElement::couldPlayIfEnoughData): Ditto.
(WebCore::HTMLMediaElement::pausedForUserInteraction): Return true if paused because of an interruption.
(WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Be explicit about
    which restrictions are removed.
(WebCore::HTMLMediaElement::mediaType): MediaSessionManager::&lt;Type&gt; -&gt; MediaSession::&lt;Type&gt;.
(WebCore::HTMLMediaElement::beginInterruption): New.
(WebCore::HTMLMediaElement::endInterruption): Ditto.
* html/HTMLMediaElement.h:

Pulled MediaSessionManagerToken out of MediaSessionManager.cpp, added functionality to manage interruptions.
* platform/audio/MediaSession.cpp: Added.
(WebCore::MediaSession::create):
(WebCore::MediaSession::MediaSession):
(WebCore::MediaSession::~MediaSession):
(WebCore::MediaSession::beginInterruption): Inform client of interruption state change.
(WebCore::MediaSession::endInterruption): Ditto.
* platform/audio/MediaSession.h: Added.

* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::MediaSessionManager): Initialize interruption counter.
(WebCore::MediaSessionManager::has): MediaType is defined in MediaSession.
(WebCore::MediaSessionManager::count): Ditto.
(WebCore::MediaSessionManager::beginInterruption): Inform all clients of interruption start if
    not already in an interruption.
(WebCore::MediaSessionManager::endInterruption): Inform all clients if interruption has ended.
(WebCore::MediaSessionManager::addSession): Renamed from addToken. Set session interruption state.
(WebCore::MediaSessionManager::removeSession): Renamed from removeToken.
* platform/audio/MediaSessionManager.h:

* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::AudioDestinationMac): MediaSessionManagerToken -&gt; MediaSession.
* platform/audio/mac/AudioDestinationMac.h:

* platform/audio/mac/MediaSessionManagerMac.cpp:
(MediaSessionManager::updateSessionState): Ditto.

Make it possible for tests to begin and end interruptions.
* testing/Internals.cpp:
(WebCore::Internals::beginMediaSessionInterruption):
(WebCore::Internals::endMediaSessionInterruption):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

* CMakeLists.txt: Add ${WEBCORE_DIR}/platform/animation to WebCore include directories.

Source/WebKit2:

* CMakeLists.txt: Add ${WEBCORE_DIR}/platform/animation to WebCore include directories.

LayoutTests:

* media/video-interruption-active-when-element-created-expected.txt: Added.
* media/video-interruption-active-when-element-created.html: Added.
* media/video-interruption-with-resume-allowing-play-expected.txt: Added.
* media/video-interruption-with-resume-allowing-play.html: Added.
* media/video-interruption-with-resume-not-allowing-play-expected.txt: Added.
* media/video-interruption-with-resume-not-allowing-play.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefilelistam">trunk/Source/WebCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessionManagercpp">trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessionManagerh">trunk/Source/WebCore/platform/audio/MediaSessionManager.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudiomacAudioDestinationMaccpp">trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudiomacAudioDestinationMach">trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudiomacMediaSessionManagerMaccpp">trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
<li><a href="#trunkSourceWebKitCMakeListstxt">trunk/Source/WebKit/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2CMakeListstxt">trunk/Source/WebKit2/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsmediavideointerruptionactivewhenelementcreatedexpectedtxt">trunk/LayoutTests/media/video-interruption-active-when-element-created-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideointerruptionactivewhenelementcreatedhtml">trunk/LayoutTests/media/video-interruption-active-when-element-created.html</a></li>
<li><a href="#trunkLayoutTestsmediavideointerruptionwithresumeallowingplayexpectedtxt">trunk/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideointerruptionwithresumeallowingplayhtml">trunk/LayoutTests/media/video-interruption-with-resume-allowing-play.html</a></li>
<li><a href="#trunkLayoutTestsmediavideointerruptionwithresumenotallowingplayexpectedtxt">trunk/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediavideointerruptionwithresumenotallowingplayhtml">trunk/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessioncpp">trunk/Source/WebCore/platform/audio/MediaSession.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessionh">trunk/Source/WebCore/platform/audio/MediaSession.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/LayoutTests/ChangeLog        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-01-07  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        Teach MediaSessionManager to manage interruptions
+        https://bugs.webkit.org/show_bug.cgi?id=126530
+
+        Reviewed by Sam Weinig.
+
+        * media/video-interruption-active-when-element-created-expected.txt: Added.
+        * media/video-interruption-active-when-element-created.html: Added.
+        * media/video-interruption-with-resume-allowing-play-expected.txt: Added.
+        * media/video-interruption-with-resume-allowing-play.html: Added.
+        * media/video-interruption-with-resume-not-allowing-play-expected.txt: Added.
+        * media/video-interruption-with-resume-not-allowing-play.html: Added.
+
</ins><span class="cx"> 2014-01-07  Seokju Kwon  &lt;seokju@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Remove leftover 'device metrics' code
</span></span></pre></div>
<a id="trunkLayoutTestsmediavideointerruptionactivewhenelementcreatedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-interruption-active-when-element-created-expected.txt (0 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-interruption-active-when-element-created-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-interruption-active-when-element-created-expected.txt        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test a &lt;video&gt; element crated during interruption behaves correctly.
+
+RUN(internals.beginMediaSessionInterruption())
+RUN(video = document.createElement('video'))
+RUN(document.body.appendChild(video))
+EVENT(canplaythrough)
+
+RUN(video.play())
+100ms timer fired...
+EXPECTED (video.paused == 'true') OK
+RUN(internals.endMediaSessionInterruption('MayResumePlaying'))
+EVENT(playing)
+
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideointerruptionactivewhenelementcreatedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-interruption-active-when-element-created.html (0 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-interruption-active-when-element-created.html                                (rev 0)
+++ trunk/LayoutTests/media/video-interruption-active-when-element-created.html        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script src=media-file.js&gt;&lt;/script&gt;
+        &lt;script src=video-test.js&gt;&lt;/script&gt;
+        &lt;script&gt;
+            var state = 0;
+
+            function checkState()
+            {
+                consoleWrite(&quot;100ms timer fired...&quot;);
+                testExpected(&quot;video.paused&quot;, true);
+                state = &quot;resuming&quot;;
+                run(&quot;internals.endMediaSessionInterruption('MayResumePlaying')&quot;);
+            }
+
+            function playing()
+            {
+                if (state != &quot;resuming&quot;)
+                {
+                    consoleWrite(&quot;&quot;);
+                    failTest(&quot;&lt;b&gt;Playback started during interruption.&lt;/b&gt;&quot;);
+                    return;
+                }
+
+                consoleWrite(&quot;&quot;);
+                endTest();
+            }
+
+            function canplaythrough()
+            {
+                consoleWrite(&quot;&quot;);
+                run(&quot;video.play()&quot;);
+                setTimeout(checkState, 100);
+            }
+
+            function start()
+            {
+                if (!window.internals) {
+                    failTest('This test requires window.internals.');
+                    return;
+                }
+                run(&quot;internals.beginMediaSessionInterruption()&quot;);;
+                run(&quot;video = document.createElement('video')&quot;);
+                run(&quot;document.body.appendChild(video)&quot;);
+                waitForEvent('canplaythrough', canplaythrough);
+                waitForEvent('playing', playing);
+                video.src = findMediaFile(&quot;video&quot;, &quot;content/test&quot;);
+                state = &quot;interrupted&quot;;
+            }
+        &lt;/script&gt;
+    &lt;/head&gt;
+
+    &lt;body onload=&quot;start()&quot;&gt;
+        &lt;p&gt;Test a &amp;lt;video&amp;gt; element crated during interruption behaves correctly.&lt;/p&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideointerruptionwithresumeallowingplayexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt (0 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+
+Test that play() during interruption does nothing, ending interruption allows playback to resume.
+
+EVENT(canplaythrough)
+
+RUN(internals.beginMediaSessionInterruption())
+RUN(video.play())
+100ms timer fired...
+EXPECTED (video.paused == 'true') OK
+RUN(internals.endMediaSessionInterruption('MayResumePlaying'))
+EVENT(playing)
+
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideointerruptionwithresumeallowingplayhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-interruption-with-resume-allowing-play.html (0 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-interruption-with-resume-allowing-play.html                                (rev 0)
+++ trunk/LayoutTests/media/video-interruption-with-resume-allowing-play.html        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script src=media-file.js&gt;&lt;/script&gt;
+        &lt;script src=video-test.js&gt;&lt;/script&gt;
+        &lt;script&gt;
+            var state = 0;
+
+            function checkState()
+            {
+                consoleWrite(&quot;100ms timer fired...&quot;);
+                testExpected(&quot;video.paused&quot;, true);
+                state = &quot;resuming&quot;;
+                run(&quot;internals.endMediaSessionInterruption('MayResumePlaying')&quot;);
+            }
+
+            function playing()
+            {
+                if (state != &quot;resuming&quot;)
+                {
+                    consoleWrite(&quot;&quot;);
+                    failTest(&quot;&lt;b&gt;Playback started during interruption.&lt;/b&gt;&quot;);
+                    return;
+                }
+
+                consoleWrite(&quot;&quot;);
+                endTest();
+            }
+
+            function canplaythrough()
+            {
+                consoleWrite(&quot;&quot;);
+
+                run(&quot;internals.beginMediaSessionInterruption()&quot;);;
+                state = &quot;interrupted&quot;;
+                run(&quot;video.play()&quot;);
+                setTimeout(checkState, 100);
+            }
+
+            function start()
+            {
+                if (!window.internals) {
+                    failTest('This test requires window.internals.');
+                    return;
+                }
+
+                findMediaElement();
+                waitForEvent('canplaythrough', canplaythrough);
+                waitForEvent('playing', playing);
+                video.src = findMediaFile(&quot;video&quot;, &quot;content/test&quot;);
+            }
+        &lt;/script&gt;
+    &lt;/head&gt;
+
+    &lt;body onload=&quot;start()&quot;&gt;
+        &lt;video controls &gt;&lt;/video&gt;
+        &lt;p&gt;Test that play() during interruption does nothing, ending interruption allows playback to resume.&lt;/p&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideointerruptionwithresumenotallowingplayexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt (0 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt                                (rev 0)
+++ trunk/LayoutTests/media/video-interruption-with-resume-not-allowing-play-expected.txt        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+
+Test that play() during interruption does nothing, ending interruption does not allow playback to resume.
+
+EVENT(canplaythrough)
+
+RUN(internals.beginMediaSessionInterruption())
+RUN(video.play())
+100ms timer fired...
+EXPECTED (video.paused == 'true') OK
+RUN(internals.endMediaSessionInterruption(''))
+100ms timer fired...
+EXPECTED (video.paused == 'true') OK
+
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestsmediavideointerruptionwithresumenotallowingplayhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html (0 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html                                (rev 0)
+++ trunk/LayoutTests/media/video-interruption-with-resume-not-allowing-play.html        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script src=media-file.js&gt;&lt;/script&gt;
+        &lt;script src=video-test.js&gt;&lt;/script&gt;
+        &lt;script&gt;
+            var state = 0;
+
+            function playing()
+            {
+                if (state == &quot;resuming&quot;)
+                    failTest(&quot;&lt;b&gt;Playback started after interruption.&lt;/b&gt;&quot;);
+                else
+                    failTest(&quot;&lt;b&gt;Playback started during interruption.&lt;/b&gt;&quot;);
+            }
+
+            function checkState()
+            {
+                consoleWrite(&quot;100ms timer fired...&quot;);
+                testExpected(&quot;video.paused&quot;, true);
+                switch (state) {
+                case &quot;interrupted&quot;:
+                    state = &quot;resuming&quot;;
+                    setTimeout(checkState, 100);
+                    run(&quot;internals.endMediaSessionInterruption('')&quot;);
+                    break;
+                case &quot;resuming&quot;:
+                    consoleWrite(&quot;&quot;);
+                    endTest();
+                    break;
+                }
+            }
+
+            function canplaythrough()
+            {
+                consoleWrite(&quot;&quot;);
+
+                run(&quot;internals.beginMediaSessionInterruption()&quot;);;
+                state = &quot;interrupted&quot;;
+                run(&quot;video.play()&quot;);
+                setTimeout(checkState, 100);
+            }
+
+            function start()
+            {
+                if (!window.internals) {
+                    failTest('This test requires window.internals.');
+                    return;
+                }
+
+                findMediaElement();
+                waitForEvent('canplaythrough', canplaythrough);
+                waitForEvent('playing', playing);
+                video.src = findMediaFile(&quot;video&quot;, &quot;content/test&quot;);
+            }
+        &lt;/script&gt;
+    &lt;/head&gt;
+
+    &lt;body onload=&quot;start()&quot;&gt;
+        &lt;video controls &gt;&lt;/video&gt;
+        &lt;p&gt;Test that play() during interruption does nothing, ending interruption does not allow playback to resume.&lt;/p&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -1876,6 +1876,8 @@
</span><span class="cx">     platform/audio/HRTFElevation.cpp
</span><span class="cx">     platform/audio/HRTFKernel.cpp
</span><span class="cx">     platform/audio/HRTFPanner.cpp
</span><ins>+    platform/audio/MediaSession.cpp
+    platform/audio/MediaSessionManager.cpp
</ins><span class="cx">     platform/audio/MultiChannelResampler.cpp
</span><span class="cx">     platform/audio/Panner.cpp
</span><span class="cx">     platform/audio/Reverb.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/ChangeLog        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2014-01-07  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        Teach MediaSessionManager to manage interruptions
+        https://bugs.webkit.org/show_bug.cgi?id=126530
+
+        Reviewed by Sam Weinig.
+
+        Tests: media/video-interruption-active-when-element-created.html
+               media/video-interruption-with-resume-allowing-play.html
+               media/video-interruption-with-resume-not-allowing-play.html
+
+        * WebCore.exp.in: Export functions needed by Internals.
+
+        Add MediaSession and MediaSessionManager.
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        Automatically pause/play for interruptions. Move media restriction management to a MediaSession.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement): Get rid of m_loadInitiatedByUserGesture and m_userStartedPlayback,
+            they aren't needed.
+        (WebCore::HTMLMediaElement::load): Ditto.
+        (WebCore::HTMLMediaElement::loadInternal): Use the media session to manage restrictions.
+        (WebCore::HTMLMediaElement::play): Remove redundant iOS code. Postpone playback if called 
+            during an interruption.
+        (WebCore::HTMLMediaElement::pause): Remember to not resume playback when it ends if called during
+            an interruption.
+        (WebCore::HTMLMediaElement::potentiallyPlaying): Rearrange code to make it easier to understand.
+        (WebCore::HTMLMediaElement::couldPlayIfEnoughData): Ditto.
+        (WebCore::HTMLMediaElement::pausedForUserInteraction): Return true if paused because of an interruption.
+        (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Be explicit about
+            which restrictions are removed.
+        (WebCore::HTMLMediaElement::mediaType): MediaSessionManager::&lt;Type&gt; -&gt; MediaSession::&lt;Type&gt;.
+        (WebCore::HTMLMediaElement::beginInterruption): New.
+        (WebCore::HTMLMediaElement::endInterruption): Ditto.
+        * html/HTMLMediaElement.h:
+
+        Pulled MediaSessionManagerToken out of MediaSessionManager.cpp, added functionality to manage interruptions.
+        * platform/audio/MediaSession.cpp: Added.
+        (WebCore::MediaSession::create):
+        (WebCore::MediaSession::MediaSession):
+        (WebCore::MediaSession::~MediaSession):
+        (WebCore::MediaSession::beginInterruption): Inform client of interruption state change.
+        (WebCore::MediaSession::endInterruption): Ditto.
+        * platform/audio/MediaSession.h: Added.
+
+        * platform/audio/MediaSessionManager.cpp:
+        (WebCore::MediaSessionManager::MediaSessionManager): Initialize interruption counter.
+        (WebCore::MediaSessionManager::has): MediaType is defined in MediaSession.
+        (WebCore::MediaSessionManager::count): Ditto.
+        (WebCore::MediaSessionManager::beginInterruption): Inform all clients of interruption start if
+            not already in an interruption.
+        (WebCore::MediaSessionManager::endInterruption): Inform all clients if interruption has ended.
+        (WebCore::MediaSessionManager::addSession): Renamed from addToken. Set session interruption state.
+        (WebCore::MediaSessionManager::removeSession): Renamed from removeToken.
+        * platform/audio/MediaSessionManager.h:
+
+        * platform/audio/mac/AudioDestinationMac.cpp:
+        (WebCore::AudioDestinationMac::AudioDestinationMac): MediaSessionManagerToken -&gt; MediaSession.
+        * platform/audio/mac/AudioDestinationMac.h:
+
+        * platform/audio/mac/MediaSessionManagerMac.cpp:
+        (MediaSessionManager::updateSessionState): Ditto.
+
+        Make it possible for tests to begin and end interruptions.
+        * testing/Internals.cpp:
+        (WebCore::Internals::beginMediaSessionInterruption):
+        (WebCore::Internals::endMediaSessionInterruption):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
</ins><span class="cx"> 2014-01-07  Seokju Kwon  &lt;seokju@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Remove leftover 'device metrics' code
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.list.am (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.list.am        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/GNUmakefile.list.am        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -5350,6 +5350,10 @@
</span><span class="cx">         Source/WebCore/platform/audio/HRTFPanner.h \
</span><span class="cx">         Source/WebCore/platform/audio/Panner.cpp \
</span><span class="cx">         Source/WebCore/platform/audio/Panner.h \
</span><ins>+        Source/WebCore/platform/audio/MediaSession.cpp \
+        Source/WebCore/platform/audio/MediaSession.h \
+        Source/WebCore/platform/audio/MediaSessionManager.cpp \
+        Source/WebCore/platform/audio/MediaSessionManager.h \
</ins><span class="cx">         Source/WebCore/platform/CalculationValue.cpp \
</span><span class="cx">         Source/WebCore/platform/CalculationValue.h \
</span><span class="cx">         Source/WebCore/platform/CrossThreadCopier.cpp \
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -756,6 +756,9 @@
</span><span class="cx"> __ZN7WebCore19LayerFlushSchedulerC2EPNS_25LayerFlushSchedulerClientE
</span><span class="cx"> __ZN7WebCore19LayerFlushSchedulerD1Ev
</span><span class="cx"> __ZN7WebCore19LayerFlushSchedulerD2Ev
</span><ins>+__ZN7WebCore19MediaSessionManager13sharedManagerEv
+__ZN7WebCore19MediaSessionManager15endInterruptionENS_12MediaSession20EndInterruptionFlagsE
+__ZN7WebCore19MediaSessionManager17beginInterruptionEv
</ins><span class="cx"> __ZN7WebCore19ResourceRequestBase11setHTTPBodyEN3WTF10PassRefPtrINS_8FormDataEEE
</span><span class="cx"> __ZN7WebCore19ResourceRequestBase13setHTTPMethodERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore19ResourceRequestBase18setHTTPHeaderFieldEPKcRKN3WTF6StringE
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -7225,6 +7225,8 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\FileStream.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\FileSystem.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\audio\AudioSession.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\platform\audio\MediaSession.cpp&quot; /&gt;
+    &lt;ClCompile Include=&quot;..\platform\audio\MediaSessionManager.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\ANGLEWebKitBridge.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateAVCF.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateLegacyAVCF.cpp&quot; /&gt;
</span><span class="lines">@@ -19089,6 +19091,8 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\FloatConversion.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\audio\AudioSession.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\audio\AudioSessionListener.h&quot; /&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\platform\audio\MediaSession.h&quot; /&gt;
+    &lt;ClInclude Include=&quot;..\platform\audio\MediaSessionManager.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\platform\graphics\ANGLEWebKitBridge.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\graphics\AudioTrackPrivate.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\graphics\avfoundation\cf\InbandTextTrackPrivateAVCF.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -14596,6 +14596,12 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\platform\audio\AudioSessionListener.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;platform\audio&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\platform\audio\MediaSession.h&quot;&gt;
+      &lt;Filter&gt;platform\audio&lt;/Filter&gt;
+    &lt;/ClInclude&gt;
+    &lt;ClInclude Include=&quot;..\platform\audio\MediaSessionManager.h&quot;&gt;
+      &lt;Filter&gt;platform\audio&lt;/Filter&gt;
+    &lt;/ClInclude&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\platform\graphics\ANGLEWebKitBridge.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;platform\graphics&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -129,6 +129,8 @@
</span><span class="cx">                 070756DF14239B4E00414161 /* JSTextTrackCueList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070756D914239B4C00414161 /* JSTextTrackCueList.cpp */; };
</span><span class="cx">                 070756E014239B4E00414161 /* JSTextTrackCueList.h in Headers */ = {isa = PBXBuildFile; fileRef = 070756DA14239B4E00414161 /* JSTextTrackCueList.h */; };
</span><span class="cx">                 0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */; };
</span><ins>+                070E09191875EEFC003A1D3C /* MediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 070E09181875ED93003A1D3C /* MediaSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                070E091B1875EF71003A1D3C /* MediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 070E091A1875EF71003A1D3C /* MediaSession.cpp */; };
</ins><span class="cx">                 070F549817F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 070F549717F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h */; };
</span><span class="cx">                 070F549E17F2402700169E04 /* AudioDestinationConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 070F549D17F2402700169E04 /* AudioDestinationConsumer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 0711589117DF6F6600EDFE2B /* MediaStreamPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0711588F17DF633700EDFE2B /* MediaStreamPrivate.cpp */; };
</span><span class="lines">@@ -6715,6 +6717,8 @@
</span><span class="cx">                 070756DA14239B4E00414161 /* JSTextTrackCueList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTextTrackCueList.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySlider.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 070DD8F50F01868000727DEB /* mediaControls.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mediaControls.css; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                070E09181875ED93003A1D3C /* MediaSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSession.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                070E091A1875EF71003A1D3C /* MediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSession.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 070F549717F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamConstraintsValidationClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 070F549D17F2402700169E04 /* AudioDestinationConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioDestinationConsumer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0711588F17DF633700EDFE2B /* MediaStreamPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamPrivate.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22052,6 +22056,8 @@
</span><span class="cx">                                 CDA79822170A24F400D45C55 /* AudioSessionListener.h */,
</span><span class="cx">                                 CDAE8C071746B95700532D78 /* MediaSessionManager.cpp */,
</span><span class="cx">                                 CDAE8C081746B95700532D78 /* MediaSessionManager.h */,
</span><ins>+                                070E09181875ED93003A1D3C /* MediaSession.h */,
+                                070E091A1875EF71003A1D3C /* MediaSession.cpp */,
</ins><span class="cx">                                 FD31605312B026F700C1A359 /* AudioSourceProvider.h */,
</span><span class="cx">                                 FD62F52D145898D80094B0ED /* AudioSourceProviderClient.h */,
</span><span class="cx">                                 FD31605412B026F700C1A359 /* AudioUtilities.cpp */,
</span><span class="lines">@@ -24600,6 +24606,7 @@
</span><span class="cx">                                 436708C712D9CA4B00044234 /* RenderSVGHiddenContainer.h in Headers */,
</span><span class="cx">                                 436708C912D9CA4B00044234 /* RenderSVGImage.h in Headers */,
</span><span class="cx">                                 0854B0151255E4E600B9CDD0 /* RenderSVGInline.h in Headers */,
</span><ins>+                                070E09191875EEFC003A1D3C /* MediaSession.h in Headers */,
</ins><span class="cx">                                 0854B0171255E4E600B9CDD0 /* RenderSVGInlineText.h in Headers */,
</span><span class="cx">                                 CD3A496217A9D01B00274E42 /* SourceBuffer.h in Headers */,
</span><span class="cx">                                 436708CB12D9CA4B00044234 /* RenderSVGModelObject.h in Headers */,
</span><span class="lines">@@ -28075,6 +28082,7 @@
</span><span class="cx">                                 93309E11099E64920056E581 /* SplitElementCommand.cpp in Sources */,
</span><span class="cx">                                 93309E13099E64920056E581 /* SplitTextNodeCommand.cpp in Sources */,
</span><span class="cx">                                 078E094B17D1709600420AA1 /* MediaStreamAudioDestinationNode.cpp in Sources */,
</span><ins>+                                070E091B1875EF71003A1D3C /* MediaSession.cpp in Sources */,
</ins><span class="cx">                                 93309E15099E64920056E581 /* SplitTextNodeContainingElementCommand.cpp in Sources */,
</span><span class="cx">                                 A1E1154813015C5D0054AC8C /* SpotLightSource.cpp in Sources */,
</span><span class="cx">                                 97BC6A3E1505F081001B74AC /* SQLException.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -30,13 +30,13 @@
</span><span class="cx"> #include &quot;ApplicationCacheHost.h&quot;
</span><span class="cx"> #include &quot;ApplicationCacheResource.h&quot;
</span><span class="cx"> #include &quot;Attribute.h&quot;
</span><ins>+#include &quot;CSSPropertyNames.h&quot;
+#include &quot;CSSValueKeywords.h&quot;
</ins><span class="cx"> #include &quot;ChromeClient.h&quot;
</span><span class="cx"> #include &quot;ClientRect.h&quot;
</span><span class="cx"> #include &quot;ClientRectList.h&quot;
</span><span class="cx"> #include &quot;ContentSecurityPolicy.h&quot;
</span><span class="cx"> #include &quot;ContentType.h&quot;
</span><del>-#include &quot;CSSPropertyNames.h&quot;
-#include &quot;CSSValueKeywords.h&quot;
</del><span class="cx"> #include &quot;DiagnosticLoggingKeys.h&quot;
</span><span class="cx"> #include &quot;DocumentLoader.h&quot;
</span><span class="cx"> #include &quot;ElementIterator.h&quot;
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> #include &quot;JSHTMLMediaElement.h&quot;
</span><span class="cx"> #include &quot;Language.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><ins>+#include &quot;MIMETypeRegistry.h&quot;
</ins><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;MediaController.h&quot;
</span><span class="cx"> #include &quot;MediaControls.h&quot;
</span><span class="lines">@@ -59,7 +60,7 @@
</span><span class="cx"> #include &quot;MediaKeyEvent.h&quot;
</span><span class="cx"> #include &quot;MediaList.h&quot;
</span><span class="cx"> #include &quot;MediaQueryEvaluator.h&quot;
</span><del>-#include &quot;MIMETypeRegistry.h&quot;
</del><ins>+#include &quot;MediaSessionManager.h&quot;
</ins><span class="cx"> #include &quot;PageActivityAssertionToken.h&quot;
</span><span class="cx"> #include &quot;PageGroup.h&quot;
</span><span class="cx"> #include &quot;ProgressTracker.h&quot;
</span><span class="lines">@@ -138,10 +139,6 @@
</span><span class="cx"> #include &quot;PlatformTextTrack.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(AUDIO_SESSION)
-#include &quot;MediaSessionManager.h&quot;
-#endif
-
</del><span class="cx"> #if ENABLE(MEDIA_CONTROLS_SCRIPT)
</span><span class="cx"> #include &quot;JSMediaControlsHost.h&quot;
</span><span class="cx"> #include &quot;MediaControlsHost.h&quot;
</span><span class="lines">@@ -317,7 +314,6 @@
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><span class="cx">     , m_needWidgetUpdate(false)
</span><span class="cx"> #endif
</span><del>-    , m_loadInitiatedByUserGesture(false)
</del><span class="cx">     , m_completelyLoaded(false)
</span><span class="cx">     , m_havePreparedToPlay(false)
</span><span class="cx">     , m_parsingInProgress(createdByParser)
</span><span class="lines">@@ -326,7 +322,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     , m_requestingPlay(false)
</span><del>-    , m_userStartedPlayback(false)
</del><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx">     , m_tracksAreReady(true)
</span><span class="lines">@@ -342,9 +337,7 @@
</span><span class="cx"> #if ENABLE(WEB_AUDIO)
</span><span class="cx">     , m_audioSourceNode(0)
</span><span class="cx"> #endif
</span><del>-#if USE(AUDIO_SESSION)
-    , m_mediaSessionManagerToken(MediaSessionManagerToken::create(*this))
-#endif
</del><ins>+    , m_mediaSession(MediaSession::create(*this))
</ins><span class="cx">     , m_reportedExtraMemoryCost(0)
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx">     , m_mediaStreamSrcObject(nullptr)
</span><span class="lines">@@ -374,8 +367,7 @@
</span><span class="cx"> #if ENABLE(IOS_AIRPLAY)
</span><span class="cx">         addBehaviorRestriction(RequireUserGestureToShowPlaybackTargetPicker);
</span><span class="cx"> #endif
</span><del>-    } else
-        m_restrictions = NoRestrictions;
</del><ins>+    }
</ins><span class="cx"> #endif // !PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx">     addElementToDocumentMap(*this, document);
</span><span class="lines">@@ -903,21 +895,11 @@
</span><span class="cx">     
</span><span class="cx">     if (userGestureRequiredForLoad() &amp;&amp; !ScriptController::processingUserGesture())
</span><span class="cx">         return;
</span><del>-    
-    m_loadInitiatedByUserGesture = ScriptController::processingUserGesture();
-    if (m_loadInitiatedByUserGesture)
</del><ins>+    if (ScriptController::processingUserGesture())
</ins><span class="cx">         removeBehaviorsRestrictionsAfterFirstUserGesture();
</span><ins>+
</ins><span class="cx">     prepareForLoad();
</span><span class="cx">     loadInternal();
</span><del>-
-#if PLATFORM(IOS)
-    // Unless this method was called directly by the user or the application allows any script to trigger playback,
-    // return now because prepareToPlay() tells the media engine to start loading data as soon as the movie validates.
-    Settings* settings = document().settings();
-    if (!m_loadInitiatedByUserGesture &amp;&amp; (!settings || settings-&gt;mediaPlaybackRequiresUserGesture()))
-        return;
-#endif
-
</del><span class="cx">     prepareToPlay();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2657,10 +2639,11 @@
</span><span class="cx">     if (ScriptController::processingUserGesture())
</span><span class="cx">         removeBehaviorsRestrictionsAfterFirstUserGesture();
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-    userRequestsMediaLoading();
-#endif
-
</del><ins>+    if (m_mediaSession-&gt;state() == MediaSession::Interrupted) {
+        m_resumePlaybackAfterInterruption = true;
+        return;
+    }
+    
</ins><span class="cx">     playInternal();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2703,6 +2686,11 @@
</span><span class="cx">     if (userGestureRequiredForRateChange() &amp;&amp; !ScriptController::processingUserGesture())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (m_mediaSession-&gt;state() == MediaSession::Interrupted) {
+        m_resumePlaybackAfterInterruption = false;
+        return;
+    }
+    
</ins><span class="cx">     pauseInternal();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4122,12 +4110,28 @@
</span><span class="cx">     // when it ran out of buffered data. A movie is this state is &quot;potentially playing&quot;, modulo the
</span><span class="cx">     // checks in couldPlayIfEnoughData().
</span><span class="cx">     bool pausedToBuffer = m_readyStateMaximum &gt;= HAVE_FUTURE_DATA &amp;&amp; m_readyState &lt; HAVE_FUTURE_DATA;
</span><del>-    return (pausedToBuffer || m_readyState &gt;= HAVE_FUTURE_DATA) &amp;&amp; couldPlayIfEnoughData() &amp;&amp; !isBlockedOnMediaController();
</del><ins>+    
+    if (!pausedToBuffer &amp;&amp; m_readyState &lt; HAVE_FUTURE_DATA)
+        return false;
+
+    return couldPlayIfEnoughData() &amp;&amp; !isBlockedOnMediaController();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLMediaElement::couldPlayIfEnoughData() const
</span><span class="cx"> {
</span><del>-    return !paused() &amp;&amp; !endedPlayback() &amp;&amp; !stoppedDueToErrors() &amp;&amp; !pausedForUserInteraction();
</del><ins>+    if (paused())
+        return false;
+
+    if (endedPlayback())
+        return false;
+
+    if (stoppedDueToErrors())
+        return false;
+
+    if (pausedForUserInteraction())
+        return false;
+
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool HTMLMediaElement::endedPlayback() const
</span><span class="lines">@@ -4171,7 +4175,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool HTMLMediaElement::pausedForUserInteraction() const
</span><span class="cx"> {
</span><del>-//    return !paused() &amp;&amp; m_readyState &gt;= HAVE_FUTURE_DATA &amp;&amp; [UA requires a decitions from the user]
</del><ins>+    if (m_mediaSession-&gt;state() == MediaSession::Interrupted)
+        return true;
+
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -4558,7 +4564,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (notification == MediaPlayerNotificationPlayPauseButtonPressed) {
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-        userRequestsMediaLoading();
</del><ins>+        removeBehaviorsRestrictionsAfterFirstUserGesture();
</ins><span class="cx"> #endif
</span><span class="cx">         togglePlayState();
</span><span class="cx">         return;
</span><span class="lines">@@ -5299,16 +5305,6 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-void HTMLMediaElement::userRequestsMediaLoading()
-{
-    // The user is requesting data loading and/or playback, so remove the &quot;only change playback in response
-    // to a user gesture&quot; restriction on this movie.
-    m_userStartedPlayback = true;
-    m_restrictions = NoRestrictions;
-}
-#endif
-
</del><span class="cx"> const String&amp; HTMLMediaElement::mediaGroup() const
</span><span class="cx"> {
</span><span class="cx">     return m_mediaGroup;
</span><span class="lines">@@ -5601,7 +5597,12 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
</span><span class="cx"> {
</span><del>-    m_restrictions = NoRestrictions;
</del><ins>+    removeBehaviorRestriction(RequireUserGestureForLoadRestriction);
+    removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction);
+    removeBehaviorRestriction(RequireUserGestureForFullscreenRestriction);
+#if ENABLE(IOS_AIRPLAY)
+    removeBehaviorRestriction(RequireUserGestureToShowPlaybackTargetPickerRestriction);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><span class="lines">@@ -5724,16 +5725,35 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if USE(AUDIO_SESSION)
-MediaSessionManager::MediaType HTMLMediaElement::mediaType() const
</del><ins>+MediaSession::MediaType HTMLMediaElement::mediaType() const
</ins><span class="cx"> {
</span><span class="cx">     if (hasTagName(HTMLNames::videoTag))
</span><del>-        return MediaSessionManager::Video;
</del><ins>+        return MediaSession::Video;
</ins><span class="cx"> 
</span><del>-    return MediaSessionManager::Audio;
</del><ins>+    return MediaSession::Audio;
</ins><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><ins>+void HTMLMediaElement::beginInterruption()
+{
+    LOG(Media, &quot;HTMLMediaElement::beginInterruption&quot;);
+    
+    m_resumePlaybackAfterInterruption = !paused();
+    if (m_resumePlaybackAfterInterruption)
+        pause();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void HTMLMediaElement::endInterruption(MediaSession::EndInterruptionFlags flags)
+{
+    bool shouldResumePlayback = m_resumePlaybackAfterInterruption;
+    m_resumePlaybackAfterInterruption = false;
+
+    if (!flags &amp; MediaSession::MayResumePlaying)
+        return;
+
+    if (shouldResumePlayback)
+        play();
+}
+
+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;MediaCanStartListener.h&quot;
</span><span class="cx"> #include &quot;MediaControllerInterface.h&quot;
</span><span class="cx"> #include &quot;MediaPlayer.h&quot;
</span><ins>+#include &quot;MediaSession.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
</span><span class="cx"> #include &quot;HTMLFrameOwnerElement.h&quot;
</span><span class="lines">@@ -53,9 +54,6 @@
</span><span class="cx"> #include &quot;MediaStream.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(AUDIO_SESSION)
-#include &quot;MediaSessionManager.h&quot;
-#endif
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -105,7 +103,7 @@
</span><span class="cx"> #else
</span><span class="cx">     : public HTMLElement
</span><span class="cx"> #endif
</span><del>-    , private MediaPlayerClient, public MediaPlayerSupportsTypeClient, private MediaCanStartListener, public ActiveDOMObject, public MediaControllerInterface
</del><ins>+    , private MediaPlayerClient, public MediaPlayerSupportsTypeClient, private MediaCanStartListener, public ActiveDOMObject, public MediaControllerInterface , public MediaSessionClient
</ins><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx">     , private AudioTrackClient
</span><span class="cx">     , private TextTrackClient
</span><span class="lines">@@ -114,9 +112,6 @@
</span><span class="cx"> #if USE(PLATFORM_TEXT_TRACK_MENU)
</span><span class="cx">     , public PlatformTextTrackMenuClient
</span><span class="cx"> #endif
</span><del>-#if USE(AUDIO_SESSION)
-    , public MediaSessionManagerClient
-#endif
</del><span class="cx"> {
</span><span class="cx"> public:
</span><span class="cx">     MediaPlayer* player() const { return m_player.get(); }
</span><span class="lines">@@ -481,6 +476,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual RenderPtr&lt;RenderElement&gt; createElementRenderer(PassRef&lt;RenderStyle&gt;) OVERRIDE;
</span><span class="cx"> 
</span><ins>+    MediaSession&amp; mediaSession() const { return *m_mediaSession; }
+
</ins><span class="cx"> private:
</span><span class="cx">     void createMediaPlayer();
</span><span class="cx"> 
</span><span class="lines">@@ -654,7 +651,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     bool parseMediaPlayerAttribute(const QualifiedName&amp;, const AtomicString&amp;);
</span><del>-    void userRequestsMediaLoading();
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // Pauses playback without changing any states or generating events
</span><span class="lines">@@ -697,10 +693,11 @@
</span><span class="cx">     bool ensureMediaControlsInjectedScript();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(AUDIO_SESSION)
-    virtual MediaSessionManager::MediaType mediaType() const OVERRIDE;
-#endif
</del><ins>+    virtual MediaSession::MediaType mediaType() const OVERRIDE;
</ins><span class="cx"> 
</span><ins>+    virtual void beginInterruption() OVERRIDE;
+    virtual void endInterruption(MediaSession::EndInterruptionFlags) OVERRIDE;
+
</ins><span class="cx">     Timer&lt;HTMLMediaElement&gt; m_loadTimer;
</span><span class="cx">     Timer&lt;HTMLMediaElement&gt; m_progressEventTimer;
</span><span class="cx">     Timer&lt;HTMLMediaElement&gt; m_playbackProgressTimer;
</span><span class="lines">@@ -796,7 +793,6 @@
</span><span class="cx">     bool m_needWidgetUpdate : 1;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    bool m_loadInitiatedByUserGesture : 1;
</del><span class="cx">     bool m_completelyLoaded : 1;
</span><span class="cx">     bool m_havePreparedToPlay : 1;
</span><span class="cx">     bool m_parsingInProgress : 1;
</span><span class="lines">@@ -806,9 +802,10 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     bool m_requestingPlay : 1;
</span><del>-    bool m_userStartedPlayback : 1;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    bool m_resumePlaybackAfterInterruption : 1;
+
</ins><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx">     bool m_tracksAreReady : 1;
</span><span class="cx">     bool m_haveVisibleTextTrack : 1;
</span><span class="lines">@@ -855,10 +852,7 @@
</span><span class="cx">     RefPtr&lt;PlatformTextTrackMenuInterface&gt; m_platformMenu;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(AUDIO_SESSION)
-    std::unique_ptr&lt;MediaSessionManagerToken&gt; m_mediaSessionManagerToken;
-#endif
-
</del><ins>+    std::unique_ptr&lt;MediaSession&gt; m_mediaSession;
</ins><span class="cx">     std::unique_ptr&lt;PageActivityAssertionToken&gt; m_activityToken;
</span><span class="cx">     size_t m_reportedExtraMemoryCost;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessioncppfromrev161480trunkSourceWebCoreplatformaudiomacMediaSessionManagerMaccpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/audio/MediaSession.cpp (from rev 161480, trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp) (0 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSession.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/audio/MediaSession.cpp        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;MediaSession.h&quot;
+
+#include &quot;HTMLMediaElement.h&quot;
+#include &quot;Logging.h&quot;
+#include &quot;MediaSessionManager.h&quot;
+#include &quot;Page.h&quot;
+#include &quot;ScriptController.h&quot;
+
+namespace WebCore {
+
+std::unique_ptr&lt;MediaSession&gt; MediaSession::create(MediaSessionClient&amp; client)
+{
+    return std::make_unique&lt;MediaSession&gt;(client);
+}
+
+MediaSession::MediaSession(MediaSessionClient&amp; client)
+    : m_client(client)
+    , m_state(Running)
+{
+    m_type = m_client.mediaType();
+    ASSERT(m_type &gt;= None &amp;&amp; m_type &lt;= WebAudio);
+    MediaSessionManager::sharedManager().addSession(*this);
+}
+
+MediaSession::~MediaSession()
+{
+    MediaSessionManager::sharedManager().removeSession(*this);
+}
+
+void MediaSession::beginInterruption()
+{
+    m_state = Interrupted;
+    m_client.beginInterruption();
+}
+
+void MediaSession::endInterruption(EndInterruptionFlags flags)
+{
+    m_state = Running;
+    m_client.endInterruption(flags);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionhfromrev161480trunkSourceWebCoreplatformaudioMediaSessionManagerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/audio/MediaSession.h (from rev 161480, trunk/Source/WebCore/platform/audio/MediaSessionManager.h) (0 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSession.h                                (rev 0)
+++ trunk/Source/WebCore/platform/audio/MediaSession.h        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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 MediaSession_h
+#define MediaSession_h
+
+#include &lt;wtf/Noncopyable.h&gt;
+
+namespace WebCore {
+
+class MediaSessionClient;
+class HTMLMediaElement;
+
+class MediaSession {
+public:
+    static std::unique_ptr&lt;MediaSession&gt; create(MediaSessionClient&amp;);
+
+    MediaSession(MediaSessionClient&amp;);
+    ~MediaSession();
+
+    enum MediaType {
+        None,
+        Video,
+        Audio,
+        WebAudio,
+    };
+    
+    MediaType mediaType() const { return m_type; }
+
+    enum State {
+        Running,
+        Interrupted,
+    };
+    State state() const { return m_state; }
+    void setState(State state) { m_state = state; }
+
+    enum EndInterruptionFlags {
+        NoFlags = 0,
+        MayResumePlaying = 1 &lt;&lt; 0,
+    };
+    void beginInterruption();
+    void endInterruption(EndInterruptionFlags);
+
+private:
+    MediaSessionClient&amp; m_client;
+    MediaType m_type;
+    State m_state;
+};
+
+class MediaSessionClient {
+    WTF_MAKE_NONCOPYABLE(MediaSessionClient);
+public:
+    MediaSessionClient() { }
+    
+    virtual MediaSession::MediaType mediaType() const = 0;
+    
+    virtual void beginInterruption() { }
+    virtual void endInterruption(MediaSession::EndInterruptionFlags) { }
+    
+protected:
+    virtual ~MediaSessionClient() { }
+};
+
+}
+
+#endif // MediaSession_h
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -26,26 +26,10 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;MediaSessionManager.h&quot;
</span><span class="cx"> 
</span><del>-using namespace WebCore;
</del><ins>+#include &quot;MediaSession.h&quot;
</ins><span class="cx"> 
</span><ins>+namespace WebCore {
</ins><span class="cx"> 
</span><del>-std::unique_ptr&lt;MediaSessionManagerToken&gt; MediaSessionManagerToken::create(MediaSessionManagerClient&amp; client)
-{
-    return std::make_unique&lt;MediaSessionManagerToken&gt;(client);
-}
-
-MediaSessionManagerToken::MediaSessionManagerToken(MediaSessionManagerClient&amp; client)
-    : m_client(client)
-{
-    m_type = m_client.mediaType();
-    MediaSessionManager::sharedManager().addToken(*this);
-}
-
-MediaSessionManagerToken::~MediaSessionManagerToken()
-{
-    MediaSessionManager::sharedManager().removeToken(*this);
-}
-
</del><span class="cx"> MediaSessionManager&amp; MediaSessionManager::sharedManager()
</span><span class="cx"> {
</span><span class="cx">     DEFINE_STATIC_LOCAL(MediaSessionManager, manager, ());
</span><span class="lines">@@ -53,48 +37,69 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaSessionManager::MediaSessionManager()
</span><ins>+    : m_interruptions(0)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MediaSessionManager::has(MediaSessionManager::MediaType type) const
</del><ins>+bool MediaSessionManager::has(MediaSession::MediaType type) const
</ins><span class="cx"> {
</span><del>-    ASSERT(type &gt;= MediaSessionManager::None &amp;&amp; type &lt;= MediaSessionManager::WebAudio);
</del><ins>+    ASSERT(type &gt;= MediaSession::None &amp;&amp; type &lt;= MediaSession::WebAudio);
</ins><span class="cx"> 
</span><del>-    for (auto it = m_tokens.begin(), end = m_tokens.end(); it != end; ++it) {
-        if ((*it)-&gt;mediaType() == type)
</del><ins>+    for (auto* session : m_sessions) {
+        if (session-&gt;mediaType() == type)
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int MediaSessionManager::count(MediaSessionManager::MediaType type) const
</del><ins>+int MediaSessionManager::count(MediaSession::MediaType type) const
</ins><span class="cx"> {
</span><del>-    ASSERT(type &gt;= MediaSessionManager::None &amp;&amp; type &lt;= MediaSessionManager::WebAudio);
</del><ins>+    ASSERT(type &gt;= MediaSession::None &amp;&amp; type &lt;= MediaSession::WebAudio);
</ins><span class="cx">     
</span><span class="cx">     int count = 0;
</span><del>-    for (auto it = m_tokens.begin(), end = m_tokens.end(); it != end; ++it) {
-        if ((*it)-&gt;mediaType() == type)
</del><ins>+    for (auto* session : m_sessions) {
+        if (session-&gt;mediaType() == type)
</ins><span class="cx">             ++count;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     return count;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaSessionManager::addToken(MediaSessionManagerToken&amp; token)
</del><ins>+void MediaSessionManager::beginInterruption()
</ins><span class="cx"> {
</span><del>-    m_tokens.append(&amp;token);
</del><ins>+    if (++m_interruptions &gt; 1)
+        return;
+
+    for (auto* session : m_sessions)
+        session-&gt;beginInterruption();
+}
+
+void MediaSessionManager::endInterruption(MediaSession::EndInterruptionFlags flags)
+{
+    ASSERT(m_interruptions &gt; 0);
+    if (--m_interruptions)
+        return;
+    
+    for (auto* session : m_sessions)
+        session-&gt;endInterruption(flags);
+}
+
+void MediaSessionManager::addSession(MediaSession&amp; session)
+{
+    m_sessions.append(&amp;session);
+    session.setState(m_interruptions ? MediaSession::Interrupted : MediaSession::Running);
</ins><span class="cx">     updateSessionState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaSessionManager::removeToken(MediaSessionManagerToken&amp; token)
</del><ins>+void MediaSessionManager::removeSession(MediaSession&amp; session)
</ins><span class="cx"> {
</span><del>-    size_t index = m_tokens.find(&amp;token);
</del><ins>+    size_t index = m_sessions.find(&amp;session);
</ins><span class="cx">     ASSERT(index != notFound);
</span><span class="cx">     if (index == notFound)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_tokens.remove(index);
</del><ins>+    m_sessions.remove(index);
</ins><span class="cx">     updateSessionState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -103,3 +108,5 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.h (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSessionManager.h        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.h        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -26,66 +26,39 @@
</span><span class="cx"> #ifndef MediaSessionManager_h
</span><span class="cx"> #define MediaSessionManager_h
</span><span class="cx"> 
</span><del>-#include &lt;wtf/PassOwnPtr.h&gt;
</del><ins>+#include &quot;MediaSession.h&quot;
+#include &quot;Settings.h&quot;
</ins><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class MediaSessionManagerToken;
</del><ins>+class HTMLMediaElement;
+class MediaSession;
</ins><span class="cx"> 
</span><span class="cx"> class MediaSessionManager {
</span><span class="cx"> public:
</span><span class="cx">     static MediaSessionManager&amp; sharedManager();
</span><span class="cx"> 
</span><del>-    enum MediaType {
-        None,
-        Video,
-        Audio,
-        WebAudio,
-    };
</del><ins>+    bool has(MediaSession::MediaType) const;
+    int count(MediaSession::MediaType) const;
</ins><span class="cx"> 
</span><del>-    bool has(MediaType) const;
-    int count(MediaType) const;
</del><ins>+    void beginInterruption();
+    void endInterruption(MediaSession::EndInterruptionFlags);
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    friend class MediaSessionManagerToken;
-    void addToken(MediaSessionManagerToken&amp;);
-    void removeToken(MediaSessionManagerToken&amp;);
</del><ins>+    friend class MediaSession;
+    void addSession(MediaSession&amp;);
+    void removeSession(MediaSession&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     MediaSessionManager();
</span><span class="cx"> 
</span><span class="cx">     void updateSessionState();
</span><span class="cx"> 
</span><del>-    Vector&lt;MediaSessionManagerToken*&gt; m_tokens;
</del><ins>+    Vector&lt;MediaSession*&gt; m_sessions;
+    int m_interruptions;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-class MediaSessionManagerClient {
-    WTF_MAKE_NONCOPYABLE(MediaSessionManagerClient);
-public:
-    MediaSessionManagerClient() { }
-
-    virtual MediaSessionManager::MediaType mediaType() const = 0;
-
-protected:
-    virtual ~MediaSessionManagerClient() { }
-};
-
-class MediaSessionManagerToken {
-public:
-    static std::unique_ptr&lt;MediaSessionManagerToken&gt; create(MediaSessionManagerClient&amp;);
-
-    MediaSessionManagerToken(MediaSessionManagerClient&amp;);
-    ~MediaSessionManagerToken();
-
-    MediaSessionManager::MediaType mediaType() const { return m_type; }
-
-private:
-
-    MediaSessionManagerClient&amp; m_client;
-    MediaSessionManager::MediaType m_type;
-};
-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // MediaSessionManager_h
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudiomacAudioDestinationMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.cpp        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx">     , m_renderBus(AudioBus::create(2, kBufferSize, false))
</span><span class="cx">     , m_sampleRate(sampleRate)
</span><span class="cx">     , m_isPlaying(false)
</span><del>-    , m_mediaSessionManagerToken(MediaSessionManagerToken::create(*this))
</del><ins>+    , m_mediaSession(MediaSession::create(*this))
</ins><span class="cx"> {
</span><span class="cx">     // Open and initialize DefaultOutputUnit
</span><span class="cx">     AudioComponent comp;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudiomacAudioDestinationMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.h (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.h        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.h        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AudioBus.h&quot;
</span><span class="cx"> #include &quot;AudioDestination.h&quot;
</span><del>-#include &quot;MediaSessionManager.h&quot;
</del><ins>+#include &quot;MediaSession.h&quot;
</ins><span class="cx"> #include &lt;AudioUnit/AudioUnit.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> // An AudioDestination using CoreAudio's default output AudioUnit
</span><span class="cx"> 
</span><del>-class AudioDestinationMac : public AudioDestination, public MediaSessionManagerClient {
</del><ins>+class AudioDestinationMac : public AudioDestination, public MediaSessionClient {
</ins><span class="cx"> public:
</span><span class="cx">     AudioDestinationMac(AudioIOCallback&amp;, float sampleRate);
</span><span class="cx">     virtual ~AudioDestinationMac();
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> 
</span><span class="cx">     OSStatus render(UInt32 numberOfFrames, AudioBufferList* ioData);
</span><span class="cx"> 
</span><del>-    virtual MediaSessionManager::MediaType mediaType() const { return MediaSessionManager::WebAudio; }
</del><ins>+    virtual MediaSession::MediaType mediaType() const { return MediaSession::WebAudio; }
</ins><span class="cx"> 
</span><span class="cx">     AudioUnit m_outputUnit;
</span><span class="cx">     AudioIOCallback&amp; m_callback;
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx">     bool m_isPlaying;
</span><span class="cx"> 
</span><span class="cx"> #if USE(AUDIO_SESSION)
</span><del>-    std::unique_ptr&lt;MediaSessionManagerToken&gt; m_mediaSessionManagerToken;
</del><ins>+    std::unique_ptr&lt;MediaSession&gt; m_mediaSession;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudiomacMediaSessionManagerMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -42,14 +42,14 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaSessionManager::updateSessionState()
</span><span class="cx"> {
</span><del>-    LOG(Media, &quot;MediaSessionManager::updateSessionState() - types: Video(%d), Audio(%d), WebAudio(%d)&quot;, count(Video), count(Audio), count(WebAudio));
</del><ins>+    LOG(Media, &quot;MediaSessionManager::updateSessionState() - types: Video(%d), Audio(%d), WebAudio(%d)&quot;, count(MediaSession::Video), count(MediaSession::Audio), count(MediaSession::WebAudio));
</ins><span class="cx"> 
</span><del>-    if (has(WebAudio))
</del><ins>+    if (has(MediaSession::WebAudio))
</ins><span class="cx">         AudioSession::sharedSession().setPreferredBufferSize(kWebAudioBufferSize);
</span><span class="cx">     // FIXME: &lt;http://webkit.org/b/116725&gt; Figure out why enabling the code below
</span><span class="cx">     // causes media LayoutTests to fail on 10.8.
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</span><del>-    else if ((has(Video) || has(Audio)) &amp;&amp; Settings::lowPowerVideoAudioBufferSizeEnabled())
</del><ins>+    else if ((has(MediaSession::Video) || has(MediaSession::Audio)) &amp;&amp; Settings::lowPowerVideoAudioBufferSizeEnabled())
</ins><span class="cx">         AudioSession::sharedSession().setPreferredBufferSize(kLowPowerVideoBufferSize);
</span><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/testing/Internals.cpp        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;MallocStatistics.h&quot;
</span><span class="cx"> #include &quot;MediaPlayer.h&quot;
</span><ins>+#include &quot;MediaSessionManager.h&quot;
</ins><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;MemoryInfo.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="lines">@@ -2271,4 +2272,19 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void Internals::beginMediaSessionInterruption()
+{
+    MediaSessionManager::sharedManager().beginInterruption();
</ins><span class="cx"> }
</span><ins>+
+void Internals::endMediaSessionInterruption(const String&amp; flagsString)
+{
+    MediaSession::EndInterruptionFlags flags = MediaSession::NoFlags;
+
+    if (equalIgnoringCase(flagsString, &quot;MayResumePlaying&quot;))
+        flags = MediaSession::MayResumePlaying;
+    
+    MediaSessionManager::sharedManager().endInterruption(flags);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/testing/Internals.h        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -332,6 +332,9 @@
</span><span class="cx">     void initializeMockMediaSource();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void beginMediaSessionInterruption();
+    void endMediaSessionInterruption(const String&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit Internals(Document*);
</span><span class="cx">     Document* contextDocument() const;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebCore/testing/Internals.idl        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -278,4 +278,7 @@
</span><span class="cx">     [RaisesException] ClientRect selectionBounds();
</span><span class="cx">     
</span><span class="cx">     [Conditional=MEDIA_SOURCE] void initializeMockMediaSource();
</span><ins>+
+    void beginMediaSessionInterruption();
+    void endMediaSessionInterruption(DOMString flags);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/CMakeLists.txt (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/CMakeLists.txt        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebKit/CMakeLists.txt        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx">     &quot;${WEBCORE_DIR}/page/scrolling&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/animation&quot;
</span><ins>+    &quot;${WEBCORE_DIR}/platform/audio&quot;
</ins><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/filters&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/harfbuzz&quot;
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebKit/ChangeLog        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-01-07  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        Teach MediaSessionManager to manage interruptions
+        https://bugs.webkit.org/show_bug.cgi?id=126530
+
+        Reviewed by Sam Weinig.
+
+        * CMakeLists.txt: Add ${WEBCORE_DIR}/platform/animation to WebCore include directories.
+
</ins><span class="cx"> 2014-01-06  Martin Robinson  &lt;mrobinson@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Small build fix for the GTK+ CMake port
</span></span></pre></div>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/CMakeLists.txt        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebKit2/CMakeLists.txt        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -93,6 +93,7 @@
</span><span class="cx">     &quot;${WEBCORE_DIR}/page/scrolling/coordinatedgraphics&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/animation&quot;
</span><ins>+    &quot;${WEBCORE_DIR}/platform/audio&quot;
</ins><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/filters&quot;
</span><span class="cx">     &quot;${WEBCORE_DIR}/platform/graphics/harfbuzz&quot;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (161480 => 161481)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-08 03:58:16 UTC (rev 161480)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-08 05:45:55 UTC (rev 161481)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-01-07  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        Teach MediaSessionManager to manage interruptions
+        https://bugs.webkit.org/show_bug.cgi?id=126530
+
+        Reviewed by Sam Weinig.
+
+        * CMakeLists.txt: Add ${WEBCORE_DIR}/platform/animation to WebCore include directories.
+
</ins><span class="cx"> 2014-01-07  Jinwoo Song  &lt;jinwoo7.song@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][WK2] Fix failing ewk_view_page_contents_get() API test
</span></span></pre>
</div>
</div>

</body>
</html>