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

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

<h3>Log Message</h3>
<pre>Use enum class instead of string-based enums in RTC code
https://bugs.webkit.org/show_bug.cgi?id=157242

Reviewed by Alex Christensen.

* Modules/mediastream/RTCConfiguration.cpp:
(WebCore::RTCConfiguration::RTCConfiguration): Don't initialize members here,
do it in the header instead.
(WebCore::RTCConfiguration::initialize): Initialize data members to enum values,
not strings.

* Modules/mediastream/RTCConfiguration.h: Tried to keep this class compiling.
Added the new enum class, and changed to use that instead of strings. But note,
this should not even be a class. Needs to become a dictionary.

* Modules/mediastream/RTCConfiguration.idl: Updated the names and values of the
enums to match the current RTC specification. Again, as I said, this should be
a dictionary, not an interface.

* bindings/scripts/CodeGenerator.pm: Removed the RTC enumerations from the list
of string-based enums.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamRTCConfigurationcpp">trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamRTCConfigurationh">trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediastreamRTCConfigurationidl">trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.idl</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200303 => 200304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-01 14:09:27 UTC (rev 200303)
+++ trunk/Source/WebCore/ChangeLog        2016-05-01 16:37:04 UTC (rev 200304)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-05-01  Darin Adler  &lt;darin@apple.com&gt;
+
+        Use enum class instead of string-based enums in RTC code
+        https://bugs.webkit.org/show_bug.cgi?id=157242
+
+        Reviewed by Alex Christensen.
+
+        * Modules/mediastream/RTCConfiguration.cpp:
+        (WebCore::RTCConfiguration::RTCConfiguration): Don't initialize members here,
+        do it in the header instead.
+        (WebCore::RTCConfiguration::initialize): Initialize data members to enum values,
+        not strings.
+
+        * Modules/mediastream/RTCConfiguration.h: Tried to keep this class compiling.
+        Added the new enum class, and changed to use that instead of strings. But note,
+        this should not even be a class. Needs to become a dictionary.
+
+        * Modules/mediastream/RTCConfiguration.idl: Updated the names and values of the
+        enums to match the current RTC specification. Again, as I said, this should be
+        a dictionary, not an interface.
+
+        * bindings/scripts/CodeGenerator.pm: Removed the RTC enumerations from the list
+        of string-based enums.
+
</ins><span class="cx"> 2016-04-30  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r199640): position:absolute generated content inherits text-decoration from its element
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamRTCConfigurationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.cpp (200303 => 200304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.cpp        2016-05-01 14:09:27 UTC (rev 200303)
+++ trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.cpp        2016-05-01 16:37:04 UTC (rev 200304)
</span><span class="lines">@@ -105,8 +105,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RTCConfiguration::RTCConfiguration()
</span><del>-    : m_iceTransportPolicy(&quot;all&quot;)
-    , m_bundlePolicy(&quot;balanced&quot;)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -143,8 +141,12 @@
</span><span class="cx"> 
</span><span class="cx">     String iceTransportPolicy;
</span><span class="cx">     if (configuration.get(&quot;iceTransportPolicy&quot;, iceTransportPolicy)) {
</span><del>-        if (iceTransportPolicy == &quot;none&quot; || iceTransportPolicy == &quot;relay&quot; || iceTransportPolicy == &quot;all&quot;)
-            m_iceTransportPolicy = iceTransportPolicy;
</del><ins>+        if (iceTransportPolicy == &quot;public&quot;)
+            m_iceTransportPolicy = RTCIceTransportPolicy::Public;
+        else if (iceTransportPolicy == &quot;relay&quot;)
+            m_iceTransportPolicy = RTCIceTransportPolicy::Relay;
+        else if (iceTransportPolicy == &quot;all&quot;)
+            m_iceTransportPolicy = RTCIceTransportPolicy::All;
</ins><span class="cx">         else {
</span><span class="cx">             ec = TypeError;
</span><span class="cx">             return;
</span><span class="lines">@@ -153,8 +155,12 @@
</span><span class="cx"> 
</span><span class="cx">     String bundlePolicy;
</span><span class="cx">     if (configuration.get(&quot;bundlePolicy&quot;, bundlePolicy)) {
</span><del>-        if (bundlePolicy == &quot;balanced&quot; || bundlePolicy == &quot;max-compat&quot; || bundlePolicy == &quot;max-bundle&quot;)
-            m_bundlePolicy = bundlePolicy;
</del><ins>+        if (bundlePolicy == &quot;balanced&quot;)
+            m_bundlePolicy = RTCBundlePolicy::Balanced;
+        else if (bundlePolicy == &quot;max-compat&quot;)
+            m_bundlePolicy = RTCBundlePolicy::MaxCompat;
+        else if (bundlePolicy == &quot;max-bundle&quot;)
+            m_bundlePolicy = RTCBundlePolicy::MaxBundle;
</ins><span class="cx">         else
</span><span class="cx">             ec = TypeError;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamRTCConfigurationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.h (200303 => 200304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.h        2016-05-01 14:09:27 UTC (rev 200303)
+++ trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.h        2016-05-01 16:37:04 UTC (rev 200304)
</span><span class="lines">@@ -45,13 +45,16 @@
</span><span class="cx"> 
</span><span class="cx"> typedef int ExceptionCode;
</span><span class="cx"> 
</span><ins>+enum class RTCBundlePolicy { Balanced, MaxCompat, MaxBundle };
+enum class RTCIceTransportPolicy { Public, Relay, All };
+
</ins><span class="cx"> class RTCConfiguration : public RefCounted&lt;RTCConfiguration&gt; {
</span><span class="cx"> public:
</span><span class="cx">     static RefPtr&lt;RTCConfiguration&gt; create(const Dictionary&amp; configuration, ExceptionCode&amp;);
</span><span class="cx">     virtual ~RTCConfiguration() { }
</span><span class="cx"> 
</span><del>-    const String&amp; iceTransportPolicy() const { return m_iceTransportPolicy; }
-    const String&amp; bundlePolicy() const { return m_bundlePolicy; }
</del><ins>+    RTCIceTransportPolicy iceTransportPolicy() const { return m_iceTransportPolicy; }
+    RTCBundlePolicy bundlePolicy() const { return m_bundlePolicy; }
</ins><span class="cx">     Vector&lt;RefPtr&lt;RTCIceServer&gt;&gt; iceServers() const { return m_iceServers; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -60,8 +63,8 @@
</span><span class="cx">     void initialize(const Dictionary&amp; configuration, ExceptionCode&amp;);
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;RefPtr&lt;RTCIceServer&gt;&gt; m_iceServers;
</span><del>-    String m_iceTransportPolicy;
-    String m_bundlePolicy;
</del><ins>+    RTCIceTransportPolicy m_iceTransportPolicy { RTCIceTransportPolicy::All };
+    RTCBundlePolicy m_bundlePolicy { RTCBundlePolicy::Balanced };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediastreamRTCConfigurationidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.idl (200303 => 200304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.idl        2016-05-01 14:09:27 UTC (rev 200303)
+++ trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.idl        2016-05-01 16:37:04 UTC (rev 200304)
</span><span class="lines">@@ -23,14 +23,14 @@
</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>-enum RTCIceTransportPolicyEnum { &quot;none&quot;, &quot;relay&quot;, &quot;all&quot; };
-enum RTCBundlePolicyEnum { &quot;balanced&quot;, &quot;max-compat&quot;, &quot;max-bundle&quot; };
</del><ins>+enum RTCIceTransportPolicy { &quot;public&quot;, &quot;relay&quot;, &quot;all&quot; };
+enum RTCBundlePolicy { &quot;balanced&quot;, &quot;max-compat&quot;, &quot;max-bundle&quot; };
</ins><span class="cx"> 
</span><span class="cx"> [
</span><span class="cx">     Conditional=WEB_RTC,
</span><span class="cx">     NoInterfaceObject,
</span><span class="cx"> ] interface RTCConfiguration {
</span><span class="cx">     readonly attribute RTCIceServer[] iceServers;
</span><del>-    readonly attribute RTCIceTransportPolicyEnum iceTransportPolicy;
-    readonly attribute RTCBundlePolicyEnum bundlePolicy;
</del><ins>+    readonly attribute RTCIceTransportPolicy iceTransportPolicy;
+    readonly attribute RTCBundlePolicy bundlePolicy;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (200303 => 200304)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-05-01 14:09:27 UTC (rev 200303)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-05-01 16:37:04 UTC (rev 200304)
</span><span class="lines">@@ -133,8 +133,6 @@
</span><span class="cx"> # enumeration to using an actual enum class in the C++. Once that is done, we should
</span><span class="cx"> # remove this hash and the function that calls it.
</span><span class="cx"> my %stringBasedEnumerationHash = (
</span><del>-    &quot;RTCBundlePolicyEnum&quot; =&gt; 1,
-    &quot;RTCIceTransportPolicyEnum&quot; =&gt; 1,
</del><span class="cx">     &quot;ReferrerPolicy&quot; =&gt; 1,
</span><span class="cx">     &quot;RequestCache&quot; =&gt; 1,
</span><span class="cx">     &quot;RequestCredentials&quot; =&gt; 1,
</span></span></pre>
</div>
</div>

</body>
</html>