<!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&.
(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&.
Removed unused ExceptionCode& 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& and
a UserMediaController&.
* 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 <darin@apple.com>
+
+ 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&.
+ (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&.
+ Removed unused ExceptionCode& 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& and
+ a UserMediaController&.
+ * Modules/mediastream/UserMediaRequest.h: Updated for above changes.
+
</ins><span class="cx"> 2016-11-12 Simon Fraser <simon.fraser@apple.com>
</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 "Dictionary.h"
</del><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "MediaDevicesRequest.h"
</span><del>-#include "MediaStream.h"
</del><span class="cx"> #include "MediaTrackSupportedConstraints.h"
</span><span class="cx"> #include "RealtimeMediaSourceCenter.h"
</span><del>-#include "UserMediaController.h"
</del><span class="cx"> #include "UserMediaRequest.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-Ref<MediaDevices> MediaDevices::create(ScriptExecutionContext* context)
</del><ins>+inline MediaDevices::MediaDevices(Document& document)
+ : ContextDestructionObserver(&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<MediaDevices> MediaDevices::create(Document& 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<Document>(scriptExecutionContext());
</span><span class="lines">@@ -65,22 +58,18 @@
</span><span class="cx">
</span><span class="cx"> ExceptionOr<void> MediaDevices::getUserMedia(Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, Promise&& 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->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<void> MediaDevices::enumerateDevices(EnumerateDevicesPromise&& promise) const
</del><ins>+void MediaDevices::enumerateDevices(EnumerateDevicesPromise&& 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->start();
- return { };
</del><ins>+ auto* document = this->document();
+ if (!document)
+ return;
+ MediaDevicesRequest::create(*document, WTFMove(promise))->start();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<MediaTrackSupportedConstraints> 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 "ContextDestructionObserver.h"
</del><span class="cx"> #include "JSDOMPromise.h"
</span><span class="cx"> #include "MediaDeviceInfo.h"
</span><del>-#include "ScriptWrappable.h"
-#include <functional>
</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<MediaDevices>, public ContextDestructionObserver {
</span><span class="cx"> public:
</span><del>- static Ref<MediaDevices> create(ScriptExecutionContext*);
- virtual ~MediaDevices();
</del><ins>+ static Ref<MediaDevices> create(Document&);
</ins><span class="cx">
</span><span class="cx"> Document* document() const;
</span><span class="cx">
</span><del>- typedef DOMPromise<MediaStream> Promise;
- typedef DOMPromise<MediaDeviceInfoVector> EnumerateDevicesPromise;
</del><ins>+ using Promise = DOMPromise<MediaStream>;
+ using EnumerateDevicesPromise = DOMPromise<MediaDeviceInfoVector>;
</ins><span class="cx">
</span><span class="cx"> ExceptionOr<void> getUserMedia(Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, Promise&&) const;
</span><del>- ExceptionOr<void> enumerateDevices(EnumerateDevicesPromise&&) const;
</del><ins>+ void enumerateDevices(EnumerateDevicesPromise&&) const;
</ins><span class="cx"> RefPtr<MediaTrackSupportedConstraints> getSupportedConstraints();
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- explicit MediaDevices(ScriptExecutionContext*);
</del><ins>+ explicit MediaDevices(Document&);
</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<MediaStream> getUserMedia(Dictionary options);
</span><del>- [MayThrowException] Promise<sequence<MediaDeviceInfo>> enumerateDevices();
</del><ins>+ Promise<sequence<MediaDeviceInfo>> 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<MediaDevicesRequest> MediaDevicesRequest::create(Document* document, MediaDevices::EnumerateDevicesPromise&& promise, ExceptionCode&)
</del><ins>+inline MediaDevicesRequest::MediaDevicesRequest(Document& document, MediaDevices::EnumerateDevicesPromise&& promise)
+ : ContextDestructionObserver(&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&& promise)
- : ContextDestructionObserver(context)
- , m_promise(WTFMove(promise))
</del><ins>+Ref<MediaDevicesRequest> MediaDevicesRequest::create(Document& document, MediaDevices::EnumerateDevicesPromise&& 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 "ActiveDOMObject.h"
</del><span class="cx"> #include "MediaDevices.h"
</span><del>-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
</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<MediaDevicesRequest>, private ContextDestructionObserver {
</span><span class="cx"> public:
</span><del>- static RefPtr<MediaDevicesRequest> create(Document*, MediaDevices::EnumerateDevicesPromise&&, ExceptionCode&);
</del><ins>+ static Ref<MediaDevicesRequest> create(Document&, MediaDevices::EnumerateDevicesPromise&&);
</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&&);
</del><ins>+ MediaDevicesRequest(Document&, MediaDevices::EnumerateDevicesPromise&&);
</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&);
</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 "config.h"
</span><ins>+#include "NavigatorMediaDevices.h"
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><del>-#include "NavigatorMediaDevices.h"
</del><span class="cx">
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "Frame.h"
</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 && frame())
</span><del>- m_mediaDevices = MediaDevices::create(frame()->document());
</del><ins>+ m_mediaDevices = MediaDevices::create(*frame()->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 "config.h"
</span><ins>+#include "UserMediaRequest.h"
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx">
</span><del>-#include "UserMediaRequest.h"
-
-#include "Document.h"
</del><span class="cx"> #include "DocumentLoader.h"
</span><span class="cx"> #include "ExceptionCode.h"
</span><span class="cx"> #include "Frame.h"
</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<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&& promise, ExceptionCode& ec)
</del><ins>+ExceptionOr<void> UserMediaRequest::start(Document& document, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&& promise)
</ins><span class="cx"> {
</span><del>- UserMediaController* userMedia = UserMediaController::from(document ? document->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->isValid() && !videoConstraints->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->start();
</del><ins>+ adoptRef(*new UserMediaRequest(document, *userMedia, WTFMove(audioConstraints), WTFMove(videoConstraints), WTFMove(promise)))->start();
+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaController* controller, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&& promise)
- : ContextDestructionObserver(context)
</del><ins>+UserMediaRequest::UserMediaRequest(Document& document, UserMediaController& controller, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&& promise)
+ : ContextDestructionObserver(&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(&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 "Document.h"
</span><span class="cx"> #include "MediaConstraintsImpl.h"
</span><span class="cx"> #include "MediaDevices.h"
</span><del>-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
</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<UserMediaRequest>, private ContextDestructionObserver {
</span><span class="cx"> public:
</span><del>- static void start(Document*, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&&, ExceptionCode&);
</del><ins>+ static ExceptionOr<void> start(Document&, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&&);
</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<Document>(scriptExecutionContext()); }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- UserMediaRequest(ScriptExecutionContext*, UserMediaController*, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&&);
</del><ins>+ UserMediaRequest(Document&, UserMediaController&, Ref<MediaConstraintsImpl>&& audioConstraints, Ref<MediaConstraintsImpl>&& videoConstraints, MediaDevices::Promise&&);
</ins><span class="cx">
</span><del>- // ContextDestructionObserver
</del><span class="cx"> void contextDestroyed() final;
</span><span class="cx">
</span><span class="cx"> Ref<MediaConstraintsImpl> m_audioConstraints;
</span></span></pre>
</div>
</div>
</body>
</html>