<!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>[206984] trunk/Source/WebCore</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/206984">206984</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-10-09 23:54:21 -0700 (Sun, 09 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move encrypted media from legacy to new DOM exceptions
https://bugs.webkit.org/show_bug.cgi?id=163194

Reviewed by Youenn Fablet.

* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDM::createSession): Take a reference instead of a pointer.
* Modules/encryptedmedia/CDM.h: Updated for above change.

* Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
(WebCore::WebKitMediaKeySession::create): Take a reference instead of a pointer.
(WebCore::WebKitMediaKeySession::MediaKeySession): Ditto.
(WebCore::WebKitMediaKeySession::~MediaKeySession): Removed unneeded code that
sets m_session to null.
(WebCore::WebKitMediaKeySession::keyRequestTimerFired): Use auto.
(WebCore::WebKitMediaKeySession::update): Use ExceptionOr.
(WebCore::WebKitMediaKeySession::addKeyTimerFired): Use m_keys directly instead
of calling the keys function.
(WebCore::WebKitMediaKeySession::sendError): Set m_error directly instead of
calling the setError function.
(WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): Use auto.
(WebCore::WebKitMediaKeySession::hasPendingActivity): Check m_session directly
instead of writing !isClosed.
(WebCore::WebKitMediaKeySession::setError): Deleted.

* Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Use pragma once. Removed
unneeded includes. Changed create to take a reference instead of a pointer.
Made most members and base classes private instead of public. Also removed
a few now-unneeded functions. Made everything that was formerly protected
private instead, since the two are the same in a final class.

* Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Removed unneeded comments.
Moved from MayThrowLegacyException to MayThrowException.

* Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
(WebCore::WebKitMediaKeys::create): Use ExceptionOr.
(WebCore::WebKitMediaKeys::MediaKeys): Made argument be an rvalue reference.
Also initialize m_mediaElement in the class definition.
(WebCore::WebKitMediaKeys::~MediaKeys): Call detachKeys instead of setKeys(nullptr).
(WebCore::WebKitMediaKeys::createSession): Use ExceptionOr. Also pass reference
insteead of pointer to create. Also removed unneeded separate checks for null
strings in code that already calls isEmpty.
(WebCore::WebKitMediaKeys::isTypeSupported): Removed unneeded checks for null strings
in code that already calls isEmpty.
(WebCore::WebKitMediaKeys::cdmMediaPlayer): Tweaked a bit.
(WebCore::WebKitMediaKeys::cachedKeyForKeyId): Use auto.

* Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Use pragma once. Removed unneeded includes.
Changed cdm() function to return a reference. Initialize m_mediaElement.
Use private instead of protected.

* Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Use ConstructorMayThrowException
and MayThrowException instead of the legacy versions.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaCDMcpp">trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmediaCDMh">trunk/Source/WebCore/Modules/encryptedmedia/CDM.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeySessioncpp">trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeySessionh">trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeySessionidl">trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeyscpp">trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeysh">trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.h</a></li>
<li><a href="#trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeysidl">trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206983 => 206984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-10 06:21:52 UTC (rev 206983)
+++ trunk/Source/WebCore/ChangeLog        2016-10-10 06:54:21 UTC (rev 206984)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2016-10-09  Darin Adler  &lt;darin@apple.com&gt;
+
+        Move encrypted media from legacy to new DOM exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=163194
+
+        Reviewed by Youenn Fablet.
+
+        * Modules/encryptedmedia/CDM.cpp:
+        (WebCore::CDM::createSession): Take a reference instead of a pointer.
+        * Modules/encryptedmedia/CDM.h: Updated for above change.
+
+        * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
+        (WebCore::WebKitMediaKeySession::create): Take a reference instead of a pointer.
+        (WebCore::WebKitMediaKeySession::MediaKeySession): Ditto.
+        (WebCore::WebKitMediaKeySession::~MediaKeySession): Removed unneeded code that
+        sets m_session to null.
+        (WebCore::WebKitMediaKeySession::keyRequestTimerFired): Use auto.
+        (WebCore::WebKitMediaKeySession::update): Use ExceptionOr.
+        (WebCore::WebKitMediaKeySession::addKeyTimerFired): Use m_keys directly instead
+        of calling the keys function.
+        (WebCore::WebKitMediaKeySession::sendError): Set m_error directly instead of
+        calling the setError function.
+        (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): Use auto.
+        (WebCore::WebKitMediaKeySession::hasPendingActivity): Check m_session directly
+        instead of writing !isClosed.
+        (WebCore::WebKitMediaKeySession::setError): Deleted.
+
+        * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Use pragma once. Removed
+        unneeded includes. Changed create to take a reference instead of a pointer.
+        Made most members and base classes private instead of public. Also removed
+        a few now-unneeded functions. Made everything that was formerly protected
+        private instead, since the two are the same in a final class.
+
+        * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Removed unneeded comments.
+        Moved from MayThrowLegacyException to MayThrowException.
+
+        * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
+        (WebCore::WebKitMediaKeys::create): Use ExceptionOr.
+        (WebCore::WebKitMediaKeys::MediaKeys): Made argument be an rvalue reference.
+        Also initialize m_mediaElement in the class definition.
+        (WebCore::WebKitMediaKeys::~MediaKeys): Call detachKeys instead of setKeys(nullptr).
+        (WebCore::WebKitMediaKeys::createSession): Use ExceptionOr. Also pass reference
+        insteead of pointer to create. Also removed unneeded separate checks for null
+        strings in code that already calls isEmpty.
+        (WebCore::WebKitMediaKeys::isTypeSupported): Removed unneeded checks for null strings
+        in code that already calls isEmpty.
+        (WebCore::WebKitMediaKeys::cdmMediaPlayer): Tweaked a bit.
+        (WebCore::WebKitMediaKeys::cachedKeyForKeyId): Use auto.
+
+        * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Use pragma once. Removed unneeded includes.
+        Changed cdm() function to return a reference. Initialize m_mediaElement.
+        Use private instead of protected.
+
+        * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Use ConstructorMayThrowException
+        and MayThrowException instead of the legacy versions.
+
</ins><span class="cx"> 2016-10-09  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ENABLE_LEGACY_ENCRYPTED_MEDIA interfaces should have a hard-coded WebKit prefix
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaCDMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp (206983 => 206984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp        2016-10-10 06:21:52 UTC (rev 206983)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp        2016-10-10 06:54:21 UTC (rev 206984)
</span><span class="lines">@@ -131,9 +131,9 @@
</span><span class="cx">     return m_private-&gt;supportsMIMEType(mimeType);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;CDMSession&gt; CDM::createSession(CDMSessionClient* client)
</del><ins>+std::unique_ptr&lt;CDMSession&gt; CDM::createSession(CDMSessionClient&amp; client)
</ins><span class="cx"> {
</span><del>-    std::unique_ptr&lt;CDMSession&gt; session = m_private-&gt;createSession(client);
</del><ins>+    auto session = m_private-&gt;createSession(&amp;client);
</ins><span class="cx">     if (mediaPlayer())
</span><span class="cx">         mediaPlayer()-&gt;setCDMSession(session.get());
</span><span class="cx">     return session;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmediaCDMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.h (206983 => 206984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.h        2016-10-10 06:21:52 UTC (rev 206983)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.h        2016-10-10 06:54:21 UTC (rev 206984)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef CDM_h
-#define CDM_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
</span><span class="cx"> 
</span><span class="lines">@@ -62,7 +61,7 @@
</span><span class="cx">     ~CDM();
</span><span class="cx"> 
</span><span class="cx">     bool supportsMIMEType(const String&amp;) const;
</span><del>-    std::unique_ptr&lt;CDMSession&gt; createSession(CDMSessionClient*);
</del><ins>+    std::unique_ptr&lt;CDMSession&gt; createSession(CDMSessionClient&amp;);
</ins><span class="cx"> 
</span><span class="cx">     const String&amp; keySystem() const { return m_keySystem; }
</span><span class="cx"> 
</span><span class="lines">@@ -80,5 +79,3 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(LEGACY_ENCRYPTED_MEDIA)
</span><del>-
-#endif // CDM_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeySessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp (206983 => 206984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp        2016-10-10 06:21:52 UTC (rev 206983)
+++ trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp        2016-10-10 06:54:21 UTC (rev 206984)
</span><span class="lines">@@ -28,13 +28,10 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
</span><span class="cx"> 
</span><del>-#include &quot;CDM.h&quot;
-#include &quot;CDMSession.h&quot;
</del><span class="cx"> #include &quot;Document.h&quot;
</span><del>-#include &quot;Event.h&quot;
</del><span class="cx"> #include &quot;EventNames.h&quot;
</span><ins>+#include &quot;ExceptionCode.h&quot;
</ins><span class="cx"> #include &quot;FileSystem.h&quot;
</span><del>-#include &quot;GenericEventQueue.h&quot;
</del><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;WebKitMediaKeyError.h&quot;
</span><span class="cx"> #include &quot;WebKitMediaKeyMessageEvent.h&quot;
</span><span class="lines">@@ -42,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref&lt;WebKitMediaKeySession&gt; WebKitMediaKeySession::create(ScriptExecutionContext&amp; context, WebKitMediaKeys* keys, const String&amp; keySystem)
</del><ins>+Ref&lt;WebKitMediaKeySession&gt; WebKitMediaKeySession::create(ScriptExecutionContext&amp; context, WebKitMediaKeys&amp; keys, const String&amp; keySystem)
</ins><span class="cx"> {
</span><span class="cx">     auto session = adoptRef(*new WebKitMediaKeySession(context, keys, keySystem));
</span><span class="cx">     session-&gt;suspendIfNeeded();
</span><span class="lines">@@ -49,12 +46,12 @@
</span><span class="cx">     return session;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebKitMediaKeySession::WebKitMediaKeySession(ScriptExecutionContext&amp; context, WebKitMediaKeys* keys, const String&amp; keySystem)
</del><ins>+WebKitMediaKeySession::WebKitMediaKeySession(ScriptExecutionContext&amp; context, WebKitMediaKeys&amp; keys, const String&amp; keySystem)
</ins><span class="cx">     : ActiveDOMObject(&amp;context)
</span><del>-    , m_keys(keys)
</del><ins>+    , m_keys(&amp;keys)
</ins><span class="cx">     , m_keySystem(keySystem)
</span><span class="cx">     , m_asyncEventQueue(*this)
</span><del>-    , m_session(keys-&gt;cdm()-&gt;createSession(this))
</del><ins>+    , m_session(keys.cdm().createSession(*this))
</ins><span class="cx">     , m_keyRequestTimer(*this, &amp;WebKitMediaKeySession::keyRequestTimerFired)
</span><span class="cx">     , m_addKeyTimer(*this, &amp;WebKitMediaKeySession::addKeyTimerFired)
</span><span class="cx"> {
</span><span class="lines">@@ -62,19 +59,12 @@
</span><span class="cx"> 
</span><span class="cx"> WebKitMediaKeySession::~WebKitMediaKeySession()
</span><span class="cx"> {
</span><del>-    if (m_session) {
</del><ins>+    if (m_session)
</ins><span class="cx">         m_session-&gt;setClient(nullptr);
</span><del>-        m_session = nullptr;
-    }
</del><span class="cx"> 
</span><span class="cx">     m_asyncEventQueue.cancelAllEvents();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebKitMediaKeySession::setError(WebKitMediaKeyError* error)
-{
-    m_error = error;
-}
-
</del><span class="cx"> void WebKitMediaKeySession::close()
</span><span class="cx"> {
</span><span class="cx">     if (m_session)
</span><span class="lines">@@ -104,7 +94,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     while (!m_pendingKeyRequests.isEmpty()) {
</span><del>-        PendingKeyRequest request = m_pendingKeyRequests.takeFirst();
</del><ins>+        auto request = m_pendingKeyRequests.takeFirst();
</ins><span class="cx"> 
</span><span class="cx">         // NOTE: Continued from step 5 in MediaKeys::createSession().
</span><span class="cx">         // The user agent will asynchronously execute the following steps in the task:
</span><span class="lines">@@ -117,7 +107,7 @@
</span><span class="cx"> 
</span><span class="cx">         // 3. Use cdm to generate a key request and follow the steps for the first matching condition from the following list:
</span><span class="cx"> 
</span><del>-        RefPtr&lt;Uint8Array&gt; keyRequest = m_session-&gt;generateKeyRequest(request.mimeType, request.initData.ptr(), destinationURL, errorCode, systemCode);
</del><ins>+        auto keyRequest = m_session-&gt;generateKeyRequest(request.mimeType, request.initData.ptr(), destinationURL, errorCode, systemCode);
</ins><span class="cx"> 
</span><span class="cx">         // Otherwise [if a request is not successfully generated]:
</span><span class="cx">         if (errorCode) {
</span><span class="lines">@@ -140,20 +130,20 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebKitMediaKeySession::update(Ref&lt;Uint8Array&gt;&amp;&amp; key, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; WebKitMediaKeySession::update(Ref&lt;Uint8Array&gt;&amp;&amp; key)
</ins><span class="cx"> {
</span><span class="cx">     // From &lt;http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#dom-addkey&gt;:
</span><span class="cx">     // The addKey(key) method must run the following steps:
</span><span class="cx">     // 1. If the first or second argument [sic] is an empty array, throw an INVALID_ACCESS_ERR.
</span><span class="cx">     // NOTE: the reference to a &quot;second argument&quot; is a spec bug.
</span><del>-    if (!key-&gt;length()) {
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
</del><ins>+    if (!key-&gt;length())
+        return Exception { INVALID_ACCESS_ERR };
</ins><span class="cx"> 
</span><span class="cx">     // 2. Schedule a task to handle the call, providing key.
</span><span class="cx">     m_pendingKeys.append(WTFMove(key));
</span><span class="cx">     m_addKeyTimer.startOneShot(0);
</span><ins>+
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebKitMediaKeySession::addKeyTimerFired()
</span><span class="lines">@@ -192,7 +182,8 @@
</span><span class="cx">             keyaddedEvent-&gt;setTarget(this);
</span><span class="cx">             m_asyncEventQueue.enqueueEvent(WTFMove(keyaddedEvent));
</span><span class="cx"> 
</span><del>-            keys()-&gt;keyAdded();
</del><ins>+            ASSERT(m_keys);
+            m_keys-&gt;keyAdded();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // 2.8. If any of the preceding steps in the task failed
</span><span class="lines">@@ -216,10 +207,9 @@
</span><span class="cx">     m_asyncEventQueue.enqueueEvent(WTFMove(event));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebKitMediaKeySession::sendError(CDMSessionClient::MediaKeyErrorCode errorCode, uint32_t systemCode)
</del><ins>+void WebKitMediaKeySession::sendError(MediaKeyErrorCode errorCode, uint32_t systemCode)
</ins><span class="cx"> {
</span><del>-    Ref&lt;WebKitMediaKeyError&gt; error = WebKitMediaKeyError::create(errorCode, systemCode).get();
-    setError(error.ptr());
</del><ins>+    m_error = WebKitMediaKeyError::create(errorCode, systemCode);
</ins><span class="cx"> 
</span><span class="cx">     auto keyerrorEvent = Event::create(eventNames().webkitkeyerrorEvent, false, false);
</span><span class="cx">     keyerrorEvent-&gt;setTarget(this);
</span><span class="lines">@@ -228,19 +218,19 @@
</span><span class="cx"> 
</span><span class="cx"> String WebKitMediaKeySession::mediaKeysStorageDirectory() const
</span><span class="cx"> {
</span><del>-    Document* document = downcast&lt;Document&gt;(scriptExecutionContext());
</del><ins>+    auto* document = downcast&lt;Document&gt;(scriptExecutionContext());
</ins><span class="cx">     if (!document)
</span><span class="cx">         return emptyString();
</span><span class="cx"> 
</span><del>-    Settings* settings = document-&gt;settings();
</del><ins>+    auto* settings = document-&gt;settings();
</ins><span class="cx">     if (!settings)
</span><span class="cx">         return emptyString();
</span><span class="cx"> 
</span><del>-    String storageDirectory = settings-&gt;mediaKeysStorageDirectory();
</del><ins>+    auto storageDirectory = settings-&gt;mediaKeysStorageDirectory();
</ins><span class="cx">     if (storageDirectory.isEmpty())
</span><span class="cx">         return emptyString();
</span><span class="cx"> 
</span><del>-    SecurityOrigin* origin = document-&gt;securityOrigin();
</del><ins>+    auto* origin = document-&gt;securityOrigin();
</ins><span class="cx">     if (!origin)
</span><span class="cx">         return emptyString();
</span><span class="cx"> 
</span><span class="lines">@@ -249,7 +239,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool WebKitMediaKeySession::hasPendingActivity() const
</span><span class="cx"> {
</span><del>-    return (m_keys &amp;&amp; !isClosed()) || m_asyncEventQueue.hasPendingEvents();
</del><ins>+    return (m_keys &amp;&amp; m_session) || m_asyncEventQueue.hasPendingEvents();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebKitMediaKeySession::stop()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeySessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h (206983 => 206984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h        2016-10-10 06:21:52 UTC (rev 206983)
+++ trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h        2016-10-10 06:54:21 UTC (rev 206984)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef WebKitMediaKeySession_h
-#define WebKitMediaKeySession_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
</span><span class="cx"> 
</span><span class="lines">@@ -31,13 +30,11 @@
</span><span class="cx"> #include &quot;ActiveDOMObject.h&quot;
</span><span class="cx"> #include &quot;CDMSession.h&quot;
</span><span class="cx"> #include &quot;EventTarget.h&quot;
</span><del>-#include &quot;ExceptionCode.h&quot;
</del><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &quot;GenericEventQueue.h&quot;
</span><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="cx"> #include &lt;runtime/Uint8Array.h&gt;
</span><span class="cx"> #include &lt;wtf/Deque.h&gt;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/text/WTFString.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -44,50 +41,48 @@
</span><span class="cx"> class WebKitMediaKeyError;
</span><span class="cx"> class WebKitMediaKeys;
</span><span class="cx"> 
</span><del>-class WebKitMediaKeySession final : public RefCounted&lt;WebKitMediaKeySession&gt;, public EventTargetWithInlineData, public ActiveDOMObject, public CDMSessionClient {
</del><ins>+class WebKitMediaKeySession final : public RefCounted&lt;WebKitMediaKeySession&gt;, public EventTargetWithInlineData, private ActiveDOMObject, private CDMSessionClient {
</ins><span class="cx"> public:
</span><del>-    static Ref&lt;WebKitMediaKeySession&gt; create(ScriptExecutionContext&amp;, WebKitMediaKeys*, const String&amp; keySystem);
</del><ins>+    static Ref&lt;WebKitMediaKeySession&gt; create(ScriptExecutionContext&amp;, WebKitMediaKeys&amp;, const String&amp; keySystem);
</ins><span class="cx">     ~WebKitMediaKeySession();
</span><span class="cx"> 
</span><ins>+    WebKitMediaKeyError* error() { return m_error.get(); }
</ins><span class="cx">     const String&amp; keySystem() const { return m_keySystem; }
</span><del>-    CDMSession* session() { return m_session.get(); }
</del><span class="cx">     const String&amp; sessionId() const;
</span><ins>+    ExceptionOr&lt;void&gt; update(Ref&lt;Uint8Array&gt;&amp;&amp; key);
+    void close();
</ins><span class="cx"> 
</span><del>-    void setError(WebKitMediaKeyError*);
-    WebKitMediaKeyError* error() { return m_error.get(); }
</del><ins>+    CDMSession* session() { return m_session.get(); }
</ins><span class="cx"> 
</span><del>-    void setKeys(WebKitMediaKeys* keys) { m_keys = keys; }
-    WebKitMediaKeys* keys() const { return m_keys; }
</del><ins>+    void detachKeys() { m_keys = nullptr; }
</ins><span class="cx"> 
</span><span class="cx">     void generateKeyRequest(const String&amp; mimeType, Ref&lt;Uint8Array&gt;&amp;&amp; initData);
</span><del>-    void update(Ref&lt;Uint8Array&gt;&amp;&amp; key, ExceptionCode&amp;);
</del><ins>+    RefPtr&lt;ArrayBuffer&gt; cachedKeyForKeyId(const String&amp; keyId) const;
</ins><span class="cx"> 
</span><del>-    bool isClosed() const { return !m_session; }
-    void close();
</del><ins>+    using RefCounted::ref;
+    using RefCounted::deref;
</ins><span class="cx"> 
</span><del>-    RefPtr&lt;ArrayBuffer&gt; cachedKeyForKeyId(const String&amp; keyId) const;
</del><ins>+    bool hasPendingActivity() const final;
</ins><span class="cx"> 
</span><del>-    using RefCounted&lt;WebKitMediaKeySession&gt;::ref;
-    using RefCounted&lt;WebKitMediaKeySession&gt;::deref;
</del><ins>+private:
+    WebKitMediaKeySession(ScriptExecutionContext&amp;, WebKitMediaKeys&amp;, const String&amp; keySystem);
+    void keyRequestTimerFired();
+    void addKeyTimerFired();
</ins><span class="cx"> 
</span><del>-    void enqueueEvent(RefPtr&lt;Event&gt;&amp;&amp;);
</del><ins>+    void sendMessage(Uint8Array*, String destinationURL) final;
+    void sendError(MediaKeyErrorCode, uint32_t systemCode) final;
+    String mediaKeysStorageDirectory() const final;
</ins><span class="cx"> 
</span><del>-    EventTargetInterface eventTargetInterface() const override { return WebKitMediaKeySessionEventTargetInterfaceType; }
-    ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); }
</del><ins>+    void refEventTarget() final { ref(); }
+    void derefEventTarget() final { deref(); }
</ins><span class="cx"> 
</span><del>-    // ActiveDOMObject API.
-    bool hasPendingActivity() const override;
</del><ins>+    void stop() final;
+    bool canSuspendForDocumentSuspension() const final;
+    const char* activeDOMObjectName() const final;
</ins><span class="cx"> 
</span><del>-protected:
-    WebKitMediaKeySession(ScriptExecutionContext&amp;, WebKitMediaKeys*, const String&amp; keySystem);
-    void keyRequestTimerFired();
-    void addKeyTimerFired();
</del><ins>+    EventTargetInterface eventTargetInterface() const final { return WebKitMediaKeySessionEventTargetInterfaceType; }
+    ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
</ins><span class="cx"> 
</span><del>-    // CDMSessionClient
-    void sendMessage(Uint8Array*, String destinationURL) override;
-    void sendError(MediaKeyErrorCode, uint32_t systemCode) override;
-    String mediaKeysStorageDirectory() const override;
-
</del><span class="cx">     WebKitMediaKeys* m_keys;
</span><span class="cx">     String m_keySystem;
</span><span class="cx">     String m_sessionId;
</span><span class="lines">@@ -104,19 +99,8 @@
</span><span class="cx"> 
</span><span class="cx">     Deque&lt;Ref&lt;Uint8Array&gt;&gt; m_pendingKeys;
</span><span class="cx">     Timer m_addKeyTimer;
</span><del>-
-private:
-    void refEventTarget() override { ref(); }
-    void derefEventTarget() override { deref(); }
-
-    // ActiveDOMObject API.
-    void stop() override;
-    bool canSuspendForDocumentSuspension() const override;
-    const char* activeDOMObjectName() const override;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(LEGACY_ENCRYPTED_MEDIA)
</span><del>-
-#endif // WebKitMediaKeySession_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeySessionidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl (206983 => 206984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl        2016-10-10 06:21:52 UTC (rev 206983)
+++ trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl        2016-10-10 06:54:21 UTC (rev 206984)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2013 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -24,18 +24,15 @@
</span><span class="cx">      */
</span><span class="cx"> 
</span><span class="cx"> [
</span><ins>+    ActiveDOMObject,
</ins><span class="cx">     Conditional=LEGACY_ENCRYPTED_MEDIA,
</span><del>-    ActiveDOMObject,
</del><span class="cx"> ] interface WebKitMediaKeySession : EventTarget {
</span><del>-    // error state
</del><span class="cx">     readonly attribute WebKitMediaKeyError error;
</span><span class="cx"> 
</span><del>-    // session properties
</del><span class="cx">     readonly attribute DOMString keySystem;
</span><span class="cx">     readonly attribute DOMString sessionId;
</span><span class="cx"> 
</span><del>-    // session operations
-    [MayThrowLegacyException] void update(Uint8Array key);
</del><ins>+    [MayThrowException] void update(Uint8Array key);
</ins><span class="cx">     void close();
</span><span class="cx">     
</span><span class="cx">     attribute EventHandler onwebkitkeyadded;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeyscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp (206983 => 206984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp        2016-10-10 06:21:52 UTC (rev 206983)
+++ trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp        2016-10-10 06:54:21 UTC (rev 206984)
</span><span class="lines">@@ -28,35 +28,28 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
</span><span class="cx"> 
</span><del>-#include &quot;CDM.h&quot;
</del><span class="cx"> #include &quot;EventNames.h&quot;
</span><span class="cx"> #include &quot;HTMLMediaElement.h&quot;
</span><del>-#include &quot;UUID.h&quot;
-#include &quot;WebKitMediaKeyMessageEvent.h&quot;
</del><span class="cx"> #include &quot;WebKitMediaKeySession.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-RefPtr&lt;WebKitMediaKeys&gt; WebKitMediaKeys::create(const String&amp; keySystem, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;WebKitMediaKeys&gt;&gt; WebKitMediaKeys::create(const String&amp; keySystem)
</ins><span class="cx"> {
</span><span class="cx">     // From &lt;http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#dom-media-keys-constructor&gt;:
</span><span class="cx">     // The MediaKeys(keySystem) constructor must run the following steps:
</span><span class="cx"> 
</span><span class="cx">     // 1. If keySystem is null or an empty string, throw an INVALID_ACCESS_ERR exception and abort these steps.
</span><del>-    if (keySystem.isNull() || keySystem.isEmpty()) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
</del><ins>+    if (keySystem.isEmpty())
+        return Exception { INVALID_ACCESS_ERR };
</ins><span class="cx"> 
</span><span class="cx">     // 2. If keySystem is not one of the user agent's supported Key Systems, throw a NOT_SUPPORTED_ERR and abort these steps.
</span><del>-    if (!CDM::supportsKeySystem(keySystem)) {
-        ec = NOT_SUPPORTED_ERR;
-        return nullptr;
-    }
</del><ins>+    if (!CDM::supportsKeySystem(keySystem))
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><span class="cx">     // 3. Let cdm be the content decryption module corresponding to keySystem.
</span><span class="cx">     // 4. Load cdm if necessary.
</span><del>-    std::unique_ptr&lt;CDM&gt; cdm = CDM::create(keySystem);
</del><ins>+    auto cdm = CDM::create(keySystem);
</ins><span class="cx"> 
</span><span class="cx">     // 5. Create a new MediaKeys object.
</span><span class="cx">     // 5.1 Let the keySystem attribute be keySystem.
</span><span class="lines">@@ -64,9 +57,8 @@
</span><span class="cx">     return adoptRef(*new WebKitMediaKeys(keySystem, WTFMove(cdm)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebKitMediaKeys::WebKitMediaKeys(const String&amp; keySystem, std::unique_ptr&lt;CDM&gt; cdm)
-    : m_mediaElement(nullptr)
-    , m_keySystem(keySystem)
</del><ins>+WebKitMediaKeys::WebKitMediaKeys(const String&amp; keySystem, std::unique_ptr&lt;CDM&gt;&amp;&amp; cdm)
+    : m_keySystem(keySystem)
</ins><span class="cx">     , m_cdm(WTFMove(cdm))
</span><span class="cx"> {
</span><span class="cx">     m_cdm-&gt;setClient(this);
</span><span class="lines">@@ -78,11 +70,11 @@
</span><span class="cx">     // When destroying a MediaKeys object, follow the steps in close().
</span><span class="cx">     for (auto&amp; session : m_sessions) {
</span><span class="cx">         session-&gt;close();
</span><del>-        session-&gt;setKeys(nullptr);
</del><ins>+        session-&gt;detachKeys();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;WebKitMediaKeySession&gt; WebKitMediaKeys::createSession(ScriptExecutionContext&amp; context, const String&amp; type, Ref&lt;Uint8Array&gt;&amp;&amp; initData, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;Ref&lt;WebKitMediaKeySession&gt;&gt; WebKitMediaKeys::createSession(ScriptExecutionContext&amp; context, const String&amp; type, Ref&lt;Uint8Array&gt;&amp;&amp; initData)
</ins><span class="cx"> {
</span><span class="cx">     // From &lt;http://www.w3.org/TR/2014/WD-encrypted-media-20140218/#dom-createsession&gt;:
</span><span class="cx">     // The createSession(type, initData) method must run the following steps:
</span><span class="lines">@@ -89,28 +81,22 @@
</span><span class="cx">     // Note: The contents of initData are container-specific Initialization Data.
</span><span class="cx"> 
</span><span class="cx">     // 1. If contentType is null or an empty string, throw an INVALID_ACCESS_ERR exception and abort these steps.
</span><del>-    if (type.isEmpty()) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
</del><ins>+    if (type.isEmpty())
+        return Exception { INVALID_ACCESS_ERR };
</ins><span class="cx"> 
</span><span class="cx">     // 2. If initData is an empty array, throw an INVALID_ACCESS_ERR exception and abort these steps.
</span><del>-    if (!initData-&gt;length()) {
-        ec = INVALID_ACCESS_ERR;
-        return nullptr;
-    }
</del><ins>+    if (!initData-&gt;length())
+        return Exception { INVALID_ACCESS_ERR };
</ins><span class="cx"> 
</span><span class="cx">     // 3. If type contains a MIME type that is not supported or is not supported by the keySystem, throw
</span><span class="cx">     // a NOT_SUPPORTED_ERR exception and abort these steps.
</span><del>-    if (!type.isNull() &amp;&amp; !type.isEmpty() &amp;&amp; !m_cdm-&gt;supportsMIMEType(type)) {
-        ec = NOT_SUPPORTED_ERR;
-        return nullptr;
-    }
</del><ins>+    if (!m_cdm-&gt;supportsMIMEType(type))
+        return Exception { NOT_SUPPORTED_ERR };
</ins><span class="cx"> 
</span><span class="cx">     // 4. Create a new MediaKeySession object.
</span><span class="cx">     // 4.1 Let the keySystem attribute be keySystem.
</span><span class="cx">     // 4.2 Let the sessionId attribute be a unique Session ID string. It may be generated by cdm.
</span><del>-    auto session = WebKitMediaKeySession::create(context, this, keySystem());
</del><ins>+    auto session = WebKitMediaKeySession::create(context, *this, m_keySystem);
</ins><span class="cx"> 
</span><span class="cx">     m_sessions.append(session.copyRef());
</span><span class="cx"> 
</span><span class="lines">@@ -125,11 +111,11 @@
</span><span class="cx"> {
</span><span class="cx">     // 1. If keySystem contains an unrecognized or unsupported Key System, return false and abort these steps.
</span><span class="cx">     // Key system string comparison is case-sensitive.
</span><del>-    if (keySystem.isNull() || keySystem.isEmpty() || !CDM::supportsKeySystem(keySystem))
</del><ins>+    if (keySystem.isEmpty() || !CDM::supportsKeySystem(keySystem))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     // 2. If type is null or an empty string, return true and abort these steps.
</span><del>-    if (mimeType.isNull() || mimeType.isEmpty())
</del><ins>+    if (mimeType.isEmpty())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     // 3. If the Key System specified by keySystem does not support decrypting the container and/or codec
</span><span class="lines">@@ -154,9 +140,9 @@
</span><span class="cx"> 
</span><span class="cx"> MediaPlayer* WebKitMediaKeys::cdmMediaPlayer(const CDM*) const
</span><span class="cx"> {
</span><del>-    if (m_mediaElement)
-        return m_mediaElement-&gt;player();
-    return 0;
</del><ins>+    if (!m_mediaElement)
+        return nullptr;
+    return m_mediaElement-&gt;player();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebKitMediaKeys::keyAdded()
</span><span class="lines">@@ -163,13 +149,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (m_mediaElement)
</span><span class="cx">         m_mediaElement-&gt;keyAdded();
</span><del>-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;ArrayBuffer&gt; WebKitMediaKeys::cachedKeyForKeyId(const String&amp; keyId) const
</span><span class="cx"> {
</span><span class="cx">     for (auto&amp; session : m_sessions) {
</span><del>-        if (RefPtr&lt;ArrayBuffer&gt; key = session-&gt;cachedKeyForKeyId(keyId))
</del><ins>+        if (auto key = session-&gt;cachedKeyForKeyId(keyId))
</ins><span class="cx">             return key;
</span><span class="cx">     }
</span><span class="cx">     return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeysh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.h (206983 => 206984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.h        2016-10-10 06:21:52 UTC (rev 206983)
+++ trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.h        2016-10-10 06:54:21 UTC (rev 206984)
</span><span class="lines">@@ -23,51 +23,44 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef WebKitMediaKeys_h
-#define WebKitMediaKeys_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CDM.h&quot;
</span><del>-#include &quot;EventTarget.h&quot;
-#include &quot;ExceptionCode.h&quot;
</del><ins>+#include &quot;ExceptionOr.h&quot;
</ins><span class="cx"> #include &lt;runtime/Uint8Array.h&gt;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
</del><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><del>-#include &lt;wtf/text/WTFString.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class HTMLMediaElement;
</span><ins>+class ScriptExecutionContext;
</ins><span class="cx"> class WebKitMediaKeySession;
</span><span class="cx"> 
</span><del>-class WebKitMediaKeys : public RefCounted&lt;WebKitMediaKeys&gt;, public CDMClient {
</del><ins>+class WebKitMediaKeys final : public RefCounted&lt;WebKitMediaKeys&gt;, private CDMClient {
</ins><span class="cx"> public:
</span><del>-    static RefPtr&lt;WebKitMediaKeys&gt; create(const String&amp; keySystem, ExceptionCode&amp;);
</del><ins>+    static ExceptionOr&lt;Ref&lt;WebKitMediaKeys&gt;&gt; create(const String&amp; keySystem);
</ins><span class="cx">     virtual ~WebKitMediaKeys();
</span><span class="cx"> 
</span><del>-    RefPtr&lt;WebKitMediaKeySession&gt; createSession(ScriptExecutionContext&amp;, const String&amp; mimeType, Ref&lt;Uint8Array&gt;&amp;&amp; initData, ExceptionCode&amp;);
-
</del><ins>+    ExceptionOr&lt;Ref&lt;WebKitMediaKeySession&gt;&gt; createSession(ScriptExecutionContext&amp;, const String&amp; mimeType, Ref&lt;Uint8Array&gt;&amp;&amp; initData);
</ins><span class="cx">     static bool isTypeSupported(const String&amp; keySystem, const String&amp; mimeType);
</span><del>-
</del><span class="cx">     const String&amp; keySystem() const { return m_keySystem; }
</span><del>-    CDM* cdm() { return m_cdm.get(); }
</del><span class="cx"> 
</span><del>-    HTMLMediaElement* mediaElement() const { return m_mediaElement; }
</del><ins>+    CDM&amp; cdm() { ASSERT(m_cdm); return *m_cdm; }
+
</ins><span class="cx">     void setMediaElement(HTMLMediaElement*);
</span><span class="cx"> 
</span><span class="cx">     void keyAdded();
</span><span class="cx">     RefPtr&lt;ArrayBuffer&gt; cachedKeyForKeyId(const String&amp; keyId) const;
</span><span class="cx"> 
</span><del>-protected:
-    // CDMClient:
-    MediaPlayer* cdmMediaPlayer(const CDM*) const override;
</del><ins>+private:
+    MediaPlayer* cdmMediaPlayer(const CDM*) const final;
</ins><span class="cx"> 
</span><del>-    WebKitMediaKeys(const String&amp; keySystem, std::unique_ptr&lt;CDM&gt;);
</del><ins>+    WebKitMediaKeys(const String&amp; keySystem, std::unique_ptr&lt;CDM&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;Ref&lt;WebKitMediaKeySession&gt;&gt; m_sessions;
</span><del>-
-    HTMLMediaElement* m_mediaElement;
</del><ins>+    HTMLMediaElement* m_mediaElement { nullptr };
</ins><span class="cx">     String m_keySystem;
</span><span class="cx">     std::unique_ptr&lt;CDM&gt; m_cdm;
</span><span class="cx"> };
</span><span class="lines">@@ -75,5 +68,3 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(LEGACY_ENCRYPTED_MEDIA)
</span><del>-
-#endif // WebKitMediaKeys_h
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesencryptedmedialegacyWebKitMediaKeysidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.idl (206983 => 206984)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.idl        2016-10-10 06:21:52 UTC (rev 206983)
+++ trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.idl        2016-10-10 06:54:21 UTC (rev 206984)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2013 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,9 +26,9 @@
</span><span class="cx"> [
</span><span class="cx">     Conditional=LEGACY_ENCRYPTED_MEDIA,
</span><span class="cx">     Constructor(DOMString keySystem),
</span><del>-    ConstructorMayThrowLegacyException,
</del><ins>+    ConstructorMayThrowException,
</ins><span class="cx"> ] interface WebKitMediaKeys {
</span><del>-    [CallWith=ScriptExecutionContext, MayThrowLegacyException] WebKitMediaKeySession createSession(DOMString type, Uint8Array initData);
</del><ins>+    [CallWith=ScriptExecutionContext, MayThrowException] WebKitMediaKeySession createSession(DOMString type, Uint8Array initData);
</ins><span class="cx">     static boolean isTypeSupported(DOMString keySystem, optional DOMString type);
</span><span class="cx">     readonly attribute DOMString keySystem;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>