<!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>[209864] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209864">209864</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-12-15 09:25:53 -0800 (Thu, 15 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove custom binding for MediaDevices
https://bugs.webkit.org/show_bug.cgi?id=165894

Reviewed by Eric Carlson.

Source/WebCore:

Removes the explicit code to parse the MediaStreamConstraints and
MediaTrackConstraints. Next step could be to change the internal
code to use the structs from bindings directly so we don't need
code to convert to an internal format.

* CMakeLists.txt: Added MediaTrackConstraints.idl and MediaTrackConstraints.cpp,
removed JSMediaDevicesCustom.cpp.

* DerivedSources.make: Added MediaTrackConstraints.idl.
Also sorted list of IDL files and fixed use of tabs.

* Modules/mediastream/MediaDevices.cpp:
(WebCore::createMediaConstraintsImpl): Added.
(WebCore::MediaDevices::getUserMedia): Changed this function to take arguments that
are generated by the bindings script, and call createMediaConstraintsImpl to convert
into the internal data structure.
* Modules/mediastream/MediaDevices.h: Added StreamConstraints struct and changed
getUserMedia to take that as specified in the IDL.
* Modules/mediastream/MediaDevices.idl: Added definition of the MediaStreamConstraints
dictionary. Removed [Custom] from getUserMedia.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::MediaStream): Pass a reference to addObserver.
(WebCore::MediaStream::~MediaStream): Pass a rference to removeObserver.
(WebCore::MediaStream::internalAddTrack): Ditto.
(WebCore::MediaStream::internalRemoveTrack): Ditto.

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::createMediaConstraintsImpl): Added.
(WebCore::MediaStreamTrack::applyConstraints): Changed to take an optional
MediaTrackConstraints argument and call createMediaConstraintsImpl to convert
into the internal data structure. Also merged the multiple overloads of this
all into a single function, used auto to make the code easier to read, and
moved the code that stores new constrains into the success handling, since the
specification says that's the only case where we should store it.
(WebCore::MediaStreamTrack::addObserver): Take a reference instead of a pointer.
(WebCore::MediaStreamTrack::removeObserver): Ditto.
* Modules/mediastream/MediaStreamTrack.h: Removed many unneeded includes.
Changed getConstraints to return const MediaTrackConstraints&amp;, applyConstraints
to take an optional MediaTrackConstraints, add/removeObserver to take a reference
rather than a pointer, and changed m_constraints to be a MediaTrackConstraints
instead of a RefPtr&lt;MediaConstraints&gt;.
* Modules/mediastream/MediaStreamTrack.idl: Removed [Custom] from getConstraints
and applyConstraints.

* Modules/mediastream/MediaTrackConstraints.cpp: Added.
(WebCore::set): Overloaded function to set constriaints in a
MediaTrackConstraintSetMap.
(WebCore::convertToInternalForm): Helper function that takes a
MediaTrackConstraintSet and turns it into a MediaTrackConstraintSetMap.
(WebCore::convertAdvancedToInternalForm): More of the same, but for vectors.
(WebCore::createMediaConstraintsImpl): Top level function. Calls the other
functions and then MediaConstraintsImpl::create.
* Modules/mediastream/MediaTrackConstraints.h: Added. Contains all the structures
and type definitions for the dictionaries defined in the IDL file, and also the
createMediaConstraintsImpl function declaration.
* Modules/mediastream/MediaTrackConstraints.idl: Added. Contains the
MediaTrackConstraints and all the other dictionaries and typedefs that are needed
to define that dictionary.
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::start): Changed to not depend on MediaDevices::Promise.
(WebCore::UserMediaRequest::UserMediaRequest): Ditto.
(WebCore::isSecure): Rearranged to be easier to understand.
(WebCore::UserMediaRequest::start): Removed a local variable for simplicity.
(WebCore::UserMediaRequest::document): Removed a redundant null check.
* Modules/mediastream/UserMediaRequest.h: Reduced includes, changed to not depend
on MediaDevices::Promise, removing the reason to include MediaDevices.h.

* WebCore.xcodeproj/project.pbxproj: Updated to remove old files and add new ones.

* bindings/js/JSBindingsAllInOne.cpp: Removed JSMediaDevicesCustom.cpp.

* bindings/js/JSMediaDevicesCustom.cpp: Removed.
* bindings/js/JSMediaDevicesCustom.h: Removed.

* bindings/js/JSMediaStreamTrackCustom.cpp:
(WebCore::JSMediaStreamTrack::applyConstraints): Deleted.
(WebCore::JSMediaStreamTrack::getConstraints): Deleted.

* bindings/scripts/CodeGenerator.pm:
(ProcessDocument): Updated to allow multiple standalone dictionaries, as long as
the name of one of the dictionaries matches the name of the file.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionary): Added &quot;other dictionaries&quot; argument so we can support
files with multiple dictionaries in them.
(GenerateDictionariesHeaderContent): Completed support for dictionaries that
are not named after a top level interface by added one more check for a missing
$interface in a place that otherwise would not handle it correctly.
(GenerateImplementation): Removed code that set $currentCachedAttribute and
$cacheIndex, since no was reading the value of either any longer.
(GenerateDictionaryHeader): Added &quot;other dictionaries&quot;.
(GenerateDictionaryImplementation): Ditto.
(WriteData): Removed unnnecessarily indirect code that was using FileNamePrefix
and a local variable named $prefix instead of just writing &quot;JS&quot;.

* bindings/scripts/generate-bindings.pl: Corrected the use of the fileparse
function from the Path::Basename module; after reading the documentation for
this it is clear that there is no need to first call basename, and fileparse
should also be used instead of basename.

* platform/mediastream/MediaConstraints.h: Removed unneeded includes.
(WebCore::StringConstraint::appendExact): Removed an incorrect use of clear
here that would mess up cases where there is supposed to be more than one
exact value.

* platform/mediastream/MediaStreamTrackPrivate.cpp: Remvoed unneeded includes.
(WebCore::MediaStreamTrackPrivate::clone): Removed code to copy m_constraints.
(WebCore::MediaStreamTrackPrivate::constraints): Deleted.
* platform/mediastream/MediaStreamTrackPrivate.h: Removed the constraints
function member and the m_constraints data member.

Source/WebKit2:

* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
Added include of MediaConstraintsImpl.h, now needed because we
removed some unneeded includes from the WebCore headers.

LayoutTests:

