<!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>[208663] 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/208663">208663</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-11-12 20:52:31 -0800 (Sat, 12 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove some use of ExceptionCode in MediaStream
https://bugs.webkit.org/show_bug.cgi?id=164690

Reviewed by Sam Weinig.

* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::MediaDevices): Take a Document&amp;.
(WebCore::MediaDevices::create): Ditto.
(WebCore::MediaDevices::~MediaDevices): Deleted.
(WebCore::MediaDevices::getUserMedia): Check document for null and
pass a reference to UserMediaRequest::start. Removed unused ExceptionCode
argument to UserMediaRequest::start, since the only exception was for
a null document.
(WebCore::MediaDevices::enumerateDevices): Check document for null and
pass a reference to MediaDevicesRequest::create. Removed exception
handling entirely because MediaDevicesRequest::create was not ever
raising an exception before.
* Modules/mediastream/MediaDevices.h: Updated for above changes.
* Modules/mediastream/MediaDevices.idl: Removed MayThrowException from
enumerateDevices, because it never throws an exception.

* Modules/mediastream/MediaDevicesRequest.cpp:
(WebCore::MediaDevicesRequest::MediaDevicesRequest): Take a Document&amp;.
Removed unused ExceptionCode&amp; argument.
(WebCore::MediaDevicesRequest::create): Ditto.
* Modules/mediastream/MediaDevicesRequest.h: Updated for above changes.

* Modules/mediastream/NavigatorMediaDevices.cpp:
(WebCore::NavigatorMediaDevices::mediaDevices): Pass a reference.

* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::start): Use ExceptionOr.
(WebCore::UserMediaRequest::UserMediaRequest): Take a Document&amp; and
a UserMediaController&amp;.
* Modules/mediastream/UserMediaRequest.h: Updated for above changes.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaDevicescpp">trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaDevicesh">trunk/Source/WebCore/Modules/mediastream/MediaDevices.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaDevicesidl">trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaDevicesRequestcpp">trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaDevicesRequesth">trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamNavigatorMediaDevicescpp">trunk/Source/WebCore/Modules/mediastream/NavigatorMediaDevices.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamUserMediaRequestcpp">trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamUserMediaRequesth">trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208662 => 208663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-13 03:24:27 UTC (rev 208662)
+++ trunk/Source/WebCore/ChangeLog        2016-11-13 04:52:31 UTC (rev 208663)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2016-11-12  Darin Adler  &lt;darin@apple.com&gt;
+
+        Remove some use of ExceptionCode in MediaStream
+        https://bugs.webkit.org/show_bug.cgi?id=164690
+
+        Reviewed by Sam Weinig.
+
+        * Modules/mediastream/MediaDevices.cpp:
+        (WebCore::MediaDevices::MediaDevices): Take a Document&amp;.
+        (WebCore::MediaDevices::create): Ditto.
+        (WebCore::MediaDevices::~MediaDevices): Deleted.
+        (WebCore::MediaDevices::getUserMedia): Check document for null and
+        pass a reference to UserMediaRequest::start. Removed unused ExceptionCode
+        argument to UserMediaRequest::start, since the only exception was for
+        a null document.
+        (WebCore::MediaDevices::enumerateDevices): Check document for null and
+        pass a reference to MediaDevicesRequest::create. Removed exception
+        handling entirely because MediaDevicesRequest::create was not ever
+        raising an exception before.
+        * Modules/mediastream/MediaDevices.h: Updated for above changes.
+        * Modules/mediastream/MediaDevices.idl: Removed MayThrowException from
+        enumerateDevices, because it never throws an exception.
+
+        * Modules/mediastream/MediaDevicesRequest.cpp:
+        (WebCore::MediaDevicesRequest::MediaDevicesRequest): Take a Document&amp;.
+        Removed unused ExceptionCode&amp; argument.
+        (WebCore::MediaDevicesRequest::create): Ditto.
+        * Modules/mediastream/MediaDevicesRequest.h: Updated for above changes.
+
+        * Modules/mediastream/NavigatorMediaDevices.cpp:
+        (WebCore::NavigatorMediaDevices::mediaDevices): Pass a reference.
+
+        * Modules/mediastream/UserMediaRequest.cpp:
+        (WebCore::UserMediaRequest::start): Use ExceptionOr.
+        (WebCore::UserMediaRequest::UserMediaRequest): Take a Document&amp; and
+        a UserMediaController&amp;.
+        * Modules/mediastream/UserMediaRequest.h: Updated for above changes.
+
</ins><span class="cx"> 2016-11-12  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaDevicescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp (208662 => 208663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp        2016-11-13 03:24:27 UTC (rev 208662)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp        2016-11-13 04:52:31 UTC (rev 208663)
</span><span class="lines">@@ -33,31 +33,24 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><del>-#include &quot;Dictionary.h&quot;
</del><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;MediaDevicesRequest.h&quot;
</span><del>-#include &quot;MediaStream.h&quot;
</del><span class="cx"> #include &quot;MediaTrackSupportedConstraints.h&quot;
</span><span class="cx"> #include &quot;RealtimeMediaSourceCenter.h&quot;
</span><del>-#include &quot;UserMediaController.h&quot;
</del><span class="cx"> #include &quot;UserMediaRequest.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref&lt;MediaDevices&gt; MediaDevices::create(ScriptExecutionContext* context)
</del><ins>+inline MediaDevices::MediaDevices(Document&amp; document)
+    : ContextDestructionObserver(&amp;document)
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new MediaDevices(context));
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaDevices::MediaDevices(ScriptExecutionContext* context)
-    : ContextDestructionObserver(context)
</del><ins>+Ref&lt;MediaDevices&gt; MediaDevices::create(Document&amp; document)
</ins><span class="cx"> {
</span><ins>+    return adoptRef(*new MediaDevices(document));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaDevices::~MediaDevices()
-{
-}
-
</del><span class="cx"> Document* MediaDevices::document() const
</span><span class="cx"> {
</span><span class="cx">     return downcast&lt;Document&gt;(scriptExecutionContext());
</span><span class="lines">@@ -65,22 +58,18 @@
</span><span class="cx"> 
</span><span class="cx"> ExceptionOr&lt;void&gt; MediaDevices::getUserMedia(Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, Promise&amp;&amp; promise) const
</span><span class="cx"> {
</span><del>-    ExceptionCode ec = 0;
-    UserMediaRequest::start(document(), WTFMove(audioConstraints), WTFMove(videoConstraints), WTFMove(promise), ec);
-    if (ec)
-        return Exception { ec };
-    return { };
</del><ins>+    auto* document = this-&gt;document();
+    if (!document)
+        return Exception { INVALID_STATE_ERR };
+    return UserMediaRequest::start(*document, WTFMove(audioConstraints), WTFMove(videoConstraints), WTFMove(promise));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr&lt;void&gt; MediaDevices::enumerateDevices(EnumerateDevicesPromise&amp;&amp; promise) const
</del><ins>+void MediaDevices::enumerateDevices(EnumerateDevicesPromise&amp;&amp; promise) const
</ins><span class="cx"> {
</span><del>-    ExceptionCode ec = 0;
-    auto request = MediaDevicesRequest::create(document(), WTFMove(promise), ec);
-    if (ec)
-        return Exception { ec };
-    if (request)
-        request-&gt;start();
-    return { };
</del><ins>+    auto* document = this-&gt;document();
+    if (!document)
+        return;
+    MediaDevicesRequest::create(*document, WTFMove(promise))-&gt;start();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;MediaTrackSupportedConstraints&gt; MediaDevices::getSupportedConstraints()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaDevicesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.h (208662 => 208663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.h        2016-11-13 03:24:27 UTC (rev 208662)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.h        2016-11-13 04:52:31 UTC (rev 208663)
</span><span class="lines">@@ -32,15 +32,11 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><del>-#include &quot;ContextDestructionObserver.h&quot;
</del><span class="cx"> #include &quot;JSDOMPromise.h&quot;
</span><span class="cx"> #include &quot;MediaDeviceInfo.h&quot;
</span><del>-#include &quot;ScriptWrappable.h&quot;
-#include &lt;functional&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class Dictionary;
</del><span class="cx"> class Document;
</span><span class="cx"> class MediaConstraintsImpl;
</span><span class="cx"> class MediaStream;
</span><span class="lines">@@ -48,20 +44,19 @@
</span><span class="cx"> 
</span><span class="cx"> class MediaDevices : public ScriptWrappable, public RefCounted&lt;MediaDevices&gt;, public ContextDestructionObserver {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;MediaDevices&gt; create(ScriptExecutionContext*);
-    virtual ~MediaDevices();
</del><ins>+    static Ref&lt;MediaDevices&gt; create(Document&amp;);
</ins><span class="cx"> 
</span><span class="cx">     Document* document() const;
</span><span class="cx"> 
</span><del>-    typedef DOMPromise&lt;MediaStream&gt; Promise;
-    typedef DOMPromise&lt;MediaDeviceInfoVector&gt; EnumerateDevicesPromise;
</del><ins>+    using Promise = DOMPromise&lt;MediaStream&gt;;
+    using EnumerateDevicesPromise = DOMPromise&lt;MediaDeviceInfoVector&gt;;
</ins><span class="cx"> 
</span><span class="cx">     ExceptionOr&lt;void&gt; getUserMedia(Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, Promise&amp;&amp;) const;
</span><del>-    ExceptionOr&lt;void&gt; enumerateDevices(EnumerateDevicesPromise&amp;&amp;) const;
</del><ins>+    void enumerateDevices(EnumerateDevicesPromise&amp;&amp;) const;
</ins><span class="cx">     RefPtr&lt;MediaTrackSupportedConstraints&gt; getSupportedConstraints();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    explicit MediaDevices(ScriptExecutionContext*);
</del><ins>+    explicit MediaDevices(Document&amp;);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaDevicesidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl (208662 => 208663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl        2016-11-13 03:24:27 UTC (rev 208662)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl        2016-11-13 04:52:31 UTC (rev 208663)
</span><span class="lines">@@ -35,5 +35,5 @@
</span><span class="cx">     MediaTrackSupportedConstraints getSupportedConstraints();
</span><span class="cx"> 
</span><span class="cx">     [Custom, MayThrowException, PrivateIdentifier, PublicIdentifier] Promise&lt;MediaStream&gt; getUserMedia(Dictionary options);
</span><del>-    [MayThrowException] Promise&lt;sequence&lt;MediaDeviceInfo&gt;&gt; enumerateDevices();
</del><ins>+    Promise&lt;sequence&lt;MediaDeviceInfo&gt;&gt; enumerateDevices();
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaDevicesRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp (208662 => 208663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp        2016-11-13 03:24:27 UTC (rev 208662)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.cpp        2016-11-13 04:52:31 UTC (rev 208663)
</span><span class="lines">@@ -42,15 +42,15 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-RefPtr&lt;MediaDevicesRequest&gt; MediaDevicesRequest::create(Document* document, MediaDevices::EnumerateDevicesPromise&amp;&amp; promise, ExceptionCode&amp;)
</del><ins>+inline MediaDevicesRequest::MediaDevicesRequest(Document&amp; document, MediaDevices::EnumerateDevicesPromise&amp;&amp; promise)
+    : ContextDestructionObserver(&amp;document)
+    , m_promise(WTFMove(promise))
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new MediaDevicesRequest(document, WTFMove(promise)));
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaDevicesRequest::MediaDevicesRequest(ScriptExecutionContext* context, MediaDevices::EnumerateDevicesPromise&amp;&amp; promise)
-    : ContextDestructionObserver(context)
-    , m_promise(WTFMove(promise))
</del><ins>+Ref&lt;MediaDevicesRequest&gt; MediaDevicesRequest::create(Document&amp; document, MediaDevices::EnumerateDevicesPromise&amp;&amp; promise)
</ins><span class="cx"> {
</span><ins>+    return adoptRef(*new MediaDevicesRequest(document, WTFMove(promise)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaDevicesRequest::~MediaDevicesRequest()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaDevicesRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.h (208662 => 208663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.h        2016-11-13 03:24:27 UTC (rev 208662)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevicesRequest.h        2016-11-13 04:52:31 UTC (rev 208663)
</span><span class="lines">@@ -28,10 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><del>-#include &quot;ActiveDOMObject.h&quot;
</del><span class="cx"> #include &quot;MediaDevices.h&quot;
</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">@@ -39,11 +36,9 @@
</span><span class="cx"> class MediaDevicesEnumerationRequest;
</span><span class="cx"> class SecurityOrigin;
</span><span class="cx"> 
</span><del>-typedef int ExceptionCode;
-
</del><span class="cx"> class MediaDevicesRequest : public RefCounted&lt;MediaDevicesRequest&gt;, private ContextDestructionObserver {
</span><span class="cx"> public:
</span><del>-    static RefPtr&lt;MediaDevicesRequest&gt; create(Document*, MediaDevices::EnumerateDevicesPromise&amp;&amp;, ExceptionCode&amp;);
</del><ins>+    static Ref&lt;MediaDevicesRequest&gt; create(Document&amp;, MediaDevices::EnumerateDevicesPromise&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     virtual ~MediaDevicesRequest();
</span><span class="cx"> 
</span><span class="lines">@@ -52,9 +47,8 @@
</span><span class="cx">     SecurityOrigin* securityOrigin() const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    MediaDevicesRequest(ScriptExecutionContext*, MediaDevices::EnumerateDevicesPromise&amp;&amp;);
</del><ins>+    MediaDevicesRequest(Document&amp;, MediaDevices::EnumerateDevicesPromise&amp;&amp;);
</ins><span class="cx"> 
</span><del>-    // ContextDestructionObserver
</del><span class="cx">     void contextDestroyed() final;
</span><span class="cx"> 
</span><span class="cx">     String hashID(const String&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamNavigatorMediaDevicescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorMediaDevices.cpp (208662 => 208663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/NavigatorMediaDevices.cpp        2016-11-13 03:24:27 UTC (rev 208662)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorMediaDevices.cpp        2016-11-13 04:52:31 UTC (rev 208663)
</span><span class="lines">@@ -29,9 +29,9 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><ins>+#include &quot;NavigatorMediaDevices.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><del>-#include &quot;NavigatorMediaDevices.h&quot;
</del><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> MediaDevices* NavigatorMediaDevices::mediaDevices() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_mediaDevices &amp;&amp; frame())
</span><del>-        m_mediaDevices = MediaDevices::create(frame()-&gt;document());
</del><ins>+        m_mediaDevices = MediaDevices::create(*frame()-&gt;document());
</ins><span class="cx">     return m_mediaDevices.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamUserMediaRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp (208662 => 208663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp        2016-11-13 03:24:27 UTC (rev 208662)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp        2016-11-13 04:52:31 UTC (rev 208663)
</span><span class="lines">@@ -32,12 +32,10 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><ins>+#include &quot;UserMediaRequest.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><del>-#include &quot;UserMediaRequest.h&quot;
-
-#include &quot;Document.h&quot;
</del><span class="cx"> #include &quot;DocumentLoader.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="lines">@@ -55,28 +53,26 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void UserMediaRequest::start(Document* document, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, MediaDevices::Promise&amp;&amp; promise, ExceptionCode&amp; ec)
</del><ins>+ExceptionOr&lt;void&gt; UserMediaRequest::start(Document&amp; document, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, MediaDevices::Promise&amp;&amp; promise)
</ins><span class="cx"> {
</span><del>-    UserMediaController* userMedia = UserMediaController::from(document ? document-&gt;page() : nullptr);
-    if (!userMedia) {
-        ec = NOT_SUPPORTED_ERR;
-        return;
-    }
</del><ins>+    auto* userMedia = UserMediaController::from(document.page());
+    if (!userMedia)
+        return Exception { NOT_SUPPORTED_ERR }; // FIXME: Why is it better to return an exception here instead of rejecting the promise as we do just below?
</ins><span class="cx"> 
</span><span class="cx">     if (!audioConstraints-&gt;isValid() &amp;&amp; !videoConstraints-&gt;isValid()) {
</span><span class="cx">         promise.reject(TypeError);
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto request = adoptRef(*new UserMediaRequest(document, userMedia, WTFMove(audioConstraints), WTFMove(videoConstraints), WTFMove(promise)));
-    request-&gt;start();
</del><ins>+    adoptRef(*new UserMediaRequest(document, *userMedia, WTFMove(audioConstraints), WTFMove(videoConstraints), WTFMove(promise)))-&gt;start();
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaController* controller, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, MediaDevices::Promise&amp;&amp; promise)
-    : ContextDestructionObserver(context)
</del><ins>+UserMediaRequest::UserMediaRequest(Document&amp; document, UserMediaController&amp; controller, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, MediaDevices::Promise&amp;&amp; promise)
+    : ContextDestructionObserver(&amp;document)
</ins><span class="cx">     , m_audioConstraints(WTFMove(audioConstraints))
</span><span class="cx">     , m_videoConstraints(WTFMove(videoConstraints))
</span><del>-    , m_controller(controller)
</del><ins>+    , m_controller(&amp;controller)
</ins><span class="cx">     , m_promise(WTFMove(promise))
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamUserMediaRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h (208662 => 208663)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h        2016-11-13 03:24:27 UTC (rev 208662)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h        2016-11-13 04:52:31 UTC (rev 208663)
</span><span class="lines">@@ -38,8 +38,6 @@
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;MediaConstraintsImpl.h&quot;
</span><span class="cx"> #include &quot;MediaDevices.h&quot;
</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">@@ -48,13 +46,11 @@
</span><span class="cx"> class UserMediaController;
</span><span class="cx"> class SecurityOrigin;
</span><span class="cx"> 
</span><del>-typedef int ExceptionCode;
-
</del><span class="cx"> class UserMediaRequest : public RefCounted&lt;UserMediaRequest&gt;, private ContextDestructionObserver {
</span><span class="cx"> public:
</span><del>-    static void start(Document*, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, MediaDevices::Promise&amp;&amp;, ExceptionCode&amp;);
</del><ins>+    static ExceptionOr&lt;void&gt; start(Document&amp;, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, MediaDevices::Promise&amp;&amp;);
</ins><span class="cx"> 
</span><del>-    ~UserMediaRequest();
</del><ins>+    virtual ~UserMediaRequest();
</ins><span class="cx"> 
</span><span class="cx">     void start();
</span><span class="cx"> 
</span><span class="lines">@@ -78,9 +74,8 @@
</span><span class="cx">     Document* document() const { return downcast&lt;Document&gt;(scriptExecutionContext()); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    UserMediaRequest(ScriptExecutionContext*, UserMediaController*, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, MediaDevices::Promise&amp;&amp;);
</del><ins>+    UserMediaRequest(Document&amp;, UserMediaController&amp;, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, MediaDevices::Promise&amp;&amp;);
</ins><span class="cx"> 
</span><del>-    // ContextDestructionObserver
</del><span class="cx">     void contextDestroyed() final;
</span><span class="cx">     
</span><span class="cx">     Ref&lt;MediaConstraintsImpl&gt; m_audioConstraints;
</span></span></pre>
</div>
</div>

</body>
</html>