<!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>[189031] 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/189031">189031</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2015-08-27 10:33:48 -0700 (Thu, 27 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Media Session: MediaSession constructor 'kind' argument optional
https://bugs.webkit.org/show_bug.cgi?id=148527
Reviewed by Jer Noble.
Source/WebCore:
No new tests, updated media/session/session-creation.html.
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::parseKind): Treat null kind "content".
(WebCore::MediaSession::MediaSession): Delete Document* version.
* Modules/mediasession/MediaSession.h: Make constructor private.
* Modules/mediasession/MediaSession.idl:
* WebCore.xcodeproj/project.pbxproj: Add JSMediaSessionCustom.cpp.
* bindings/js/JSMediaSessionCustom.cpp: Added.
(WebCore::constructJSMediaSession):
* dom/Document.cpp:
(WebCore::Document::defaultMediaSession): Call MediaSession::create.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::session): Compare session with document.defaultMediaSession, not
its kind.
(WebCore::HTMLMediaElement::setSession): Update comments.
LayoutTests:
* media/session/content-interruptions.html: Restructure to make less timing dependent. Minor cleanup.
* media/session/session-creation-expected.txt:
* media/session/session-creation.html: Test default MediaSession constructor argument.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsmediasessioncontentinterruptionshtml">trunk/LayoutTests/media/session/content-interruptions.html</a></li>
<li><a href="#trunkLayoutTestsmediasessionsessioncreationexpectedtxt">trunk/LayoutTests/media/session/session-creation-expected.txt</a></li>
<li><a href="#trunkLayoutTestsmediasessionsessioncreationhtml">trunk/LayoutTests/media/session/session-creation.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasessionMediaSessioncpp">trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasessionMediaSessionh">trunk/Source/WebCore/Modules/mediasession/MediaSession.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasessionMediaSessionidl">trunk/Source/WebCore/Modules/mediasession/MediaSession.idl</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsJSMediaSessionCustomcpp">trunk/Source/WebCore/bindings/js/JSMediaSessionCustom.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/LayoutTests/ChangeLog        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-08-27 Eric Carlson <eric.carlson@apple.com>
+
+ Media Session: MediaSession constructor 'kind' argument optional
+ https://bugs.webkit.org/show_bug.cgi?id=148527
+
+ Reviewed by Jer Noble.
+
+ * media/session/content-interruptions.html: Restructure to make less timing dependent. Minor cleanup.
+ * media/session/session-creation-expected.txt:
+ * media/session/session-creation.html: Test default MediaSession constructor argument.
+
</ins><span class="cx"> 2015-08-27 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Add an expectation for another momentum scrolling test that became flaky.
</span></span></pre></div>
<a id="trunkLayoutTestsmediasessioncontentinterruptionshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/session/content-interruptions.html (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/session/content-interruptions.html        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/LayoutTests/media/session/content-interruptions.html        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -8,27 +8,25 @@
</span><span class="cx">
</span><span class="cx"> function runTest()
</span><span class="cx"> {
</span><del>- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
- }
-
- window.jsTestIsAsync = true;
-
</del><ins>+ findMediaElement();
</ins><span class="cx"> session = new MediaSession("content");
</span><span class="cx">
</span><span class="cx"> consoleWrite("Waiting for Content media to begin playing.")
</span><del>- var video = document.getElementById("video");
</del><span class="cx"> video.src = findMediaFile("video", "../content/counting");
</span><span class="cx"> video.session = session;
</span><span class="cx"> video.onplaying = beganPlaying;
</span><ins>+ video.oncanplaythrough = canplaythrough;
+ }
+
+ function canplaythrough()
+ {
</ins><span class="cx"> video.play();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function beganPlaying(event)
</span><span class="cx"> {
</span><span class="cx"> consoleWrite("Media began playing.");
</span><del>- document.getElementById("video").onpause = paused;
</del><ins>+ video.onpause = paused;
</ins><span class="cx">
</span><span class="cx"> if (window.internals) {
</span><span class="cx"> testExpected('internals.mediaSessionCurrentState(session)', "active");
</span><span class="lines">@@ -51,6 +49,6 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body onload="runTest()">
</span><span class="cx"> <p>'Content' start of interruption events should indefinitely pause 'Content' media sessions.</p>
</span><del>- <video id="video" />
</del><ins>+ <video id="video" controls> </video>
</ins><span class="cx"> </body>
</span><span class="cx"> </html>
</span></span></pre></div>
<a id="trunkLayoutTestsmediasessionsessioncreationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/session/session-creation-expected.txt (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/session/session-creation-expected.txt        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/LayoutTests/media/session/session-creation-expected.txt        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -1,20 +1,30 @@
</span><span class="cx"> New media sessions should be in an Idle state after creation.
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> ---
</span><del>-Testing 'content' session
</del><ins>+Testing "new MediaSession('content')"
+EXPECTED (internals.mediaSessionCurrentState(session) == 'idle') OK
</ins><span class="cx"> ---
</span><ins>+
+---
+Testing "new MediaSession('transient')"
</ins><span class="cx"> EXPECTED (internals.mediaSessionCurrentState(session) == 'idle') OK
</span><span class="cx"> ---
</span><del>-Testing 'transient' session
</del><ins>+
</ins><span class="cx"> ---
</span><ins>+Testing "new MediaSession('transient-solo')"
</ins><span class="cx"> EXPECTED (internals.mediaSessionCurrentState(session) == 'idle') OK
</span><span class="cx"> ---
</span><del>-Testing 'transient-solo' session
</del><ins>+
</ins><span class="cx"> ---
</span><ins>+Testing "new MediaSession('ambient')"
</ins><span class="cx"> EXPECTED (internals.mediaSessionCurrentState(session) == 'idle') OK
</span><span class="cx"> ---
</span><del>-Testing 'ambient' session
</del><ins>+
</ins><span class="cx"> ---
</span><ins>+Testing "new MediaSession()"
</ins><span class="cx"> EXPECTED (internals.mediaSessionCurrentState(session) == 'idle') OK
</span><ins>+---
+
</ins><span class="cx"> END OF TEST
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsmediasessionsessioncreationhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/media/session/session-creation.html (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/media/session/session-creation.html        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/LayoutTests/media/session/session-creation.html        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -9,20 +9,27 @@
</span><span class="cx"> testSessionKind("transient");
</span><span class="cx"> testSessionKind("transient-solo");
</span><span class="cx"> testSessionKind("ambient");
</span><ins>+ testSessionKind();
</ins><span class="cx">
</span><ins>+ consoleWrite("");
</ins><span class="cx"> endTest();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function testSessionKind(sessionKind)
</span><span class="cx"> {
</span><del>- consoleWrite("---");
- consoleWrite("Testing '" + sessionKind + "' session");
- consoleWrite("---");
</del><ins>+ consoleWrite("<br>---");
</ins><span class="cx">
</span><del>- session = new MediaSession(sessionKind);
</del><ins>+ if (sessionKind != undefined) {
+ consoleWrite("Testing \"new MediaSession('" + sessionKind + "')\"");
+ session = new MediaSession(sessionKind);
+ } else {
+ consoleWrite("Testing \"new MediaSession()\"");
+ session = new MediaSession();
+ }
</ins><span class="cx">
</span><span class="cx"> if (window.internals)
</span><span class="cx"> testExpected('internals.mediaSessionCurrentState(session)', "idle");
</span><ins>+ consoleWrite("---");
</ins><span class="cx"> }
</span><span class="cx"> </script>
</span><span class="cx"> </head>
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/Source/WebCore/ChangeLog        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-08-27 Eric Carlson <eric.carlson@apple.com>
+
+ Media Session: MediaSession constructor 'kind' argument optional
+ https://bugs.webkit.org/show_bug.cgi?id=148527
+
+ Reviewed by Jer Noble.
+
+ No new tests, updated media/session/session-creation.html.
+
+ * Modules/mediasession/MediaSession.cpp:
+ (WebCore::MediaSession::parseKind): Treat null kind "content".
+ (WebCore::MediaSession::MediaSession): Delete Document* version.
+ * Modules/mediasession/MediaSession.h: Make constructor private.
+ * Modules/mediasession/MediaSession.idl:
+
+ * WebCore.xcodeproj/project.pbxproj: Add JSMediaSessionCustom.cpp.
+
+ * bindings/js/JSMediaSessionCustom.cpp: Added.
+ (WebCore::constructJSMediaSession):
+
+ * dom/Document.cpp:
+ (WebCore::Document::defaultMediaSession): Call MediaSession::create.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::session): Compare session with document.defaultMediaSession, not
+ its kind.
+ (WebCore::HTMLMediaElement::setSession): Update comments.
+
</ins><span class="cx"> 2015-08-27 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Simple line layout: Use float types wherever possible to match line tree.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasessionMediaSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -46,23 +46,21 @@
</span><span class="cx"> MediaSession::Kind MediaSession::parseKind(const String& kind)
</span><span class="cx"> {
</span><span class="cx"> // 4. Media Session
</span><del>- // 2. If no corresponding media session type can be found for the provided media session category or media session
- // category is empty, then set media session's current media session type to "content".
</del><ins>+ // 2. Set media session's current media session type to the corresponding media session type of media session category.
+
+ if (kind.isNull() || kind == contentKind)
+ return MediaSession::Kind::Content;
</ins><span class="cx"> if (kind == ambientKind)
</span><span class="cx"> return MediaSession::Kind::Ambient;
</span><span class="cx"> if (kind == transientKind)
</span><span class="cx"> return MediaSession::Kind::Transient;
</span><span class="cx"> if (kind == transientSoloKind)
</span><span class="cx"> return MediaSession::Kind::TransientSolo;
</span><ins>+
+ ASSERT_NOT_REACHED();
</ins><span class="cx"> return MediaSession::Kind::Content;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-MediaSession::MediaSession(Document& document)
- : m_document(document)
-{
- MediaSessionManager::singleton().addMediaSession(*this);
-}
-
</del><span class="cx"> MediaSession::MediaSession(ScriptExecutionContext& context, const String& kind)
</span><span class="cx"> : m_document(downcast<Document>(context))
</span><span class="cx"> , m_kind(parseKind(kind))
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasessionMediaSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasession/MediaSession.h (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasession/MediaSession.h        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.h        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -53,13 +53,11 @@
</span><span class="cx"> Ambient
</span><span class="cx"> };
</span><span class="cx">
</span><del>- static Ref<MediaSession> create(ScriptExecutionContext& context, const String& kind)
</del><ins>+ static Ref<MediaSession> create(ScriptExecutionContext& context, const String& kind = String())
</ins><span class="cx"> {
</span><span class="cx"> return adoptRef(*new MediaSession(context, kind));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- explicit MediaSession(Document&);
- MediaSession(ScriptExecutionContext&, const String&);
</del><span class="cx"> ~MediaSession();
</span><span class="cx">
</span><span class="cx"> String kind() const;
</span><span class="lines">@@ -91,6 +89,8 @@
</span><span class="cx"> private:
</span><span class="cx"> friend class HTMLMediaElement;
</span><span class="cx">
</span><ins>+ MediaSession(ScriptExecutionContext&, const String&);
+
</ins><span class="cx"> static Kind parseKind(const String&);
</span><span class="cx">
</span><span class="cx"> void addMediaElement(HTMLMediaElement&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasessionMediaSessionidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasession/MediaSession.idl (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasession/MediaSession.idl        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.idl        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">
</span><span class="cx"> [
</span><span class="cx"> Conditional=MEDIA_SESSION,
</span><del>- Constructor(MediaSessionKind kind),
</del><ins>+ CustomConstructor(optional MediaSessionKind kind),
</ins><span class="cx"> ConstructorCallWith=ScriptExecutionContext,
</span><span class="cx"> ImplementationLacksVTable,
</span><span class="cx"> ] interface MediaSession {
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -204,6 +204,7 @@
</span><span class="cx">                 077AF14018F4AE400001ED61 /* SerializedPlatformRepresentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 077AF13E18F4AE400001ED61 /* SerializedPlatformRepresentation.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 077AF14318F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 077AF14118F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.h */; };
</span><span class="cx">                 077AF14418F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 077AF14218F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.mm */; };
</span><ins>+                077B640F1B8F5D6B003E9AD5 /* JSMediaSessionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 077B640E1B8F5375003E9AD5 /* JSMediaSessionCustom.cpp */; };
</ins><span class="cx">                 0783228418013ED800999E0C /* MediaStreamAudioSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0783228218013ED700999E0C /* MediaStreamAudioSource.cpp */; };
</span><span class="cx">                 0783228518013ED800999E0C /* MediaStreamAudioSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 0783228318013ED800999E0C /* MediaStreamAudioSource.h */; };
</span><span class="cx">                 07846342145B151A00A58DF1 /* JSTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07846340145B151A00A58DF1 /* JSTrackEvent.cpp */; };
</span><span class="lines">@@ -7386,6 +7387,7 @@
</span><span class="cx">                 077AF13E18F4AE400001ED61 /* SerializedPlatformRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedPlatformRepresentation.h; sourceTree = "<group>"; };
</span><span class="cx">                 077AF14118F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedPlatformRepresentationMac.h; sourceTree = "<group>"; };
</span><span class="cx">                 077AF14218F4B1BB0001ED61 /* SerializedPlatformRepresentationMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SerializedPlatformRepresentationMac.mm; sourceTree = "<group>"; };
</span><ins>+                077B640E1B8F5375003E9AD5 /* JSMediaSessionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaSessionCustom.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 0783228218013ED700999E0C /* MediaStreamAudioSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamAudioSource.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 0783228318013ED800999E0C /* MediaStreamAudioSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamAudioSource.h; sourceTree = "<group>"; };
</span><span class="cx">                 07846340145B151A00A58DF1 /* JSTrackEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTrackEvent.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -21484,6 +21486,7 @@
</span><span class="cx">                 BC4EDEF70C08F414007EDD49 /* Custom */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                077B640E1B8F5375003E9AD5 /* JSMediaSessionCustom.cpp */,
</ins><span class="cx">                                 BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */,
</span><span class="cx">                                 FDEAAAEF12B02EE400DCF33B /* JSAudioBufferSourceNodeCustom.cpp */,
</span><span class="cx">                                 FDEAAAF012B02EE400DCF33B /* JSAudioContextCustom.cpp */,
</span><span class="lines">@@ -28224,6 +28227,7 @@
</span><span class="cx">                                 14DCF3B21B6BE2080062D4C2 /* JSCountQueuingStrategy.cpp in Sources */,
</span><span class="cx">                                 CD37B39815C1B971006DC898 /* DiagnosticLoggingKeys.cpp in Sources */,
</span><span class="cx">                                 CECADFC6153778FF00E37068 /* DictationAlternative.cpp in Sources */,
</span><ins>+                                077B640F1B8F5D6B003E9AD5 /* JSMediaSessionCustom.cpp in Sources */,
</ins><span class="cx">                                 CECADFC8153778FF00E37068 /* DictationCommand.cpp in Sources */,
</span><span class="cx">                                 D0BD4F5C1408850F006839B6 /* DictationCommandIOS.cpp in Sources */,
</span><span class="cx">                                 312D67B11535691F00563D0D /* Dictionary.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMediaSessionCustomcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/JSMediaSessionCustom.cpp (0 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMediaSessionCustom.cpp         (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSMediaSessionCustom.cpp        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSMediaSession.h"
+
+#if ENABLE(MEDIA_SESSION)
+
+#include "ExceptionCode.h"
+#include "JSDOMBinding.h"
+#include "MediaSession.h"
+#include <runtime/Error.h>
+#include <runtime/JSString.h>
+#include <wtf/GetPtr.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+EncodedJSValue JSC_HOST_CALL constructJSMediaSession(ExecState* exec)
+{
+ auto* castedThis = jsCast<DOMConstructorObject*>(exec->callee());
+ auto* context = castedThis->scriptExecutionContext();
+ if (!context)
+ return throwConstructorDocumentUnavailableError(*exec, "MediaSession");
+
+ String kind;
+ if (exec->argumentCount() > 0) {
+ JSString* kindString = exec->argument(0).toString(exec);
+ if (UNLIKELY(exec->hadException()))
+ return JSValue::encode(jsUndefined());
+ kind = kindString->value(exec);
+ if (kind != "content" && kind != "transient" && kind != "transient-solo" && kind != "ambient")
+ return throwArgumentMustBeEnumError(*exec, 0, "kind", "MediaSession", nullptr, "\"content\", \"transient\", \"transient-solo\", \"ambient\"");
+ } else
+ kind = "content";
+
+ RefPtr<MediaSession> object = MediaSession::create(*context, kind);
+ return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
+}
+
+} // namespace WebCore
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/Source/WebCore/dom/Document.cpp        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -6701,7 +6701,7 @@
</span><span class="cx"> MediaSession& Document::defaultMediaSession()
</span><span class="cx"> {
</span><span class="cx"> if (!m_defaultMediaSession)
</span><del>- m_defaultMediaSession = adoptRef(*new MediaSession(*this));
</del><ins>+ m_defaultMediaSession = MediaSession::create(*scriptExecutionContext());
</ins><span class="cx">
</span><span class="cx"> return *m_defaultMediaSession;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (189030 => 189031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-08-27 17:23:26 UTC (rev 189030)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2015-08-27 17:33:48 UTC (rev 189031)
</span><span class="lines">@@ -6542,36 +6542,32 @@
</span><span class="cx"> MediaSession* HTMLMediaElement::session() const
</span><span class="cx"> {
</span><span class="cx"> MediaSession* session = m_session.get();
</span><del>- if (session && session->kindEnum() == MediaSession::Kind::Default)
</del><ins>+ if (session && session == &document().defaultMediaSession())
</ins><span class="cx"> return nullptr;
</span><ins>+
</ins><span class="cx"> return session;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void HTMLMediaElement::setSession(MediaSession* session)
</span><span class="cx"> {
</span><del>- // 6.1
</del><ins>+ // 6.1. Extensions to the HTMLMediaElement interface
</ins><span class="cx"> // 1. Let m be the media element in question.
</span><del>- // 2. Let old media session be m's current media session, if it has one, and null otherwise.
- // 3. Let new media session be null.
- // 4. Set m's current media session to null, if it currently has one.
- // 5. Let m's current media session be the new value or the top-level browsing context's media session if the new
- // value is null.
- // 6. If the new value is null, then set the m's kind IDL attribute to the empty string. Otherwise, set m's kind IDL
- // attribute to the value of current media session's kind attribute.
- // 7. Let new media session be m's current media session.
- // 8. Update media sessions: If old media session and new media session are the same (whether both null or both the
- // same media session), then terminate these steps.
- // 9. If m is an active audio-producing participant of old media session, then pause m and remove m from old media
- // session's active audio-producing participants.
- // 10. If old media session is not null and no longer has one or more active audio-producing participants, then run
- // the media session release algorithm for old media session.
</del><ins>+ // 2. Let old media session be m’s current media session, if it has one, and null otherwise.
+ // 3. Let m’s current media session be the new value or the top-level browsing context’s media session if the new value is null.
+ // 4. Let new media session be m’s current media session.
</ins><span class="cx">
</span><ins>+ // 5. Update media sessions: If old media session and new media session are the same (whether both null or both the same media session), then terminate these steps.
+ if (m_session.get() == session)
+ return;
+
</ins><span class="cx"> if (m_session) {
</span><ins>+ // 6. If m is an audio-producing participant of old media session, then pause m and remove m from old media session’s list of audio-producing participants.
</ins><span class="cx"> if (m_session->isMediaElementActive(*this))
</span><span class="cx"> pause();
</span><span class="cx">
</span><span class="cx"> m_session->removeMediaElement(*this);
</span><span class="cx">
</span><ins>+ // 7. If old media session is not null and no longer has one or more audio-producing participants, then run the media session deactivation algorithm for old media session.
</ins><span class="cx"> if (!m_session->hasActiveMediaElements())
</span><span class="cx"> m_session->releaseSession();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>