* fast/mediastream/MediaDevices-getUserMedia-expected.txt: Expect the exception the
generated bindings code throws, rather than the different one the hand-written binding
was throwing before.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastmediastreamMediaDevicesgetUserMediaexpectedtxt">trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</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="#trunkSourceWebCoreModulesmediastreamMediaStreamcpp">trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamTrackcpp">trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamTrackh">trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaStreamTrackidl">trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl</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>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp">trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMediaStreamTrackCustomcpp">trunk/Source/WebCore/bindings/js/JSMediaStreamTrackCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsgeneratebindingspl">trunk/Source/WebCore/bindings/scripts/generate-bindings.pl</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaConstraintsh">trunk/Source/WebCore/platform/mediastream/MediaConstraints.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivatecpp">trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivateh">trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessMediaStreamUserMediaPermissionRequestManagercpp">trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaTrackConstraintscpp">trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaTrackConstraintsh">trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamMediaTrackConstraintsidl">trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.idl</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsJSMediaDevicesCustomcpp">trunk/Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMediaDevicesCustomh">trunk/Source/WebCore/bindings/js/JSMediaDevicesCustom.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/LayoutTests/ChangeLog        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-12-15  Darin Adler  &lt;darin@apple.com&gt;
+
+        Remove custom binding for MediaDevices
+        https://bugs.webkit.org/show_bug.cgi?id=165894
+
+        Reviewed by Eric Carlson.
+
+        * fast/mediastream/MediaDevices-getUserMedia-expected.txt: Expect the exception the
+        generated bindings code throws, rather than the different one the hand-written binding
+        was throwing before.
+
</ins><span class="cx"> 2016-12-15  Youenn Fablet  &lt;youennf@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Sync web-platform-tests up to revision a4c2b37
</span></span></pre></div>
<a id="trunkLayoutTestsfastmediastreamMediaDevicesgetUserMediaexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> 
</span><span class="cx"> PASS typeof navigator.mediaDevices.webkitGetUserMedia is 'undefined'
</span><span class="cx"> PASS navigator.mediaDevices.getUserMedia({audio:true}).then(gotStream1); did not throw exception.
</span><del>-PASS navigator.mediaDevices.getUserMedia() rejected with error: TypeError: Not enough arguments
</del><ins>+PASS navigator.mediaDevices.getUserMedia() rejected with error: TypeError: Type error
</ins><span class="cx"> PASS navigator.mediaDevices.getUserMedia({}) rejected with error: TypeError: Type error
</span><span class="cx"> PASS navigator.mediaDevices.getUserMedia.apply(undefined) rejected with error: TypeError: Can only call MediaDevices.getUserMedia on instances of MediaDevices
</span><span class="cx"> PASS Stream generated.
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -219,6 +219,7 @@
</span><span class="cx">     Modules/mediastream/MediaStreamEvent.idl
</span><span class="cx">     Modules/mediastream/MediaStreamTrack.idl
</span><span class="cx">     Modules/mediastream/MediaStreamTrackEvent.idl
</span><ins>+    Modules/mediastream/MediaTrackConstraints.idl
</ins><span class="cx">     Modules/mediastream/MediaTrackSupportedConstraints.idl
</span><span class="cx">     Modules/mediastream/NavigatorMediaDevices.idl
</span><span class="cx">     Modules/mediastream/NavigatorUserMedia.idl
</span><span class="lines">@@ -907,6 +908,7 @@
</span><span class="cx">     Modules/mediastream/MediaStreamRegistry.cpp
</span><span class="cx">     Modules/mediastream/MediaStreamTrack.cpp
</span><span class="cx">     Modules/mediastream/MediaStreamTrackEvent.cpp
</span><ins>+    Modules/mediastream/MediaTrackConstraints.cpp
</ins><span class="cx">     Modules/mediastream/NavigatorMediaDevices.cpp
</span><span class="cx">     Modules/mediastream/PeerConnectionBackend.cpp
</span><span class="cx">     Modules/mediastream/RTCDTMFSender.cpp
</span><span class="lines">@@ -1162,7 +1164,6 @@
</span><span class="cx">     bindings/js/JSLazyEventListener.cpp
</span><span class="cx">     bindings/js/JSLocationCustom.cpp
</span><span class="cx">     bindings/js/JSMainThreadExecState.cpp
</span><del>-    bindings/js/JSMediaDevicesCustom.cpp
</del><span class="cx">     bindings/js/JSMediaKeySessionCustom.cpp
</span><span class="cx">     bindings/js/JSMediaKeySystemAccessCustom.cpp
</span><span class="cx">     bindings/js/JSMediaStreamTrackCustom.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/ChangeLog        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -1,3 +1,122 @@
</span><ins>+2016-12-15  Darin Adler  &lt;darin@apple.com&gt;
+
+        Remove custom binding for MediaDevices
+        https://bugs.webkit.org/show_bug.cgi?id=165894
+
+        Reviewed by Eric Carlson.
+
+        Removes the explicit code to parse the MediaStreamConstraints and
+        MediaTrackConstraints. Next step could be to change the internal
+        code to use the structs from bindings directly so we don't need
+        code to convert to an internal format.
+
+        * CMakeLists.txt: Added MediaTrackConstraints.idl and MediaTrackConstraints.cpp,
+        removed JSMediaDevicesCustom.cpp.
+
+        * DerivedSources.make: Added MediaTrackConstraints.idl.
+        Also sorted list of IDL files and fixed use of tabs.
+
+        * Modules/mediastream/MediaDevices.cpp:
+        (WebCore::createMediaConstraintsImpl): Added.
+        (WebCore::MediaDevices::getUserMedia): Changed this function to take arguments that
+        are generated by the bindings script, and call createMediaConstraintsImpl to convert
+        into the internal data structure.
+        * Modules/mediastream/MediaDevices.h: Added StreamConstraints struct and changed
+        getUserMedia to take that as specified in the IDL.
+        * Modules/mediastream/MediaDevices.idl: Added definition of the MediaStreamConstraints
+        dictionary. Removed [Custom] from getUserMedia.
+
+        * Modules/mediastream/MediaStream.cpp:
+        (WebCore::MediaStream::MediaStream): Pass a reference to addObserver.
+        (WebCore::MediaStream::~MediaStream): Pass a rference to removeObserver.
+        (WebCore::MediaStream::internalAddTrack): Ditto.
+        (WebCore::MediaStream::internalRemoveTrack): Ditto.
+
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::createMediaConstraintsImpl): Added.
+        (WebCore::MediaStreamTrack::applyConstraints): Changed to take an optional
+        MediaTrackConstraints argument and call createMediaConstraintsImpl to convert
+        into the internal data structure. Also merged the multiple overloads of this
+        all into a single function, used auto to make the code easier to read, and
+        moved the code that stores new constrains into the success handling, since the
+        specification says that's the only case where we should store it.
+        (WebCore::MediaStreamTrack::addObserver): Take a reference instead of a pointer.
+        (WebCore::MediaStreamTrack::removeObserver): Ditto.
+        * Modules/mediastream/MediaStreamTrack.h: Removed many unneeded includes.
+        Changed getConstraints to return const MediaTrackConstraints&amp;, applyConstraints
+        to take an optional MediaTrackConstraints, add/removeObserver to take a reference
+        rather than a pointer, and changed m_constraints to be a MediaTrackConstraints
+        instead of a RefPtr&lt;MediaConstraints&gt;.
+        * Modules/mediastream/MediaStreamTrack.idl: Removed [Custom] from getConstraints
+        and applyConstraints.
+
+        * Modules/mediastream/MediaTrackConstraints.cpp: Added.
+        (WebCore::set): Overloaded function to set constriaints in a
+        MediaTrackConstraintSetMap.
+        (WebCore::convertToInternalForm): Helper function that takes a
+        MediaTrackConstraintSet and turns it into a MediaTrackConstraintSetMap.
+        (WebCore::convertAdvancedToInternalForm): More of the same, but for vectors.
+        (WebCore::createMediaConstraintsImpl): Top level function. Calls the other
+        functions and then MediaConstraintsImpl::create.
+        * Modules/mediastream/MediaTrackConstraints.h: Added. Contains all the structures
+        and type definitions for the dictionaries defined in the IDL file, and also the
+        createMediaConstraintsImpl function declaration.
+        * Modules/mediastream/MediaTrackConstraints.idl: Added. Contains the
+        MediaTrackConstraints and all the other dictionaries and typedefs that are needed
+        to define that dictionary.
+        * Modules/mediastream/UserMediaRequest.cpp:
+        (WebCore::UserMediaRequest::start): Changed to not depend on MediaDevices::Promise.
+        (WebCore::UserMediaRequest::UserMediaRequest): Ditto.
+        (WebCore::isSecure): Rearranged to be easier to understand.
+        (WebCore::UserMediaRequest::start): Removed a local variable for simplicity.
+        (WebCore::UserMediaRequest::document): Removed a redundant null check.
+        * Modules/mediastream/UserMediaRequest.h: Reduced includes, changed to not depend
+        on MediaDevices::Promise, removing the reason to include MediaDevices.h.
+
+        * WebCore.xcodeproj/project.pbxproj: Updated to remove old files and add new ones.
+
+        * bindings/js/JSBindingsAllInOne.cpp: Removed JSMediaDevicesCustom.cpp.
+
+        * bindings/js/JSMediaDevicesCustom.cpp: Removed.
+        * bindings/js/JSMediaDevicesCustom.h: Removed.
+
+        * bindings/js/JSMediaStreamTrackCustom.cpp:
+        (WebCore::JSMediaStreamTrack::applyConstraints): Deleted.
+        (WebCore::JSMediaStreamTrack::getConstraints): Deleted.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (ProcessDocument): Updated to allow multiple standalone dictionaries, as long as
+        the name of one of the dictionaries matches the name of the file.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateDictionary): Added &quot;other dictionaries&quot; argument so we can support
+        files with multiple dictionaries in them.
+        (GenerateDictionariesHeaderContent): Completed support for dictionaries that
+        are not named after a top level interface by added one more check for a missing
+        $interface in a place that otherwise would not handle it correctly.
+        (GenerateImplementation): Removed code that set $currentCachedAttribute and
+        $cacheIndex, since no was reading the value of either any longer.
+        (GenerateDictionaryHeader): Added &quot;other dictionaries&quot;.
+        (GenerateDictionaryImplementation): Ditto.
+        (WriteData): Removed unnnecessarily indirect code that was using FileNamePrefix
+        and a local variable named $prefix instead of just writing &quot;JS&quot;.
+
+        * bindings/scripts/generate-bindings.pl: Corrected the use of the fileparse
+        function from the Path::Basename module; after reading the documentation for
+        this it is clear that there is no need to first call basename, and fileparse
+        should also be used instead of basename.
+
+        * platform/mediastream/MediaConstraints.h: Removed unneeded includes.
+        (WebCore::StringConstraint::appendExact): Removed an incorrect use of clear
+        here that would mess up cases where there is supposed to be more than one
+        exact value.
+
+        * platform/mediastream/MediaStreamTrackPrivate.cpp: Remvoed unneeded includes.
+        (WebCore::MediaStreamTrackPrivate::clone): Removed code to copy m_constraints.
+        (WebCore::MediaStreamTrackPrivate::constraints): Deleted.
+        * platform/mediastream/MediaStreamTrackPrivate.h: Removed the constraints
+        function member and the m_constraints data member.
+
</ins><span class="cx"> 2016-12-15  Dave Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Parser] Enable CSS Deferred Parsing
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/DerivedSources.make        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -152,6 +152,7 @@
</span><span class="cx">     $(WebCore)/Modules/mediastream/MediaStreamEvent.idl \
</span><span class="cx">     $(WebCore)/Modules/mediastream/MediaStreamTrack.idl \
</span><span class="cx">     $(WebCore)/Modules/mediastream/MediaStreamTrackEvent.idl \
</span><ins>+    $(WebCore)/Modules/mediastream/MediaTrackConstraints.idl \
</ins><span class="cx">     $(WebCore)/Modules/mediastream/MediaTrackSupportedConstraints.idl \
</span><span class="cx">     $(WebCore)/Modules/mediastream/NavigatorMediaDevices.idl \
</span><span class="cx">     $(WebCore)/Modules/mediastream/NavigatorUserMedia.idl \
</span><span class="lines">@@ -254,6 +255,9 @@
</span><span class="cx">     $(WebCore)/crypto/CryptoKeyPair.idl \
</span><span class="cx">     $(WebCore)/crypto/CryptoKeyUsage.idl \
</span><span class="cx">     $(WebCore)/crypto/JsonWebKey.idl \
</span><ins>+    $(WebCore)/crypto/RsaOtherPrimesInfo.idl \
+    $(WebCore)/crypto/SubtleCrypto.idl \
+    $(WebCore)/crypto/WebKitSubtleCrypto.idl \
</ins><span class="cx">     $(WebCore)/crypto/parameters/AesCbcParams.idl \
</span><span class="cx">     $(WebCore)/crypto/parameters/AesKeyGenParams.idl \
</span><span class="cx">     $(WebCore)/crypto/parameters/HmacKeyParams.idl \
</span><span class="lines">@@ -261,9 +265,6 @@
</span><span class="cx">     $(WebCore)/crypto/parameters/RsaHashedKeyGenParams.idl \
</span><span class="cx">     $(WebCore)/crypto/parameters/RsaKeyGenParams.idl \
</span><span class="cx">     $(WebCore)/crypto/parameters/RsaOaepParams.idl \
</span><del>-    $(WebCore)/crypto/RsaOtherPrimesInfo.idl \
-    $(WebCore)/crypto/SubtleCrypto.idl \
-    $(WebCore)/crypto/WebKitSubtleCrypto.idl \
</del><span class="cx">     $(WebCore)/css/CSSFontFaceLoadEvent.idl \
</span><span class="cx">     $(WebCore)/css/CSSFontFaceRule.idl \
</span><span class="cx">     $(WebCore)/css/CSSImportRule.idl \
</span><span class="lines">@@ -270,7 +271,7 @@
</span><span class="cx">     $(WebCore)/css/CSSKeyframeRule.idl \
</span><span class="cx">     $(WebCore)/css/CSSKeyframesRule.idl \
</span><span class="cx">     $(WebCore)/css/CSSMediaRule.idl \
</span><del>-        $(WebCore)/css/CSSNamespaceRule.idl \
</del><ins>+    $(WebCore)/css/CSSNamespaceRule.idl \
</ins><span class="cx">     $(WebCore)/css/CSSPageRule.idl \
</span><span class="cx">     $(WebCore)/css/CSSPrimitiveValue.idl \
</span><span class="cx">     $(WebCore)/css/CSSRule.idl \
</span><span class="lines">@@ -307,8 +308,8 @@
</span><span class="cx">     $(WebCore)/dom/ChildNode.idl \
</span><span class="cx">     $(WebCore)/dom/ClientRect.idl \
</span><span class="cx">     $(WebCore)/dom/ClientRectList.idl \
</span><ins>+    $(WebCore)/dom/ClipboardEvent.idl \
</ins><span class="cx">     $(WebCore)/dom/Comment.idl \
</span><del>-    $(WebCore)/dom/ClipboardEvent.idl \
</del><span class="cx">     $(WebCore)/dom/CompositionEvent.idl \
</span><span class="cx">     $(WebCore)/dom/CustomElementRegistry.idl \
</span><span class="cx">     $(WebCore)/dom/CustomEvent.idl \
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaDevicescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><ins>+#include &quot;MediaConstraintsImpl.h&quot;
</ins><span class="cx"> #include &quot;MediaDevicesRequest.h&quot;
</span><span class="cx"> #include &quot;MediaTrackSupportedConstraints.h&quot;
</span><span class="cx"> #include &quot;RealtimeMediaSourceCenter.h&quot;
</span><span class="lines">@@ -56,12 +57,24 @@
</span><span class="cx">     return downcast&lt;Document&gt;(scriptExecutionContext());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-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
</del><ins>+static Ref&lt;MediaConstraintsImpl&gt; createMediaConstraintsImpl(const Variant&lt;bool, MediaTrackConstraints&gt;&amp; constraints)
</ins><span class="cx"> {
</span><ins>+    return WTF::switchOn(constraints,
+        [&amp;] (bool constraints) {
+            return MediaConstraintsImpl::create({ }, { }, constraints);
+        },
+        [&amp;] (const MediaTrackConstraints&amp; constraints) {
+            return createMediaConstraintsImpl(constraints);
+        }
+    );
+}
+
+ExceptionOr&lt;void&gt; MediaDevices::getUserMedia(const StreamConstraints&amp; constraints, Promise&amp;&amp; promise) const
+{
</ins><span class="cx">     auto* document = this-&gt;document();
</span><span class="cx">     if (!document)
</span><span class="cx">         return Exception { INVALID_STATE_ERR };
</span><del>-    return UserMediaRequest::start(*document, WTFMove(audioConstraints), WTFMove(videoConstraints), WTFMove(promise));
</del><ins>+    return UserMediaRequest::start(*document, createMediaConstraintsImpl(constraints.audio), createMediaConstraintsImpl(constraints.video), WTFMove(promise));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaDevices::enumerateDevices(EnumerateDevicesPromise&amp;&amp; promise) const
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaDevicesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.h (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.h        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.h        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2015 Ericsson AB. All rights reserved.
</span><ins>+ * Copyright (C) 2016 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">@@ -34,12 +35,12 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ExceptionOr.h&quot;
</span><span class="cx"> #include &quot;JSDOMPromise.h&quot;
</span><del>-#include &quot;MediaDeviceInfo.h&quot;
</del><ins>+#include &quot;MediaTrackConstraints.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Document;
</span><del>-class MediaConstraintsImpl;
</del><ins>+class MediaDeviceInfo;
</ins><span class="cx"> class MediaStream;
</span><span class="cx"> class MediaTrackSupportedConstraints;
</span><span class="cx"> 
</span><span class="lines">@@ -52,7 +53,11 @@
</span><span class="cx">     using Promise = DOMPromise&lt;IDLInterface&lt;MediaStream&gt;&gt;;
</span><span class="cx">     using EnumerateDevicesPromise = DOMPromise&lt;IDLSequence&lt;IDLInterface&lt;MediaDeviceInfo&gt;&gt;&gt;;
</span><span class="cx"> 
</span><del>-    ExceptionOr&lt;void&gt; getUserMedia(Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, Promise&amp;&amp;) const;
</del><ins>+    struct StreamConstraints {
+        Variant&lt;bool, MediaTrackConstraints&gt; video;
+        Variant&lt;bool, MediaTrackConstraints&gt; audio;
+    };
+    ExceptionOr&lt;void&gt; getUserMedia(const StreamConstraints&amp;, Promise&amp;&amp;) const;
</ins><span class="cx">     void enumerateDevices(EnumerateDevicesPromise&amp;&amp;) const;
</span><span class="cx">     RefPtr&lt;MediaTrackSupportedConstraints&gt; getSupportedConstraints();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaDevicesidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -29,11 +29,16 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> [
</span><ins>+    Conditional=MEDIA_STREAM,
</ins><span class="cx">     NoInterfaceObject,
</span><del>-    Conditional=MEDIA_STREAM
</del><span class="cx"> ] interface MediaDevices {
</span><span class="cx">     MediaTrackSupportedConstraints getSupportedConstraints();
</span><span class="cx"> 
</span><del>-    [Custom, MayThrowException, PrivateIdentifier, PublicIdentifier] Promise&lt;MediaStream&gt; getUserMedia(optional MediaStreamConstraints constraints);
</del><ins>+    [MayThrowException, PrivateIdentifier, PublicIdentifier] Promise&lt;MediaStream&gt; getUserMedia(optional MediaStreamConstraints constraints);
</ins><span class="cx">     Promise&lt;sequence&lt;MediaDeviceInfo&gt;&gt; enumerateDevices();
</span><span class="cx"> };
</span><ins>+
+dictionary MediaStreamConstraints {
+    (boolean or MediaTrackConstraints) video = false;
+    (boolean or MediaTrackConstraints) audio = false;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx">     trackPrivates.reserveCapacity(tracks.size());
</span><span class="cx"> 
</span><span class="cx">     for (auto&amp; track : tracks) {
</span><del>-        track-&gt;addObserver(this);
</del><ins>+        track-&gt;addObserver(*this);
</ins><span class="cx">         m_trackSet.add(track-&gt;id(), track);
</span><span class="cx">         trackPrivates.append(&amp;track-&gt;privateTrack());
</span><span class="cx">     }
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx"> 
</span><span class="cx">     for (auto&amp; trackPrivate : m_private-&gt;tracks()) {
</span><span class="cx">         auto track = MediaStreamTrack::create(context, *trackPrivate);
</span><del>-        track-&gt;addObserver(this);
</del><ins>+        track-&gt;addObserver(*this);
</ins><span class="cx">         m_trackSet.add(track-&gt;id(), WTFMove(track));
</span><span class="cx">     }
</span><span class="cx">     document()-&gt;addAudioProducer(this);
</span><span class="lines">@@ -110,7 +110,7 @@
</span><span class="cx">     MediaStreamRegistry::shared().unregisterStream(*this);
</span><span class="cx">     m_private-&gt;removeObserver(*this);
</span><span class="cx">     for (auto&amp; track : m_trackSet.values())
</span><del>-        track-&gt;removeObserver(this);
</del><ins>+        track-&gt;removeObserver(*this);
</ins><span class="cx">     if (Document* document = this-&gt;document()) {
</span><span class="cx">         document-&gt;removeAudioProducer(this);
</span><span class="cx">         if (m_isWaitingUntilMediaCanStart)
</span><span class="lines">@@ -215,7 +215,7 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(result.iterator-&gt;value);
</span><span class="cx">     auto&amp; track = *result.iterator-&gt;value;
</span><del>-    track.addObserver(this);
</del><ins>+    track.addObserver(*this);
</ins><span class="cx"> 
</span><span class="cx">     if (streamModifier == StreamModifier::DomAPI)
</span><span class="cx">         m_private-&gt;addTrack(&amp;track.privateTrack(), MediaStreamPrivate::NotifyClientOption::DontNotify);
</span><span class="lines">@@ -231,7 +231,7 @@
</span><span class="cx">     if (!track)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    track-&gt;removeObserver(this);
</del><ins>+    track-&gt;removeObserver(*this);
</ins><span class="cx"> 
</span><span class="cx">     if (streamModifier == StreamModifier::DomAPI)
</span><span class="cx">         m_private-&gt;removeTrack(track-&gt;privateTrack(), MediaStreamPrivate::NotifyClientOption::DontNotify);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamTrackcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -158,49 +158,40 @@
</span><span class="cx">     return m_private-&gt;capabilities();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamTrack::applyConstraints(Ref&lt;MediaConstraints&gt;&amp;&amp; constraints, DOMPromise&lt;void&gt;&amp;&amp; promise)
</del><ins>+static Ref&lt;MediaConstraintsImpl&gt; createMediaConstraintsImpl(const std::optional&lt;MediaTrackConstraints&gt;&amp; constraints)
</ins><span class="cx"> {
</span><del>-    if (!constraints-&gt;isValid()) {
-        promise.reject(TypeError);
-        return;
-    }
</del><ins>+    if (!constraints)
+        return MediaConstraintsImpl::create({ }, { }, true);
+    return createMediaConstraintsImpl(constraints.value());
+}
</ins><span class="cx"> 
</span><del>-    m_constraints = WTFMove(constraints);
</del><ins>+void MediaStreamTrack::applyConstraints(const std::optional&lt;MediaTrackConstraints&gt;&amp; constraints, DOMPromise&lt;void&gt;&amp;&amp; promise)
+{
</ins><span class="cx">     m_promise = WTFMove(promise);
</span><span class="cx"> 
</span><del>-    applyConstraints(*m_constraints);
-}
-
-void MediaStreamTrack::applyConstraints(const MediaConstraints&amp; constraints)
-{
</del><span class="cx">     auto weakThis = createWeakPtr();
</span><del>-    std::function&lt;void(const String&amp;, const String&amp;)&gt; failureHandler = [weakThis](const String&amp; failedConstraint, const String&amp; message) {
</del><ins>+    auto failureHandler = [weakThis] (const String&amp; failedConstraint, const String&amp; message) {
</ins><span class="cx">         if (!weakThis || !weakThis-&gt;m_promise)
</span><span class="cx">             return;
</span><del>-
</del><span class="cx">         weakThis-&gt;m_promise-&gt;rejectType&lt;IDLInterface&lt;OverconstrainedError&gt;&gt;(OverconstrainedError::create(failedConstraint, message).get());
</span><span class="cx">     };
</span><del>-
-    std::function&lt;void()&gt; successHandler = [weakThis]() {
</del><ins>+    auto successHandler = [weakThis, constraints] () {
</ins><span class="cx">         if (!weakThis || !weakThis-&gt;m_promise)
</span><span class="cx">             return;
</span><del>-
</del><span class="cx">         weakThis-&gt;m_promise-&gt;resolve();
</span><ins>+        weakThis-&gt;m_constraints = constraints.value_or(MediaTrackConstraints { });
</ins><span class="cx">     };
</span><del>-
-    m_private-&gt;applyConstraints(constraints, successHandler, failureHandler);
</del><ins>+    m_private-&gt;applyConstraints(createMediaConstraintsImpl(constraints), successHandler, failureHandler);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamTrack::addObserver(MediaStreamTrack::Observer* observer)
</del><ins>+void MediaStreamTrack::addObserver(Observer&amp; observer)
</ins><span class="cx"> {
</span><del>-    m_observers.append(observer);
</del><ins>+    m_observers.append(&amp;observer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaStreamTrack::removeObserver(MediaStreamTrack::Observer* observer)
</del><ins>+void MediaStreamTrack::removeObserver(Observer&amp; observer)
</ins><span class="cx"> {
</span><del>-    size_t pos = m_observers.find(observer);
-    if (pos != notFound)
-        m_observers.remove(pos);
</del><ins>+    m_observers.removeFirst(&amp;observer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaStreamTrack::trackEnded(MediaStreamTrackPrivate&amp;)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamTrackh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -33,13 +33,7 @@
</span><span class="cx"> #include &quot;EventTarget.h&quot;
</span><span class="cx"> #include &quot;JSDOMPromise.h&quot;
</span><span class="cx"> #include &quot;MediaStreamTrackPrivate.h&quot;
</span><del>-#include &quot;RealtimeMediaSource.h&quot;
-#include &quot;ScriptWrappable.h&quot;
-#include &lt;wtf/Optional.h&gt;
-#include &lt;wtf/RefPtr.h&gt;
-#include &lt;wtf/Vector.h&gt;
-#include &lt;wtf/WeakPtr.h&gt;
-#include &lt;wtf/text/WTFString.h&gt;
</del><ins>+#include &quot;MediaTrackConstraints.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -47,6 +41,8 @@
</span><span class="cx"> class MediaConstraints;
</span><span class="cx"> class MediaSourceSettings;
</span><span class="cx"> 
</span><ins>+struct MediaTrackConstraints;
+
</ins><span class="cx"> class MediaStreamTrack final : public RefCounted&lt;MediaStreamTrack&gt;, public ActiveDOMObject, public EventTargetWithInlineData, private MediaStreamTrackPrivate::Observer {
</span><span class="cx"> public:
</span><span class="cx">     class Observer {
</span><span class="lines">@@ -80,8 +76,8 @@
</span><span class="cx">     RefPtr&lt;MediaSourceSettings&gt; getSettings() const;
</span><span class="cx">     RefPtr&lt;RealtimeMediaSourceCapabilities&gt; getCapabilities() const;
</span><span class="cx"> 
</span><del>-    void applyConstraints(Ref&lt;MediaConstraints&gt;&amp;&amp;, DOMPromise&lt;void&gt;&amp;&amp;);
-    void applyConstraints(const MediaConstraints&amp;);
</del><ins>+    const MediaTrackConstraints&amp; getConstraints() const { return m_constraints; }
+    void applyConstraints(const std::optional&lt;MediaTrackConstraints&gt;&amp;, DOMPromise&lt;void&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     RealtimeMediaSource&amp; source() { return m_private-&gt;source(); }
</span><span class="cx">     MediaStreamTrackPrivate&amp; privateTrack() { return m_private.get(); }
</span><span class="lines">@@ -88,16 +84,12 @@
</span><span class="cx"> 
</span><span class="cx">     AudioSourceProvider* audioSourceProvider();
</span><span class="cx"> 
</span><del>-    void addObserver(Observer*);
-    void removeObserver(Observer*);
</del><ins>+    void addObserver(Observer&amp;);
+    void removeObserver(Observer&amp;);
</ins><span class="cx"> 
</span><del>-    // EventTarget
-    EventTargetInterface eventTargetInterface() const final { return MediaStreamTrackEventTargetInterfaceType; }
-    ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
</del><ins>+    using RefCounted::ref;
+    using RefCounted::deref;
</ins><span class="cx"> 
</span><del>-    using RefCounted&lt;MediaStreamTrack&gt;::ref;
-    using RefCounted&lt;MediaStreamTrack&gt;::deref;
-
</del><span class="cx"> private:
</span><span class="cx">     MediaStreamTrack(ScriptExecutionContext&amp;, Ref&lt;MediaStreamTrackPrivate&gt;&amp;&amp;);
</span><span class="cx">     explicit MediaStreamTrack(MediaStreamTrack&amp;);
</span><span class="lines">@@ -112,6 +104,8 @@
</span><span class="cx">     // EventTarget
</span><span class="cx">     void refEventTarget() final { ref(); }
</span><span class="cx">     void derefEventTarget() final { deref(); }
</span><ins>+    EventTargetInterface eventTargetInterface() const final { return MediaStreamTrackEventTargetInterfaceType; }
+    ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
</ins><span class="cx"> 
</span><span class="cx">     // MediaStreamTrackPrivate::Observer
</span><span class="cx">     void trackEnded(MediaStreamTrackPrivate&amp;) override;
</span><span class="lines">@@ -124,7 +118,7 @@
</span><span class="cx">     Vector&lt;Observer*&gt; m_observers;
</span><span class="cx">     Ref&lt;MediaStreamTrackPrivate&gt; m_private;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;MediaConstraints&gt; m_constraints;
</del><ins>+    MediaTrackConstraints m_constraints;
</ins><span class="cx">     std::optional&lt;DOMPromise&lt;void&gt;&gt; m_promise;
</span><span class="cx">     WeakPtrFactory&lt;MediaStreamTrack&gt; m_weakPtrFactory;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaStreamTrackidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.idl        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -47,11 +47,10 @@
</span><span class="cx">     MediaStreamTrack clone();
</span><span class="cx">     [ImplementedAs=stopProducingData] void stop();
</span><span class="cx"> 
</span><del>-    [Custom] MediaTrackConstraints getConstraints();
</del><ins>+    MediaTrackConstraints getConstraints();
</ins><span class="cx">     [Custom] MediaSourceSettings getSettings();
</span><span class="cx">     [Custom] MediaTrackCapabilities getCapabilities();
</span><del>-    [Custom] Promise&lt;void&gt; applyConstraints(optional MediaTrackConstraints constraints);
</del><ins>+    Promise&lt;void&gt; applyConstraints(optional MediaTrackConstraints constraints);
</ins><span class="cx"> 
</span><span class="cx">     attribute EventHandler onoverconstrained;
</span><span class="cx"> };
</span><del>-
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaTrackConstraintscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp (0 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp                                (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -0,0 +1,200 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;MediaTrackConstraints.h&quot;
+
+#if ENABLE(MEDIA_STREAM)
+
+#include &quot;MediaConstraintsImpl.h&quot;
+
+namespace WebCore {
+
+enum class ConstraintSetType { Mandatory, Advanced };
+
+static void set(MediaTrackConstraintSetMap&amp; map, ConstraintSetType setType, const char* typeAsString, MediaConstraintType type, const ConstrainLong&amp; value)
+{
+    IntConstraint constraint(typeAsString, type);
+    WTF::switchOn(value,
+        [&amp;] (int integer) {
+            if (setType == ConstraintSetType::Mandatory)
+                constraint.setIdeal(integer);
+            else
+                constraint.setExact(integer);
+        },
+        [&amp;] (const ConstrainLongRange&amp; range) {
+            if (range.min)
+                constraint.setMin(range.min.value());
+            if (range.max)
+                constraint.setMax(range.max.value());
+            if (range.exact)
+                constraint.setExact(range.exact.value());
+            if (range.ideal)
+                constraint.setIdeal(range.ideal.value());
+        }
+    );
+    map.set(type, WTFMove(constraint));
+}
+
+static void set(MediaTrackConstraintSetMap&amp; map, ConstraintSetType setType, const char* typeAsString, MediaConstraintType type, const ConstrainDouble&amp; value)
+{
+    DoubleConstraint constraint(typeAsString, type);
+    WTF::switchOn(value,
+        [&amp;] (double number) {
+            if (setType == ConstraintSetType::Mandatory)
+                constraint.setIdeal(number);
+            else
+                constraint.setExact(number);
+        },
+        [&amp;] (const ConstrainDoubleRange&amp; range) {
+            if (range.min)
+                constraint.setMin(range.min.value());
+            if (range.max)
+                constraint.setMax(range.max.value());
+            if (range.exact)
+                constraint.setExact(range.exact.value());
+            if (range.ideal)
+                constraint.setIdeal(range.ideal.value());
+        }
+    );
+    map.set(type, WTFMove(constraint));
+}
+
+static void set(MediaTrackConstraintSetMap&amp; map, ConstraintSetType setType, const char* typeAsString, MediaConstraintType type, const ConstrainBoolean&amp; value)
+{
+    BooleanConstraint constraint(typeAsString, type);
+    WTF::switchOn(value,
+        [&amp;] (bool boolean) {
+            if (setType == ConstraintSetType::Mandatory)
+                constraint.setIdeal(boolean);
+            else
+                constraint.setExact(boolean);
+        },
+        [&amp;] (const ConstrainBooleanParameters&amp; parameters) {
+            if (parameters.exact)
+                constraint.setExact(parameters.exact.value());
+            if (parameters.ideal)
+                constraint.setIdeal(parameters.ideal.value());
+        }
+    );
+    map.set(type, WTFMove(constraint));
+}
+
+static void set(MediaTrackConstraintSetMap&amp; map, ConstraintSetType setType, const char* typeAsString, MediaConstraintType type, const ConstrainDOMString&amp; value)
+{
+    StringConstraint constraint(typeAsString, type);
+    WTF::switchOn(value,
+        [&amp;] (const String&amp; string) {
+            if (setType == ConstraintSetType::Mandatory)
+                constraint.appendIdeal(string);
+            else
+                constraint.appendExact(string);
+        },
+        [&amp;] (const Vector&lt;String&gt;&amp; vector) {
+            if (setType == ConstraintSetType::Mandatory) {
+                for (auto&amp; string : vector)
+                    constraint.appendIdeal(string);
+            } else {
+                for (auto&amp; string : vector)
+                    constraint.appendExact(string);
+            }
+        },
+        [&amp;] (const ConstrainDOMStringParameters&amp; parameters) {
+            if (parameters.exact) {
+                WTF::switchOn(parameters.exact.value(),
+                    [&amp;] (const String&amp; string) {
+                        constraint.appendExact(string);
+                    },
+                    [&amp;] (const Vector&lt;String&gt;&amp; vector) {
+                        for (auto&amp; string : vector)
+                            constraint.appendExact(string);
+                    }
+                );
+            }
+            if (parameters.ideal) {
+                WTF::switchOn(parameters.ideal.value(),
+                    [&amp;] (const String&amp; string) {
+                        constraint.appendIdeal(string);
+                    },
+                    [&amp;] (const Vector&lt;String&gt;&amp; vector) {
+                        for (auto&amp; string : vector)
+                            constraint.appendIdeal(string);
+                    }
+                );
+            }
+        }
+    );
+    map.set(type, WTFMove(constraint));
+}
+
+template&lt;typename T&gt; static inline void set(MediaTrackConstraintSetMap&amp; map, ConstraintSetType setType, const char* typeAsString, MediaConstraintType type, const std::optional&lt;T&gt;&amp; value)
+{
+    if (!value)
+        return;
+    set(map, setType, typeAsString, type, value.value());
+}
+
+static MediaTrackConstraintSetMap convertToInternalForm(ConstraintSetType setType, const MediaTrackConstraintSet&amp; constraintSet)
+{
+    MediaTrackConstraintSetMap result;
+    set(result, setType, &quot;width&quot;, MediaConstraintType::Width, constraintSet.width);
+    set(result, setType, &quot;height&quot;, MediaConstraintType::Height, constraintSet.height);
+    set(result, setType, &quot;aspectRatio&quot;, MediaConstraintType::AspectRatio, constraintSet.aspectRatio);
+    set(result, setType, &quot;frameRate&quot;, MediaConstraintType::FrameRate, constraintSet.frameRate);
+    set(result, setType, &quot;facingMode&quot;, MediaConstraintType::FacingMode, constraintSet.facingMode);
+    set(result, setType, &quot;volume&quot;, MediaConstraintType::Volume, constraintSet.volume);
+    set(result, setType, &quot;sampleRate&quot;, MediaConstraintType::SampleRate, constraintSet.sampleRate);
+    set(result, setType, &quot;sampleSize&quot;, MediaConstraintType::SampleSize, constraintSet.sampleSize);
+    set(result, setType, &quot;echoCancellation&quot;, MediaConstraintType::EchoCancellation, constraintSet.echoCancellation);
+    // FIXME: add latency
+    // FIXME: add channelCount
+    set(result, setType, &quot;deviceId&quot;, MediaConstraintType::DeviceId, constraintSet.deviceId);
+    set(result, setType, &quot;groupId&quot;, MediaConstraintType::GroupId, constraintSet.groupId);
+    return result;
+}
+
+static Vector&lt;MediaTrackConstraintSetMap&gt; convertAdvancedToInternalForm(const Vector&lt;MediaTrackConstraintSet&gt;&amp; vector)
+{
+    Vector&lt;MediaTrackConstraintSetMap&gt; result;
+    result.reserveInitialCapacity(vector.size());
+    for (auto&amp; set : vector)
+        result.uncheckedAppend(convertToInternalForm(ConstraintSetType::Advanced, set));
+    return result;
+}
+
+static Vector&lt;MediaTrackConstraintSetMap&gt; convertAdvancedToInternalForm(const std::optional&lt;Vector&lt;MediaTrackConstraintSet&gt;&gt;&amp; optionalVector)
+{
+    if (!optionalVector)
+        return { };
+    return convertAdvancedToInternalForm(optionalVector.value());
+}
+
+Ref&lt;MediaConstraintsImpl&gt; createMediaConstraintsImpl(const MediaTrackConstraints&amp; constraints)
+{
+    return MediaConstraintsImpl::create(convertToInternalForm(ConstraintSetType::Mandatory, constraints), convertAdvancedToInternalForm(constraints.advanced), true);
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaTrackConstraintsh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h (0 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h                                (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(MEDIA_STREAM)
+
+#include &lt;wtf/Optional.h&gt;
+#include &lt;wtf/Variant.h&gt;
+#include &lt;wtf/Vector.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+class MediaConstraintsImpl;
+
+struct DoubleRange {
+    std::optional&lt;double&gt; min;
+    std::optional&lt;double&gt; max;
+};
+
+struct LongRange {
+    std::optional&lt;int&gt; max;
+    std::optional&lt;int&gt; min;
+};
+
+struct ConstrainBooleanParameters {
+    std::optional&lt;bool&gt; exact;
+    std::optional&lt;bool&gt; ideal;
+};
+
+struct ConstrainDOMStringParameters {
+    std::optional&lt;Variant&lt;String, Vector&lt;String&gt;&gt;&gt; exact;
+    std::optional&lt;Variant&lt;String, Vector&lt;String&gt;&gt;&gt; ideal;
+};
+
+struct ConstrainDoubleRange : DoubleRange {
+    std::optional&lt;double&gt; exact;
+    std::optional&lt;double&gt; ideal;
+};
+
+struct ConstrainLongRange : LongRange {
+    std::optional&lt;int&gt; exact;
+    std::optional&lt;int&gt; ideal;
+};
+
+using ConstrainBoolean = Variant&lt;bool, ConstrainBooleanParameters&gt;;
+using ConstrainDOMString = Variant&lt;String, Vector&lt;String&gt;, ConstrainDOMStringParameters&gt;;
+using ConstrainDouble = Variant&lt;double, ConstrainDoubleRange&gt;;
+using ConstrainLong = Variant&lt;int, ConstrainLongRange&gt;;
+
+struct MediaTrackConstraintSet {
+    std::optional&lt;ConstrainLong&gt; width;
+    std::optional&lt;ConstrainLong&gt; height;
+    std::optional&lt;ConstrainDouble&gt; aspectRatio;
+    std::optional&lt;ConstrainDouble&gt; frameRate;
+    std::optional&lt;ConstrainDOMString&gt; facingMode;
+    std::optional&lt;ConstrainDouble&gt; volume;
+    std::optional&lt;ConstrainLong&gt; sampleRate;
+    std::optional&lt;ConstrainLong&gt; sampleSize;
+    std::optional&lt;ConstrainBoolean&gt; echoCancellation;
+    std::optional&lt;ConstrainDouble&gt; latency;
+    std::optional&lt;ConstrainLong&gt; channelCount;
+    std::optional&lt;ConstrainDOMString&gt; deviceId;
+    std::optional&lt;ConstrainDOMString&gt; groupId;
+};
+
+struct MediaTrackConstraints : MediaTrackConstraintSet {
+    std::optional&lt;Vector&lt;MediaTrackConstraintSet&gt;&gt; advanced;
+};
+
+Ref&lt;MediaConstraintsImpl&gt; createMediaConstraintsImpl(const MediaTrackConstraints&amp;);
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamMediaTrackConstraintsidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.idl (0 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.idl                                (rev 0)
+++ trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.idl        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=MEDIA_STREAM,
+    JSGenerateToJSObject,
+] dictionary MediaTrackConstraints : MediaTrackConstraintSet {
+    sequence&lt;MediaTrackConstraintSet&gt; advanced;
+};
+
+[
+    JSGenerateToJSObject,
+] dictionary MediaTrackConstraintSet {
+    ConstrainLong width;
+    ConstrainLong height;
+    ConstrainDouble aspectRatio;
+    ConstrainDouble frameRate;
+    ConstrainDOMString facingMode;
+    ConstrainDouble volume;
+    ConstrainLong sampleRate;
+    ConstrainLong sampleSize;
+    ConstrainBoolean echoCancellation;
+    ConstrainDouble latency;
+    ConstrainLong channelCount;
+    ConstrainDOMString deviceId;
+    ConstrainDOMString groupId;
+};
+
+typedef (double or ConstrainDoubleRange) ConstrainDouble;
+typedef (long or ConstrainLongRange) ConstrainLong;
+typedef (boolean or ConstrainBooleanParameters) ConstrainBoolean;
+typedef (DOMString or sequence&lt;DOMString&gt; or ConstrainDOMStringParameters) ConstrainDOMString;
+
+[
+    JSGenerateToJSObject,
+] dictionary ConstrainBooleanParameters {
+    boolean exact;
+    boolean ideal;
+};
+
+[
+    JSGenerateToJSObject,
+] dictionary ConstrainDOMStringParameters {
+    (DOMString or sequence&lt;DOMString&gt;) exact;
+    (DOMString or sequence&lt;DOMString&gt;) ideal;
+};
+
+[
+    JSGenerateToJSObject,
+] dictionary ConstrainDoubleRange : DoubleRange {
+    double exact;
+    double ideal;
+};
+
+[
+    JSGenerateToJSObject,
+] dictionary ConstrainLongRange : LongRange {
+    long exact;
+    long ideal;
+};
+
+dictionary DoubleRange {
+    double max;
+    double min;
+};
+
+dictionary LongRange {
+    long max;
+    long min;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamUserMediaRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -36,24 +36,20 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><ins>+#include &quot;Document.h&quot;
</ins><span class="cx"> #include &quot;DocumentLoader.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><del>-#include &quot;Frame.h&quot;
</del><span class="cx"> #include &quot;JSMediaStream.h&quot;
</span><span class="cx"> #include &quot;JSOverconstrainedError.h&quot;
</span><span class="cx"> #include &quot;MainFrame.h&quot;
</span><del>-#include &quot;MediaStream.h&quot;
-#include &quot;MediaStreamPrivate.h&quot;
-#include &quot;OverconstrainedError.h&quot;
</del><ins>+#include &quot;MediaConstraintsImpl.h&quot;
</ins><span class="cx"> #include &quot;RealtimeMediaSourceCenter.h&quot;
</span><del>-#include &quot;SecurityOrigin.h&quot;
</del><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;UserMediaController.h&quot;
</span><del>-#include &lt;wtf/MainThread.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-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)
</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, DOMPromise&lt;IDLInterface&lt;MediaStream&gt;&gt;&amp;&amp; promise)
</ins><span class="cx"> {
</span><span class="cx">     auto* userMedia = UserMediaController::from(document.page());
</span><span class="cx">     if (!userMedia)
</span><span class="lines">@@ -68,7 +64,7 @@
</span><span class="cx">     return { };
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-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)
</del><ins>+UserMediaRequest::UserMediaRequest(Document&amp; document, UserMediaController&amp; controller, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, DOMPromise&lt;IDLInterface&lt;MediaStream&gt;&gt;&amp;&amp; promise)
</ins><span class="cx">     : ContextDestructionObserver(&amp;document)
</span><span class="cx">     , m_audioConstraints(WTFMove(audioConstraints))
</span><span class="cx">     , m_videoConstraints(WTFMove(videoConstraints))
</span><span class="lines">@@ -85,7 +81,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_scriptExecutionContext)
</span><span class="cx">         return nullptr;
</span><del>-
</del><span class="cx">     return m_scriptExecutionContext-&gt;securityOrigin();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -93,19 +88,15 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_scriptExecutionContext)
</span><span class="cx">         return nullptr;
</span><del>-
</del><span class="cx">     return m_scriptExecutionContext-&gt;topOrigin();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isSecure(DocumentLoader&amp; documentLoader)
</span><span class="cx"> {
</span><del>-    if (!documentLoader.response().url().protocolIs(&quot;https&quot;))
-        return false;
-
-    if (!documentLoader.response().certificateInfo() || documentLoader.response().certificateInfo()-&gt;containsNonRootSHA1SignedCertificate())
-        return false;
-
-    return true;
</del><ins>+    auto&amp; response = documentLoader.response();
+    return response.url().protocolIs(&quot;https&quot;)
+        &amp;&amp; response.certificateInfo()
+        &amp;&amp; !response.certificateInfo()-&gt;containsNonRootSHA1SignedCertificate();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool canCallGetUserMedia(Document&amp; document, String&amp; errorMessage)
</span><span class="lines">@@ -149,7 +140,6 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Document&amp; document = downcast&lt;Document&gt;(*m_scriptExecutionContext);
</span><del>-    DOMWindow&amp; window = *document.domWindow();
</del><span class="cx"> 
</span><span class="cx">     // 10.2 - 6.3 Optionally, e.g., based on a previously-established user preference, for security reasons,
</span><span class="cx">     // or due to platform limitations, jump to the step labeled Permission Failure below.
</span><span class="lines">@@ -156,7 +146,7 @@
</span><span class="cx">     String errorMessage;
</span><span class="cx">     if (!canCallGetUserMedia(document, errorMessage)) {
</span><span class="cx">         deny(MediaAccessDenialReason::PermissionDenied, emptyString());
</span><del>-        window.printErrorMessage(errorMessage);
</del><ins>+        document.domWindow()-&gt;printErrorMessage(errorMessage);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -230,7 +220,6 @@
</span><span class="cx"> {
</span><span class="cx">     ContextDestructionObserver::contextDestroyed();
</span><span class="cx">     Ref&lt;UserMediaRequest&gt; protectedThis(*this);
</span><del>-
</del><span class="cx">     if (m_controller) {
</span><span class="cx">         m_controller-&gt;cancelUserMediaAccessRequest(*this);
</span><span class="cx">         m_controller = nullptr;
</span><span class="lines">@@ -239,9 +228,6 @@
</span><span class="cx"> 
</span><span class="cx"> Document* UserMediaRequest::document() const
</span><span class="cx"> {
</span><del>-    if (!m_scriptExecutionContext)
-        return nullptr;
-
</del><span class="cx">     return downcast&lt;Document&gt;(m_scriptExecutionContext);
</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 (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -35,20 +35,18 @@
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ActiveDOMObject.h&quot;
</span><del>-#include &quot;Document.h&quot;
-#include &quot;MediaConstraintsImpl.h&quot;
-#include &quot;MediaDevices.h&quot;
</del><ins>+#include &quot;JSDOMPromise.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class MediaConstraints;
-class MediaStreamPrivate;
</del><ins>+class MediaConstraintsImpl;
+class MediaStream;
+class SecurityOrigin;
</ins><span class="cx"> class UserMediaController;
</span><del>-class SecurityOrigin;
</del><span class="cx"> 
</span><span class="cx"> class UserMediaRequest : public RefCounted&lt;UserMediaRequest&gt;, private ContextDestructionObserver {
</span><span class="cx"> public:
</span><del>-    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;);
</del><ins>+    static ExceptionOr&lt;void&gt; start(Document&amp;, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; audioConstraints, Ref&lt;MediaConstraintsImpl&gt;&amp;&amp; videoConstraints, DOMPromise&lt;IDLInterface&lt;MediaStream&gt;&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     virtual ~UserMediaRequest();
</span><span class="cx"> 
</span><span class="lines">@@ -74,7 +72,7 @@
</span><span class="cx">     WEBCORE_EXPORT Document* document() const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    UserMediaRequest(Document&amp;, UserMediaController&amp;, 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, DOMPromise&lt;IDLInterface&lt;MediaStream&gt;&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void contextDestroyed() final;
</span><span class="cx">     
</span><span class="lines">@@ -88,7 +86,7 @@
</span><span class="cx">     String m_allowedAudioDeviceUID;
</span><span class="cx"> 
</span><span class="cx">     UserMediaController* m_controller;
</span><del>-    MediaDevices::Promise m_promise;
</del><ins>+    DOMPromise&lt;IDLInterface&lt;MediaStream&gt;&gt; m_promise;
</ins><span class="cx">     RefPtr&lt;UserMediaRequest&gt; m_protector;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -125,7 +125,6 @@
</span><span class="cx">                 07277E5417D018CC0015534D /* JSMediaStreamTrackEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07277E4817D018CC0015534D /* JSMediaStreamTrackEvent.cpp */; };
</span><span class="cx">                 07277E5517D018CC0015534D /* JSMediaStreamTrackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 07277E4917D018CC0015534D /* JSMediaStreamTrackEvent.h */; };
</span><span class="cx">                 072A70401D6E8F6200DF0AFC /* OverconstrainedErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 072A703E1D6E8F6200DF0AFC /* OverconstrainedErrorEvent.h */; };
</span><del>-                072A70431D7396B300DF0AFC /* JSMediaDevicesCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 072A70421D7396B200DF0AFC /* JSMediaDevicesCustom.h */; };
</del><span class="cx">                 072AE1E5183C0741000A5988 /* PluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 072AE1DF183C0741000A5988 /* PluginReplacement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 072AE1E6183C0741000A5988 /* QuickTimePluginReplacement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 072AE1E0183C0741000A5988 /* QuickTimePluginReplacement.mm */; };
</span><span class="cx">                 072AE1E8183C0741000A5988 /* QuickTimePluginReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 072AE1E2183C0741000A5988 /* QuickTimePluginReplacement.h */; };
</span><span class="lines">@@ -989,7 +988,6 @@
</span><span class="cx">                 1AFFC4591D5E866100267A66 /* PluginBlacklist.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFFC44F1D5E7EC700267A66 /* PluginBlacklist.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 1B124D8D1D380B7000ECDFB0 /* MediaSampleAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */; };
</span><span class="cx">                 1B124D8F1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B124D8E1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm */; };
</span><del>-                1B88DD131D5B9E5000E3B7A4 /* JSMediaDevicesCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1B88DD121D5AD3B200E3B7A4 /* JSMediaDevicesCustom.cpp */; };
</del><span class="cx">                 1BE5BFC21D515715001666D9 /* MediaConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1BE5BFC11D515715001666D9 /* MediaConstraints.cpp */; };
</span><span class="cx">                 1BF9DB3C1D3973AD0026AEB7 /* MediaSample.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EC7181ED60100EE4C41 /* MediaSample.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 1C010700192594DF008A4201 /* InlineTextBoxStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C0106FE192594DF008A4201 /* InlineTextBoxStyle.cpp */; };
</span><span class="lines">@@ -3261,6 +3259,10 @@
</span><span class="cx">                 9327A94209968D1A0068A546 /* HTMLOptionsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */; };
</span><span class="cx">                 932AD70517EFA2C30038F8FF /* MainFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 932AD70317EFA2C30038F8FF /* MainFrame.cpp */; };
</span><span class="cx">                 932AD70617EFA2C40038F8FF /* MainFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 932AD70417EFA2C30038F8FF /* MainFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                932CC0B71DFFD158004C0F9F /* MediaTrackConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 932CC0B61DFFD158004C0F9F /* MediaTrackConstraints.h */; };
+                932CC0D41DFFD667004C0F9F /* JSMediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 932CC0D01DFFD667004C0F9F /* JSMediaTrackConstraints.cpp */; };
+                932CC0D51DFFD667004C0F9F /* JSMediaTrackConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 932CC0D11DFFD667004C0F9F /* JSMediaTrackConstraints.h */; };
+                932CC0F71DFFDA1F004C0F9F /* MediaTrackConstraints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 932CC0F61DFFDA1F004C0F9F /* MediaTrackConstraints.cpp */; };
</ins><span class="cx">                 932E16090AF578340025F408 /* FrameLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 932E16080AF578340025F408 /* FrameLoader.cpp */; };
</span><span class="cx">                 93309DD6099E64920056E581 /* AppendNodeCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93309D87099E64910056E581 /* AppendNodeCommand.cpp */; };
</span><span class="cx">                 93309DD7099E64920056E581 /* AppendNodeCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309D88099E64910056E581 /* AppendNodeCommand.h */; };
</span><span class="lines">@@ -7115,7 +7117,6 @@
</span><span class="cx">                 072847E216EBC5B00043CFA4 /* PlatformTextTrack.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformTextTrack.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 072A703E1D6E8F6200DF0AFC /* OverconstrainedErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverconstrainedErrorEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 072A703F1D6E8F6200DF0AFC /* OverconstrainedErrorEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = OverconstrainedErrorEvent.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                072A70421D7396B200DF0AFC /* JSMediaDevicesCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaDevicesCustom.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 072AE1DF183C0741000A5988 /* PluginReplacement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginReplacement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 072AE1E0183C0741000A5988 /* QuickTimePluginReplacement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuickTimePluginReplacement.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 072AE1E1183C0741000A5988 /* QuickTimePluginReplacement.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = QuickTimePluginReplacement.css; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -8040,7 +8041,6 @@
</span><span class="cx">                 1AFFC4561D5E83A700267A66 /* CFUtilitiesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFUtilitiesSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaSampleAVFObjC.h; path = ../MediaSampleAVFObjC.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1B124D8E1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSampleAVFObjC.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                1B88DD121D5AD3B200E3B7A4 /* JSMediaDevicesCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaDevicesCustom.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 1BE5BFC11D515715001666D9 /* MediaConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaConstraints.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1C0106FE192594DF008A4201 /* InlineTextBoxStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineTextBoxStyle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1C0106FF192594DF008A4201 /* InlineTextBoxStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineTextBoxStyle.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -10814,6 +10814,11 @@
</span><span class="cx">                 9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLOptionsCollection.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 932AD70317EFA2C30038F8FF /* MainFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainFrame.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 932AD70417EFA2C30038F8FF /* MainFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainFrame.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                932CC0B61DFFD158004C0F9F /* MediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTrackConstraints.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                932CC0D01DFFD667004C0F9F /* JSMediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaTrackConstraints.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                932CC0D11DFFD667004C0F9F /* JSMediaTrackConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaTrackConstraints.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                932CC0F01DFFD8D4004C0F9F /* MediaTrackConstraints.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaTrackConstraints.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
+                932CC0F61DFFDA1F004C0F9F /* MediaTrackConstraints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTrackConstraints.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 932E16080AF578340025F408 /* FrameLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoader.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93309D87099E64910056E581 /* AppendNodeCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppendNodeCommand.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93309D88099E64910056E581 /* AppendNodeCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppendNodeCommand.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -15026,6 +15031,9 @@
</span><span class="cx">                                 07221B5717CEC32700848E51 /* MediaStreamTrackEvent.cpp */,
</span><span class="cx">                                 07221B5817CEC32700848E51 /* MediaStreamTrackEvent.h */,
</span><span class="cx">                                 07221B5917CEC32700848E51 /* MediaStreamTrackEvent.idl */,
</span><ins>+                                932CC0F61DFFDA1F004C0F9F /* MediaTrackConstraints.cpp */,
+                                932CC0B61DFFD158004C0F9F /* MediaTrackConstraints.h */,
+                                932CC0F01DFFD8D4004C0F9F /* MediaTrackConstraints.idl */,
</ins><span class="cx">                                 07C1C0E01BFB600100BD2256 /* MediaTrackSupportedConstraints.h */,
</span><span class="cx">                                 07C1C0E11BFB600100BD2256 /* MediaTrackSupportedConstraints.idl */,
</span><span class="cx">                                 5EA725CA1ACABCB500EAD17B /* NavigatorMediaDevices.cpp */,
</span><span class="lines">@@ -15238,6 +15246,8 @@
</span><span class="cx">                                 07277E4717D018CC0015534D /* JSMediaStreamTrack.h */,
</span><span class="cx">                                 07277E4817D018CC0015534D /* JSMediaStreamTrackEvent.cpp */,
</span><span class="cx">                                 07277E4917D018CC0015534D /* JSMediaStreamTrackEvent.h */,
</span><ins>+                                932CC0D01DFFD667004C0F9F /* JSMediaTrackConstraints.cpp */,
+                                932CC0D11DFFD667004C0F9F /* JSMediaTrackConstraints.h */,
</ins><span class="cx">                                 0787C4671BFBDF6F006DCD7F /* JSMediaTrackSupportedConstraints.cpp */,
</span><span class="cx">                                 0787C4681BFBDF6F006DCD7F /* JSMediaTrackSupportedConstraints.h */,
</span><span class="cx">                                 073BE33E17D17E01002BD431 /* JSNavigatorUserMedia.cpp */,
</span><span class="lines">@@ -22024,8 +22034,6 @@
</span><span class="cx">                                 A7D0318D0E93540300E24ACD /* JSImageDataCustom.cpp */,
</span><span class="cx">                                 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */,
</span><span class="cx">                                 BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
</span><del>-                                1B88DD121D5AD3B200E3B7A4 /* JSMediaDevicesCustom.cpp */,
-                                072A70421D7396B200DF0AFC /* JSMediaDevicesCustom.h */,
</del><span class="cx">                                 AD726FE716D9F204003A4E6D /* JSMediaListCustom.h */,
</span><span class="cx">                                 07C59B6D17F794F6000FBCBB /* JSMediaStreamTrackCustom.cpp */,
</span><span class="cx">                                 07C1C0E61BFB90A700BD2256 /* JSMediaTrackSupportedConstraintsCustom.cpp */,
</span><span class="lines">@@ -25522,6 +25530,7 @@
</span><span class="cx">                                 062287840B4DB322000C34DF /* FocusDirection.h in Headers */,
</span><span class="cx">                                 B6D9D23514EABD260090D75E /* FocusEvent.h in Headers */,
</span><span class="cx">                                 B2C3DA650D006CD600EF6F26 /* Font.h in Headers */,
</span><ins>+                                932CC0B71DFFD158004C0F9F /* MediaTrackConstraints.h in Headers */,
</ins><span class="cx">                                 1AC2D89D1B1E291F00D52E87 /* FontAntialiasingStateSaver.h in Headers */,
</span><span class="cx">                                 BCB92D4F1293550B00C8387F /* FontBaseline.h in Headers */,
</span><span class="cx">                                 B2C3DA630D006CD600EF6F26 /* FontCache.h in Headers */,
</span><span class="lines">@@ -26213,7 +26222,6 @@
</span><span class="cx">                                 CDAB6D2E17C814EE00C60B34 /* JSMediaControlsHost.h in Headers */,
</span><span class="cx">                                 159741DB1B7D140100201C92 /* JSMediaDeviceInfo.h in Headers */,
</span><span class="cx">                                 15739BBB1B42012D00D258C1 /* JSMediaDevices.h in Headers */,
</span><del>-                                072A70431D7396B300DF0AFC /* JSMediaDevicesCustom.h in Headers */,
</del><span class="cx">                                 FD23A12613F5FA5900F67001 /* JSMediaElementAudioSourceNode.h in Headers */,
</span><span class="cx">                                 2D9BF7121DBFD914007A7D99 /* JSMediaEncryptedEvent.h in Headers */,
</span><span class="cx">                                 E44614190CD6826900FADA75 /* JSMediaError.h in Headers */,
</span><span class="lines">@@ -28245,6 +28253,7 @@
</span><span class="cx">                                 9BAF3B2412C1A39800014BF1 /* WritingDirection.h in Headers */,
</span><span class="cx">                                 14476AA815DC4BB100305DB2 /* WritingMode.h in Headers */,
</span><span class="cx">                                 6565820209D1508D000E61D7 /* XLinkNames.h in Headers */,
</span><ins>+                                932CC0D51DFFD667004C0F9F /* JSMediaTrackConstraints.h in Headers */,
</ins><span class="cx">                                 830784B21C52EE2C00104D1D /* XMLDocument.h in Headers */,
</span><span class="cx">                                 00B9318813BA8DBA0035A948 /* XMLDocumentParser.h in Headers */,
</span><span class="cx">                                 00B9318C13BA8DCC0035A948 /* XMLDocumentParserScope.h in Headers */,
</span><span class="lines">@@ -28935,6 +28944,7 @@
</span><span class="cx">                                 31BC742D1AAFF45C006B4340 /* CSSAnimationTriggerScrollValue.cpp in Sources */,
</span><span class="cx">                                 CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */,
</span><span class="cx">                                 94DE5C811D7F3A1400164F2A /* CSSAtRuleID.cpp in Sources */,
</span><ins>+                                932CC0F71DFFDA1F004C0F9F /* MediaTrackConstraints.cpp in Sources */,
</ins><span class="cx">                                 FBD6AF8B15EF25E5008B7110 /* CSSBasicShapes.cpp in Sources */,
</span><span class="cx">                                 E16A84F914C85CCC002977DF /* CSSBorderImage.cpp in Sources */,
</span><span class="cx">                                 BC274B31140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp in Sources */,
</span><span class="lines">@@ -29841,6 +29851,7 @@
</span><span class="cx">                                 BC94D14E0C275C68006BC617 /* JSHistory.cpp in Sources */,
</span><span class="cx">                                 BCE7B1930D4E86960075A539 /* JSHistoryCustom.cpp in Sources */,
</span><span class="cx">                                 57E233691DCAB24300F28D01 /* JSHmacKeyParams.cpp in Sources */,
</span><ins>+                                932CC0D41DFFD667004C0F9F /* JSMediaTrackConstraints.cpp in Sources */,
</ins><span class="cx">                                 BC97E412109154FA0010D361 /* JSHTMLAllCollection.cpp in Sources */,
</span><span class="cx">                                 BC97E42C10915B060010D361 /* JSHTMLAllCollectionCustom.cpp in Sources */,
</span><span class="cx">                                 1A4A2DEF0A1B852A00C807F8 /* JSHTMLAnchorElement.cpp in Sources */,
</span><span class="lines">@@ -29975,7 +29986,6 @@
</span><span class="cx">                                 CDAB6D2D17C814EE00C60B34 /* JSMediaControlsHost.cpp in Sources */,
</span><span class="cx">                                 159741DA1B7D13F900201C92 /* JSMediaDeviceInfo.cpp in Sources */,
</span><span class="cx">                                 15739BBA1B42012A00D258C1 /* JSMediaDevices.cpp in Sources */,
</span><del>-                                1B88DD131D5B9E5000E3B7A4 /* JSMediaDevicesCustom.cpp in Sources */,
</del><span class="cx">                                 FD23A12513F5FA5900F67001 /* JSMediaElementAudioSourceNode.cpp in Sources */,
</span><span class="cx">                                 2D9BF7101DBFD8CE007A7D99 /* JSMediaEncryptedEvent.cpp in Sources */,
</span><span class="cx">                                 E44614180CD6826900FADA75 /* JSMediaError.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -99,7 +99,6 @@
</span><span class="cx"> #include &quot;JSLazyEventListener.cpp&quot;
</span><span class="cx"> #include &quot;JSLocationCustom.cpp&quot;
</span><span class="cx"> #include &quot;JSMainThreadExecState.cpp&quot;
</span><del>-#include &quot;JSMediaDevicesCustom.cpp&quot;
</del><span class="cx"> #include &quot;JSMessageChannelCustom.cpp&quot;
</span><span class="cx"> #include &quot;JSMessageEventCustom.cpp&quot;
</span><span class="cx"> #include &quot;JSMessagePortCustom.cpp&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMediaDevicesCustomcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -1,399 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;JSMediaDevicesCustom.h&quot;
-
-#if ENABLE(MEDIA_STREAM)
-
-#include &quot;ArrayValue.h&quot;
-#include &quot;Dictionary.h&quot;
-#include &quot;ExceptionCode.h&quot;
-#include &quot;JSDOMPromise.h&quot;
-#include &quot;JSMediaDevices.h&quot;
-#include &quot;Logging.h&quot;
-#include &quot;MediaConstraintsImpl.h&quot;
-#include &quot;RealtimeMediaSourceCenter.h&quot;
-#include &quot;RealtimeMediaSourceSupportedConstraints.h&quot;
-#include &lt;wtf/HashMap.h&gt;
-#include &lt;wtf/Vector.h&gt;
-
-using namespace JSC;
-
-namespace WebCore {
-
-enum class ConstraintSetType { Mandatory, Advanced };
-
-static void initializeStringConstraintWithList(StringConstraint&amp; constraint, void (StringConstraint::*appendValue)(const String&amp;), const ArrayValue&amp; list)
-{
-    size_t size;
-    if (!list.length(size))
-        return;
-
-    for (size_t i = 0; i &lt; size; ++i) {
-        String value;
-        if (list.get(i, value))
-            (constraint.*appendValue)(value);
-    }
-}
-
-static std::optional&lt;StringConstraint&gt; createStringConstraint(const Dictionary&amp; mediaTrackConstraintSet, const String&amp; name, MediaConstraintType type, ConstraintSetType constraintSetType)
-{
-    auto constraint = StringConstraint(name, type);
-
-    // Dictionary constraint value.
-    Dictionary dictionaryValue;
-    if (mediaTrackConstraintSet.get(name, dictionaryValue) &amp;&amp; !dictionaryValue.isUndefinedOrNull()) {
-        ArrayValue exactArrayValue;
-        if (dictionaryValue.get(&quot;exact&quot;, exactArrayValue) &amp;&amp; !exactArrayValue.isUndefinedOrNull())
-            initializeStringConstraintWithList(constraint, &amp;StringConstraint::appendExact, exactArrayValue);
-        else {
-            String exactStringValue;
-            if (dictionaryValue.get(&quot;exact&quot;, exactStringValue))
-                constraint.setExact(exactStringValue);
-        }
-
-        ArrayValue idealArrayValue;
-        if (dictionaryValue.get(&quot;ideal&quot;, idealArrayValue) &amp;&amp; !idealArrayValue.isUndefinedOrNull())
-            initializeStringConstraintWithList(constraint, &amp;StringConstraint::appendIdeal, idealArrayValue);
-        else {
-            String idealStringValue;
-            if (!dictionaryValue.get(&quot;ideal&quot;, idealStringValue))
-                constraint.setIdeal(idealStringValue);
-        }
-
-        if (constraint.isEmpty()) {
-            LOG(Media, &quot;createStringConstraint() - ignoring string constraint '%s' with dictionary value since it has no valid or supported key/value pairs.&quot;, name.utf8().data());
-            return std::nullopt;
-        }
-        
-        return WTFMove(constraint);
-    }
-
-    // Array constraint value.
-    ArrayValue arrayValue;
-    if (mediaTrackConstraintSet.get(name, arrayValue) &amp;&amp; !arrayValue.isUndefinedOrNull()) {
-        initializeStringConstraintWithList(constraint, &amp;StringConstraint::appendIdeal, arrayValue);
-
-        if (constraint.isEmpty()) {
-            LOG(Media, &quot;createStringConstraint() - ignoring string constraint '%s' with array value since it is empty.&quot;, name.utf8().data());
-            return std::nullopt;
-        }
-
-        return WTFMove(constraint);
-    }
-
-    // Scalar constraint value.
-    String value;
-    if (mediaTrackConstraintSet.get(name, value)) {
-        if (constraintSetType == ConstraintSetType::Mandatory)
-            constraint.setIdeal(value);
-        else
-            constraint.setExact(value);
-        
-        return WTFMove(constraint);
-    }
-
-    // Invalid constraint value.
-    LOG(Media, &quot;createStringConstraint() - ignoring string constraint '%s' since it has neither a dictionary nor sequence nor scalar value.&quot;, name.utf8().data());
-    return std::nullopt;
-}
-
-static std::optional&lt;BooleanConstraint&gt; createBooleanConstraint(const Dictionary&amp; mediaTrackConstraintSet, const String&amp; name, MediaConstraintType type, ConstraintSetType constraintSetType)
-{
-    auto constraint = BooleanConstraint(name, type);
-
-    // Dictionary constraint value.
-    Dictionary dictionaryValue;
-    if (mediaTrackConstraintSet.get(name, dictionaryValue) &amp;&amp; !dictionaryValue.isUndefinedOrNull()) {
-        bool exactValue;
-        if (dictionaryValue.get(&quot;exact&quot;, exactValue))
-            constraint.setExact(exactValue);
-
-        bool idealValue;
-        if (dictionaryValue.get(&quot;ideal&quot;, idealValue))
-            constraint.setIdeal(idealValue);
-
-        if (constraint.isEmpty()) {
-            LOG(Media, &quot;createBooleanConstraint() - ignoring boolean constraint '%s' with dictionary value since it has no valid or supported key/value pairs.&quot;, name.utf8().data());
-            return std::nullopt;
-        }
-
-        return WTFMove(constraint);
-    }
-
-    // Scalar constraint value.
-    bool value;
-    if (mediaTrackConstraintSet.get(name, value)) {
-        if (constraintSetType == ConstraintSetType::Mandatory)
-            constraint.setIdeal(value);
-        else
-            constraint.setExact(value);
-        
-        return WTFMove(constraint);
-    }
-
-    // Invalid constraint value.
-    LOG(Media, &quot;createBooleanConstraint() - ignoring boolean constraint '%s' since it has neither a dictionary nor scalar value.&quot;, name.utf8().data());
-    return std::nullopt;
-}
-
-static std::optional&lt;DoubleConstraint&gt; createDoubleConstraint(const Dictionary&amp; mediaTrackConstraintSet, const String&amp; name, MediaConstraintType type, ConstraintSetType constraintSetType)
-{
-    auto constraint = DoubleConstraint(name, type);
-
-    // Dictionary constraint value.
-    Dictionary dictionaryValue;
-    if (mediaTrackConstraintSet.get(name, dictionaryValue) &amp;&amp; !dictionaryValue.isUndefinedOrNull()) {
-        double minValue;
-        if (dictionaryValue.get(&quot;min&quot;, minValue))
-            constraint.setMin(minValue);
-
-        double maxValue;
-        if (dictionaryValue.get(&quot;max&quot;, maxValue))
-            constraint.setMax(maxValue);
-
-        double exactValue;
-        if (dictionaryValue.get(&quot;exact&quot;, exactValue))
-            constraint.setExact(exactValue);
-
-        double idealValue;
-        if (dictionaryValue.get(&quot;ideal&quot;, idealValue))
-            constraint.setIdeal(idealValue);
-
-        if (constraint.isEmpty()) {
-            LOG(Media, &quot;createDoubleConstraint() - ignoring double constraint '%s' with dictionary value since it has no valid or supported key/value pairs.&quot;, name.utf8().data());
-            return std::nullopt;
-        }
-
-        return WTFMove(constraint);
-    }
-
-    // Scalar constraint value.
-    double value;
-    if (mediaTrackConstraintSet.get(name, value)) {
-        if (constraintSetType == ConstraintSetType::Mandatory)
-            constraint.setIdeal(value);
-        else
-            constraint.setExact(value);
-        
-        return WTFMove(constraint);
-    }
-
-    // Invalid constraint value.
-    LOG(Media, &quot;createDoubleConstraint() - ignoring double constraint '%s' since it has neither a dictionary nor scalar value.&quot;, name.utf8().data());
-    return std::nullopt;
-}
-
-static std::optional&lt;IntConstraint&gt; createIntConstraint(const Dictionary&amp; mediaTrackConstraintSet, const String&amp; name, MediaConstraintType type, ConstraintSetType constraintSetType)
-{
-    auto constraint = IntConstraint(name, type);
-
-    // Dictionary constraint value.
-    Dictionary dictionaryValue;
-    if (mediaTrackConstraintSet.get(name, dictionaryValue) &amp;&amp; !dictionaryValue.isUndefinedOrNull()) {
-        int minValue;
-        if (dictionaryValue.get(&quot;min&quot;, minValue))
-            constraint.setMin(minValue);
-
-        int maxValue;
-        if (dictionaryValue.get(&quot;max&quot;, maxValue))
-            constraint.setMax(maxValue);
-
-        int exactValue;
-        if (dictionaryValue.get(&quot;exact&quot;, exactValue))
-            constraint.setExact(exactValue);
-
-        int idealValue;
-        if (dictionaryValue.get(&quot;ideal&quot;, idealValue))
-            constraint.setIdeal(idealValue);
-
-        if (constraint.isEmpty()) {
-            LOG(Media, &quot;createIntConstraint() - ignoring long constraint '%s' with dictionary value since it has no valid or supported key/value pairs.&quot;, name.utf8().data());
-            return std::nullopt;
-        }
-
-        return WTFMove(constraint);
-    }
-
-    // Scalar constraint value.
-    int value;
-    if (mediaTrackConstraintSet.get(name, value)) {
-        if (constraintSetType == ConstraintSetType::Mandatory)
-            constraint.setIdeal(value);
-        else
-            constraint.setExact(value);
-        
-        return WTFMove(constraint);
-    }
-
-    // Invalid constraint value.
-    LOG(Media, &quot;createIntConstraint() - ignoring long constraint '%s' since it has neither a dictionary nor scalar value.&quot;, name.utf8().data());
-    return std::nullopt;
-}
-
-static void parseMediaTrackConstraintSetForKey(const Dictionary&amp; mediaTrackConstraintSet, const String&amp; name, MediaTrackConstraintSetMap&amp; map, ConstraintSetType constraintSetType)
-{
-    MediaConstraintType constraintType = RealtimeMediaSourceSupportedConstraints::constraintFromName(name);
-    switch (constraintType) {
-    case MediaConstraintType::Width:
-        map.set(constraintType, createIntConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-    case MediaConstraintType::Height:
-        map.set(constraintType, createIntConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-    case MediaConstraintType::SampleRate:
-        map.set(constraintType, createIntConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-    case MediaConstraintType::SampleSize:
-        map.set(constraintType, createIntConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-
-    case MediaConstraintType::AspectRatio:
-        map.set(constraintType, createDoubleConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-    case MediaConstraintType::FrameRate:
-        map.set(constraintType, createDoubleConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-    case MediaConstraintType::Volume:
-        map.set(constraintType, createDoubleConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-
-    case MediaConstraintType::EchoCancellation:
-        map.set(constraintType, createBooleanConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-
-    case MediaConstraintType::FacingMode:
-        map.set(constraintType, createStringConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-    case MediaConstraintType::DeviceId:
-        map.set(constraintType, createStringConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-    case MediaConstraintType::GroupId:
-        map.set(constraintType, createStringConstraint(mediaTrackConstraintSet, name, constraintType, constraintSetType));
-        break;
-
-    case MediaConstraintType::Unknown:
-        LOG(Media, &quot;parseMediaTrackConstraintSetForKey() - ignoring unsupported constraint '%s'.&quot;, name.utf8().data());
-        return;
-    }
-}
-
-static void parseAdvancedConstraints(const Dictionary&amp; mediaTrackConstraints, Vector&lt;MediaTrackConstraintSetMap&gt;&amp; advancedConstraints)
-{
-    ArrayValue sequenceOfMediaTrackConstraintSets;
-    if (!mediaTrackConstraints.get(&quot;advanced&quot;, sequenceOfMediaTrackConstraintSets) || sequenceOfMediaTrackConstraintSets.isUndefinedOrNull()) {
-        LOG(Media, &quot;parseAdvancedConstraints() - value of advanced key is not a list.&quot;);
-        return;
-    }
-
-    size_t numberOfConstraintSets;
-    if (!sequenceOfMediaTrackConstraintSets.length(numberOfConstraintSets)) {
-        LOG(Media, &quot;parseAdvancedConstraints() - ignoring empty advanced sequence of MediaTrackConstraintSets.&quot;);
-        return;
-    }
-
-    for (size_t i = 0; i &lt; numberOfConstraintSets; ++i) {
-        Dictionary mediaTrackConstraintSet;
-        if (!sequenceOfMediaTrackConstraintSets.get(i, mediaTrackConstraintSet) || mediaTrackConstraintSet.isUndefinedOrNull()) {
-            LOG(Media, &quot;parseAdvancedConstraints() - ignoring constraint set with index '%zu' in advanced list.&quot;, i);
-            continue;
-        }
-
-        MediaTrackConstraintSetMap map;
-
-        Vector&lt;String&gt; localKeys;
-        mediaTrackConstraintSet.getOwnPropertyNames(localKeys);
-        for (auto&amp; localKey : localKeys)
-            parseMediaTrackConstraintSetForKey(mediaTrackConstraintSet, localKey, map, ConstraintSetType::Advanced);
-
-        if (!map.isEmpty())
-            advancedConstraints.append(WTFMove(map));
-    }
-}
-
-void parseMediaConstraintsDictionary(const Dictionary&amp; mediaTrackConstraints, MediaTrackConstraintSetMap&amp; mandatoryConstraints, Vector&lt;MediaTrackConstraintSetMap&gt;&amp; advancedConstraints)
-{
-    if (mediaTrackConstraints.isUndefinedOrNull())
-        return;
-
-    Vector&lt;String&gt; keys;
-    mediaTrackConstraints.getOwnPropertyNames(keys);
-
-    for (auto&amp; key : keys) {
-        if (key == &quot;advanced&quot;)
-            parseAdvancedConstraints(mediaTrackConstraints, advancedConstraints);
-        else
-            parseMediaTrackConstraintSetForKey(mediaTrackConstraints, key, mandatoryConstraints, ConstraintSetType::Mandatory);
-    }
-}
-
-static void JSMediaDevicesGetUserMediaPromiseFunction(ExecState&amp; state, Ref&lt;DeferredPromise&gt;&amp;&amp; promise)
-{
-    VM&amp; vm = state.vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    if (UNLIKELY(state.argumentCount() &lt; 1)) {
-        throwVMError(&amp;state, scope, createNotEnoughArgumentsError(&amp;state));
-        return;
-    }
-
-    auto constraintsDictionary = Dictionary(&amp;state, state.uncheckedArgument(0));
-
-    MediaTrackConstraintSetMap mandatoryAudioConstraints;
-    Vector&lt;MediaTrackConstraintSetMap&gt; advancedAudioConstraints;
-    bool areAudioConstraintsValid = false;
-
-    Dictionary audioConstraintsDictionary;
-    if (constraintsDictionary.get(&quot;audio&quot;, audioConstraintsDictionary) &amp;&amp; !audioConstraintsDictionary.isUndefinedOrNull()) {
-        parseMediaConstraintsDictionary(audioConstraintsDictionary, mandatoryAudioConstraints, advancedAudioConstraints);
-        areAudioConstraintsValid = true;
-    } else
-        constraintsDictionary.get(&quot;audio&quot;, areAudioConstraintsValid);
-
-    MediaTrackConstraintSetMap mandatoryVideoConstraints;
-    Vector&lt;MediaTrackConstraintSetMap&gt; advancedVideoConstraints;
-    bool areVideoConstraintsValid = false;
-
-    Dictionary videoConstraintsDictionary;
-    if (constraintsDictionary.get(&quot;video&quot;, videoConstraintsDictionary) &amp;&amp; !videoConstraintsDictionary.isUndefinedOrNull()) {
-        parseMediaConstraintsDictionary(videoConstraintsDictionary, mandatoryVideoConstraints, advancedVideoConstraints);
-        areVideoConstraintsValid = true;
-    } else
-        constraintsDictionary.get(&quot;video&quot;, areVideoConstraintsValid);
-
-    auto audioConstraints = MediaConstraintsImpl::create(WTFMove(mandatoryAudioConstraints), WTFMove(advancedAudioConstraints), areAudioConstraintsValid);
-    auto videoConstraints = MediaConstraintsImpl::create(WTFMove(mandatoryVideoConstraints), WTFMove(advancedVideoConstraints), areVideoConstraintsValid);
-    propagateException(state, scope, castThisValue&lt;JSMediaDevices&gt;(state).wrapped().getUserMedia(WTFMove(audioConstraints), WTFMove(videoConstraints), WTFMove(promise)));
-}
-
-JSValue JSMediaDevices::getUserMedia(ExecState&amp; state)
-{
-    return callPromiseFunction&lt;JSMediaDevicesGetUserMediaPromiseFunction, PromiseExecutionScope::WindowOnly&gt;(state);
-}
-
-}
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMediaDevicesCustomh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/JSMediaDevicesCustom.h (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMediaDevicesCustom.h        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/bindings/js/JSMediaDevicesCustom.h        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -1,41 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(MEDIA_STREAM)
-
-#include &quot;MediaConstraints.h&quot;
-#include &lt;wtf/Vector.h&gt;
-
-namespace WebCore {
-
-class Dictionary;
-
-void parseMediaConstraintsDictionary(const Dictionary&amp;, MediaTrackConstraintSetMap&amp;, Vector&lt;MediaTrackConstraintSetMap&gt;&amp;);
-
-}
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMediaStreamTrackCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSMediaStreamTrackCustom.cpp (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMediaStreamTrackCustom.cpp        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/bindings/js/JSMediaStreamTrackCustom.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -31,8 +31,6 @@
</span><span class="cx"> #include &quot;Dictionary.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><del>-#include &quot;JSMediaDevicesCustom.h&quot;
-#include &quot;MediaConstraintsImpl.h&quot;
</del><span class="cx"> #include &quot;MediaSourceSettings.h&quot;
</span><span class="cx"> #include &quot;MediaStreamTrack.h&quot;
</span><span class="cx"> #include &quot;WebCoreJSClientData.h&quot;
</span><span class="lines">@@ -166,40 +164,6 @@
</span><span class="cx">     return object;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSValue JSMediaStreamTrack::applyConstraints(ExecState&amp; state)
-{
-    MediaTrackConstraintSetMap mandatoryConstraints;
-    Vector&lt;MediaTrackConstraintSetMap&gt; advancedConstraints;
-    bool valid = false;
-
-    if (state.argumentCount() &gt;= 1) {
-        JSValue argument = state.uncheckedArgument(0);
-
-        JSVMClientData&amp; clientData = *static_cast&lt;JSVMClientData*&gt;(state.vm().clientData);
-        putDirect(state.vm(), clientData.builtinNames().mediaStreamTrackConstraintsPrivateName(), argument, DontEnum);
-
-        auto constraintsDictionary = Dictionary(&amp;state, argument);
-        if (!constraintsDictionary.isUndefinedOrNull())
-            parseMediaConstraintsDictionary(constraintsDictionary, mandatoryConstraints, advancedConstraints);
-        valid = !advancedConstraints.isEmpty() || !mandatoryConstraints.isEmpty();
-    }
-
-    auto deferredPromise = createDeferredPromise(state, domWindow());
-    auto promise = deferredPromise-&gt;promise();
-
-    auto constraints = MediaConstraintsImpl::create(WTFMove(mandatoryConstraints), WTFMove(advancedConstraints), valid);
-    wrapped().applyConstraints(WTFMove(constraints), WTFMove(deferredPromise));
-
-    return promise;
-}
-
-JSValue JSMediaStreamTrack::getConstraints(ExecState&amp; state)
-{
-    JSVMClientData&amp; clientData = *static_cast&lt;JSVMClientData*&gt;(state.vm().clientData);
-    JSValue result = getDirect(state.vm(), clientData.builtinNames().mediaStreamTrackConstraintsPrivateName());
-    return !result.isEmpty() ? result : jsUndefined();
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> use strict;
</span><span class="cx"> 
</span><ins>+use File::Basename;
</ins><span class="cx"> use File::Find;
</span><span class="cx"> use Carp qw&lt;longmess&gt;;
</span><span class="cx"> use Data::Dumper;
</span><span class="lines">@@ -203,11 +204,24 @@
</span><span class="cx"> 
</span><span class="cx">     my $dictionaries = $useDocument-&gt;dictionaries;
</span><span class="cx">     if (@$dictionaries) {
</span><del>-        die &quot;Multiple standalone dictionaries per document are not supported&quot; if @$dictionaries &gt; 1;
</del><ins>+        my $dictionary;
+        my $otherDictionaries;
+        if (@$dictionaries == 1) {
+            $dictionary = @$dictionaries[0];
+        } else {
+            my $primaryDictionaryName = fileparse($targetIdlFilePath, &quot;.idl&quot;);
+            for my $candidate (@$dictionaries) {
+                if ($candidate-&gt;type-&gt;name eq $primaryDictionaryName) {
+                    $dictionary = $candidate;
+                } else {
+                    push @$otherDictionaries, $candidate;
+                }
+            }
+            die &quot;Multiple dictionaries per document are only supported if one matches the filename&quot; unless $dictionary;
+        }
</ins><span class="cx"> 
</span><del>-        my $dictionary = @$dictionaries[0];
</del><span class="cx">         print &quot;Generating $useGenerator bindings code for IDL dictionary \&quot;&quot; . $dictionary-&gt;type-&gt;name . &quot;\&quot;...\n&quot; if $verbose;
</span><del>-        $codeGenerator-&gt;GenerateDictionary($dictionary, $useDocument-&gt;enumerations);
</del><ins>+        $codeGenerator-&gt;GenerateDictionary($dictionary, $useDocument-&gt;enumerations, $otherDictionaries);
</ins><span class="cx">         $codeGenerator-&gt;WriteData($dictionary, $useOutputDir, $useOutputHeadersDir);
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -50,7 +50,6 @@
</span><span class="cx"> my %implIncludes = ();
</span><span class="cx"> my @depsContent = ();
</span><span class="cx"> my $numCachedAttributes = 0;
</span><del>-my $currentCachedAttribute = 0;
</del><span class="cx"> 
</span><span class="cx"> my $beginAppleCopyrightForHeaderFiles = &lt;&lt;END;
</span><span class="cx"> // ------- Begin Apple Copyright -------
</span><span class="lines">@@ -143,11 +142,11 @@
</span><span class="cx"> 
</span><span class="cx"> sub GenerateDictionary
</span><span class="cx"> {
</span><del>-    my ($object, $dictionary, $enumerations) = @_;
</del><ins>+    my ($object, $dictionary, $enumerations, $otherDictionaries) = @_;
</ins><span class="cx"> 
</span><span class="cx">     my $className = GetDictionaryClassName($dictionary-&gt;type);
</span><del>-    $object-&gt;GenerateDictionaryHeader($dictionary, $className, $enumerations);
-    $object-&gt;GenerateDictionaryImplementation($dictionary, $className, $enumerations);
</del><ins>+    $object-&gt;GenerateDictionaryHeader($dictionary, $className, $enumerations, $otherDictionaries);
+    $object-&gt;GenerateDictionaryImplementation($dictionary, $className, $enumerations, $otherDictionaries);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub GenerateCallbackFunction
</span><span class="lines">@@ -1224,7 +1223,7 @@
</span><span class="cx"> 
</span><span class="cx">     my $result = &quot;&quot;;
</span><span class="cx">     foreach my $dictionary (@$allDictionaries) {
</span><del>-        $headerIncludes{$interface-&gt;type-&gt;name . &quot;.h&quot;} = 1;
</del><ins>+        $headerIncludes{$interface-&gt;type-&gt;name . &quot;.h&quot;} = 1 if $interface;
</ins><span class="cx">         my $className = GetDictionaryClassName($dictionary-&gt;type, $interface);
</span><span class="cx">         my $conditionalString = $codeGenerator-&gt;GenerateConditionalString($dictionary);
</span><span class="cx">         $result .= GenerateDictionaryHeaderContent($dictionary, $className, $conditionalString);
</span><span class="lines">@@ -3398,10 +3397,7 @@
</span><span class="cx">                     push(@implContent, &quot;    return JS&quot; . $constructorType . &quot;::getConstructor(state.vm(), thisObject.globalObject());\n&quot;);
</span><span class="cx">                 }
</span><span class="cx">             } else {
</span><del>-                my $cacheIndex = 0;
</del><span class="cx">                 if ($attribute-&gt;extendedAttributes-&gt;{CachedAttribute}) {
</span><del>-                    $cacheIndex = $currentCachedAttribute;
-                    $currentCachedAttribute++;
</del><span class="cx">                     push(@implContent, &quot;    if (JSValue cachedValue = thisObject.m_&quot; . $attribute-&gt;name . &quot;.get())\n&quot;);
</span><span class="cx">                     push(@implContent, &quot;        return cachedValue;\n&quot;);
</span><span class="cx">                 }
</span><span class="lines">@@ -4537,7 +4533,7 @@
</span><span class="cx"> 
</span><span class="cx"> sub GenerateDictionaryHeader
</span><span class="cx"> {
</span><del>-    my ($object, $dictionary, $className, $enumerations) = @_;
</del><ins>+    my ($object, $dictionary, $className, $enumerations, $otherDictionaries) = @_;
</ins><span class="cx"> 
</span><span class="cx">     # - Add default header template and header protection.
</span><span class="cx">     push(@headerContentHeader, GenerateHeaderContentHeader($dictionary));
</span><span class="lines">@@ -4548,6 +4544,7 @@
</span><span class="cx">     push(@headerContent, &quot;\nnamespace WebCore {\n\n&quot;);
</span><span class="cx">     push(@headerContent, GenerateDictionaryHeaderContent($dictionary, $className));
</span><span class="cx">     push(@headerContent, GenerateEnumerationsHeaderContent($dictionary, $enumerations));
</span><ins>+    push(@headerContent, GenerateDictionariesHeaderContent(undef, $otherDictionaries)) if $otherDictionaries;
</ins><span class="cx">     push(@headerContent, &quot;} // namespace WebCore\n&quot;);
</span><span class="cx"> 
</span><span class="cx">     my $conditionalString = $codeGenerator-&gt;GenerateConditionalString($dictionary);
</span><span class="lines">@@ -4570,7 +4567,7 @@
</span><span class="cx"> 
</span><span class="cx"> sub GenerateDictionaryImplementation
</span><span class="cx"> {
</span><del>-    my ($object, $dictionary, $className, $enumerations) = @_;
</del><ins>+    my ($object, $dictionary, $className, $enumerations, $otherDictionaries) = @_;
</ins><span class="cx"> 
</span><span class="cx">     # - Add default header template
</span><span class="cx">     push(@implContentHeader, GenerateImplementationContentHeader($dictionary));
</span><span class="lines">@@ -4577,8 +4574,9 @@
</span><span class="cx"> 
</span><span class="cx">     push(@implContent, &quot;\nusing namespace JSC;\n\n&quot;);
</span><span class="cx">     push(@implContent, &quot;namespace WebCore {\n\n&quot;);
</span><ins>+    push(@implContent, GenerateDictionaryImplementationContent($dictionary, $className));
</ins><span class="cx">     push(@implContent, GenerateEnumerationsImplementationContent($dictionary, $enumerations));
</span><del>-    push(@implContent, GenerateDictionaryImplementationContent($dictionary, $className));
</del><ins>+    push(@implContent, GenerateDictionariesImplementationContent(undef, $otherDictionaries)) if $otherDictionaries;
</ins><span class="cx">     push(@implContent, &quot;} // namespace WebCore\n&quot;);
</span><span class="cx"> 
</span><span class="cx">     my $conditionalString = $codeGenerator-&gt;GenerateConditionalString($dictionary);
</span><span class="lines">@@ -5603,10 +5601,9 @@
</span><span class="cx">     my $outputDir = shift;
</span><span class="cx"> 
</span><span class="cx">     my $name = $interface-&gt;type-&gt;name;
</span><del>-    my $prefix = FileNamePrefix;
-    my $headerFileName = &quot;$outputDir/$prefix$name.h&quot;;
-    my $implFileName = &quot;$outputDir/$prefix$name.cpp&quot;;
-    my $depsFileName = &quot;$outputDir/$prefix$name.dep&quot;;
</del><ins>+    my $headerFileName = &quot;$outputDir/JS$name.h&quot;;
+    my $implFileName = &quot;$outputDir/JS$name.cpp&quot;;
+    my $depsFileName = &quot;$outputDir/JS$name.dep&quot;;
</ins><span class="cx"> 
</span><span class="cx">     # Update a .cpp file if the contents are changed.
</span><span class="cx">     my $contents = join &quot;&quot;, @implContentHeader;
</span><span class="lines">@@ -5659,7 +5656,7 @@
</span><span class="cx">     }
</span><span class="cx">     foreach my $include (sort @includes) {
</span><span class="cx">         # &quot;JSClassName.h&quot; is already included right after config.h.
</span><del>-        next if $include eq &quot;\&quot;$prefix$name.h\&quot;&quot;;
</del><ins>+        next if $include eq &quot;\&quot;JS$name.h\&quot;&quot;;
</ins><span class="cx">         $contents .= &quot;#include $include\n&quot;;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsgeneratebindingspl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/generate-bindings.pl (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/generate-bindings.pl        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/bindings/scripts/generate-bindings.pl        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> if ($verbose) {
</span><span class="cx">     print &quot;$generator: $targetIdlFile\n&quot;;
</span><span class="cx"> }
</span><del>-my $targetInterfaceName = fileparse(basename($targetIdlFile), &quot;.idl&quot;);
</del><ins>+my $targetInterfaceName = fileparse($targetIdlFile, &quot;.idl&quot;);
</ins><span class="cx"> 
</span><span class="cx"> my $idlFound = 0;
</span><span class="cx"> my @supplementedIdlFiles;
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx">     open FH, &quot;&lt; $supplementalDependencyFile&quot; or die &quot;Cannot open $supplementalDependencyFile\n&quot;;
</span><span class="cx">     while (my $line = &lt;FH&gt;) {
</span><span class="cx">         my ($idlFile, @followingIdlFiles) = split(/\s+/, $line);
</span><del>-        if ($idlFile and basename($idlFile) eq basename($targetIdlFile)) {
</del><ins>+        if ($idlFile and fileparse($idlFile) eq fileparse($targetIdlFile)) {
</ins><span class="cx">             $idlFound = 1;
</span><span class="cx">             @supplementedIdlFiles = sort @followingIdlFiles;
</span><span class="cx">         }
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">     # dependency file) but should generate .h and .cpp files.
</span><span class="cx">     if (!$idlFound and $additionalIdlFiles) {
</span><span class="cx">         my @idlFiles = shellwords($additionalIdlFiles);
</span><del>-        $idlFound = grep { $_ and basename($_) eq basename($targetIdlFile) } @idlFiles;
</del><ins>+        $idlFound = grep { $_ and fileparse($_) eq fileparse($targetIdlFile) } @idlFiles;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!$idlFound) {
</span><span class="lines">@@ -130,13 +130,13 @@
</span><span class="cx"> 
</span><span class="cx"> if ($idlAttributesFile) {
</span><span class="cx">     my $idlAttributes = loadIDLAttributes($idlAttributesFile);
</span><del>-    checkIDLAttributes($idlAttributes, $targetDocument, basename($targetIdlFile));
</del><ins>+    checkIDLAttributes($idlAttributes, $targetDocument, fileparse($targetIdlFile));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> foreach my $idlFile (@supplementedIdlFiles) {
</span><span class="cx">     next if $idlFile eq $targetIdlFile;
</span><span class="cx"> 
</span><del>-    my $interfaceName = fileparse(basename($idlFile), &quot;.idl&quot;);
</del><ins>+    my $interfaceName = fileparse($idlFile, &quot;.idl&quot;);
</ins><span class="cx">     my $parser = IDLParser-&gt;new(!$verbose);
</span><span class="cx">     my $document = $parser-&gt;Parse($idlFile, $defines, $preprocessor);
</span><span class="cx"> 
</span><span class="lines">@@ -271,7 +271,7 @@
</span><span class="cx">                 $idlAttributes{$name}{&quot;VALUE_IS_MISSING&quot;} = 1;
</span><span class="cx">             }
</span><span class="cx">         } else {
</span><del>-            die &quot;The format of &quot; . basename($idlAttributesFile) . &quot; is wrong: line $.\n&quot;;
</del><ins>+            die &quot;The format of &quot; . fileparse($idlAttributesFile) . &quot; is wrong: line $.\n&quot;;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     close FH;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaConstraintsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaConstraints.h (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaConstraints.h        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/platform/mediastream/MediaConstraints.h        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -29,18 +29,12 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef MediaConstraints_h
-#define MediaConstraints_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;RealtimeMediaSourceSupportedConstraints.h&quot;
</span><span class="cx"> #include &lt;cstdlib&gt;
</span><del>-#include &lt;wtf/HashMap.h&gt;
-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/Variant.h&gt;
-#include &lt;wtf/text/StringHash.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">@@ -495,7 +489,6 @@
</span><span class="cx"> 
</span><span class="cx">     void appendExact(const String&amp; value)
</span><span class="cx">     {
</span><del>-        m_exact.clear();
</del><span class="cx">         m_exact.append(value);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -813,5 +806,3 @@
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_MEDIACONSTRAINT(BooleanConstraint, isBoolean())
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span><del>-
-#endif // MediaConstraints_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -130,7 +130,6 @@
</span><span class="cx">     auto clonedMediaStreamTrackPrivate = create(m_source.copyRef());
</span><span class="cx">     clonedMediaStreamTrackPrivate-&gt;m_isEnabled = this-&gt;m_isEnabled;
</span><span class="cx">     clonedMediaStreamTrackPrivate-&gt;m_isEnded = this-&gt;m_isEnded;
</span><del>-    clonedMediaStreamTrackPrivate-&gt;m_constraints = this-&gt;m_constraints;
</del><span class="cx"> 
</span><span class="cx">     return clonedMediaStreamTrackPrivate;
</span><span class="cx"> }
</span><span class="lines">@@ -140,11 +139,6 @@
</span><span class="cx">     return m_source-&gt;type();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;MediaConstraints&gt; MediaStreamTrackPrivate::constraints() const
-{
-    return m_constraints;
-}
-
</del><span class="cx"> const RealtimeMediaSourceSettings&amp; MediaStreamTrackPrivate::settings() const
</span><span class="cx"> {
</span><span class="cx">     return m_source-&gt;settings();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmediastreamMediaStreamTrackPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -24,14 +24,11 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef MediaStreamTrackPrivate_h
-#define MediaStreamTrackPrivate_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(MEDIA_STREAM)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;RealtimeMediaSource.h&quot;
</span><del>-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/text/AtomicString.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -90,7 +87,6 @@
</span><span class="cx">     const RealtimeMediaSourceSettings&amp; settings() const;
</span><span class="cx">     RefPtr&lt;RealtimeMediaSourceCapabilities&gt; capabilities() const;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;MediaConstraints&gt; constraints() const;
</del><span class="cx">     void applyConstraints(const MediaConstraints&amp;, RealtimeMediaSource::SuccessHandler, RealtimeMediaSource::FailureHandler);
</span><span class="cx"> 
</span><span class="cx">     AudioSourceProvider* audioSourceProvider();
</span><span class="lines">@@ -110,7 +106,6 @@
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;Observer*&gt; m_observers;
</span><span class="cx">     Ref&lt;RealtimeMediaSource&gt; m_source;
</span><del>-    RefPtr&lt;MediaConstraints&gt; m_constraints;
</del><span class="cx">     RefPtr&lt;RealtimeMediaSourcePreview&gt; m_preview;
</span><span class="cx"> 
</span><span class="cx">     String m_id;
</span><span class="lines">@@ -123,5 +118,3 @@
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(MEDIA_STREAM)
</span><del>-
-#endif // MediaStreamTrackPrivate_h
</del></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebKit2/ChangeLog        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-12-15  Darin Adler  &lt;darin@apple.com&gt;
+
+        Remove custom binding for MediaDevices
+        https://bugs.webkit.org/show_bug.cgi?id=165894
+
+        Reviewed by Eric Carlson.
+
+        * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
+        Added include of MediaConstraintsImpl.h, now needed because we
+        removed some unneeded includes from the WebCore headers.
+
</ins><span class="cx"> 2016-12-15  Dave Hyatt  &lt;hyatt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Parser] Enable CSS Deferred Parsing
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessMediaStreamUserMediaPermissionRequestManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp (209863 => 209864)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp        2016-12-15 16:53:38 UTC (rev 209863)
+++ trunk/Source/WebKit2/WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp        2016-12-15 17:25:53 UTC (rev 209864)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &lt;WebCore/Document.h&gt;
</span><span class="cx"> #include &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #include &lt;WebCore/FrameLoader.h&gt;
</span><ins>+#include &lt;WebCore/MediaConstraintsImpl.h&gt;
</ins><span class="cx"> #include &lt;WebCore/SecurityOrigin.h&gt;
</span><span class="cx"> #include &lt;WebCore/SecurityOriginData.h&gt;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>