<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - WebRTC: Implement MediaEndpointPeerConnection::createOffer()"
   href="https://bugs.webkit.org/show_bug.cgi?id=154867#c8">Comment # 8</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - WebRTC: Implement MediaEndpointPeerConnection::createOffer()"
   href="https://bugs.webkit.org/show_bug.cgi?id=154867">bug 154867</a>
              from <span class="vcard"><a class="email" href="mailto:jer.noble&#64;apple.com" title="Jer Noble &lt;jer.noble&#64;apple.com&gt;"> <span class="fn">Jer Noble</span></a>
</span></b>
        <pre>Comment on <span class="bz_obsolete"><a href="attachment.cgi?id=272580&amp;action=diff" name="attach_272580" title="Proposed patch">attachment 272580</a> <a href="attachment.cgi?id=272580&amp;action=edit" title="Proposed patch">[details]</a></span>
Proposed patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=272580&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=272580&amp;action=review</a>

<span class="quote">&gt; Source/WebCore/Modules/mediastream/SDPProcessor.cpp:74
&gt; +    candidateObject-&gt;setString(ASCIILiteral(&quot;type&quot;), candidate.type());
&gt; +    candidateObject-&gt;setString(ASCIILiteral(&quot;foundation&quot;), candidate.foundation());
&gt; +    candidateObject-&gt;setInteger(ASCIILiteral(&quot;componentId&quot;), candidate.componentId());
&gt; +    candidateObject-&gt;setString(ASCIILiteral(&quot;transport&quot;), candidate.transport());
&gt; +    candidateObject-&gt;setInteger(ASCIILiteral(&quot;priority&quot;), candidate.priority());
&gt; +    candidateObject-&gt;setString(ASCIILiteral(&quot;address&quot;), candidate.address());
&gt; +    candidateObject-&gt;setInteger(ASCIILiteral(&quot;port&quot;), candidate.port());
&gt; +    if (!candidate.tcpType().isEmpty())
&gt; +        candidateObject-&gt;setString(ASCIILiteral(&quot;tcpType&quot;), candidate.tcpType());
&gt; +    if (candidate.type().convertToASCIIUppercase() != &quot;HOST&quot;) {
&gt; +        candidateObject-&gt;setString(ASCIILiteral(&quot;relatedAddress&quot;), candidate.relatedAddress());
&gt; +        candidateObject-&gt;setInteger(ASCIILiteral(&quot;relatedPort&quot;), candidate.relatedPort());
&gt; +    }</span >

It seems like a shame to have to create so many temporary String objects just for the sake of passing through to the InspectorObject here (and later in createCandidate).  Could you just use some static methods returning NeverDestroyed&lt;String&gt; objects? E.g.:

static const String&amp; typeString()
{
    static NeverDestroyed&lt;const String&gt; type { ASCIILiteral(&quot;type&quot;) };
    return type;
}

<span class="quote">&gt; Source/WebCore/Modules/mediastream/SDPProcessor.cpp:86
&gt; +    if (candidateObject.getString(ASCIILiteral(&quot;type&quot;), stringValue))
&gt; +        candidate-&gt;setType(stringValue);</span >

Ditto.

<span class="quote">&gt; Source/WebCore/Modules/mediastream/SDPProcessor.cpp:153
&gt; +        if (mdescObject-&gt;getString(ASCIILiteral(&quot;type&quot;), stringValue))
&gt; +            mdesc-&gt;setType(stringValue);</span >

Ditto.

<span class="quote">&gt; Source/WebCore/Modules/mediastream/SDPProcessor.cpp:299
&gt; +    for (const RefPtr&lt;PeerMediaDescription&gt;&amp; mdesc : configuration.mediaDescriptions()) {</span >

&quot;mdesc&quot; is not a very, ahem, descriptive name. &quot;description&quot;?

<span class="quote">&gt; Source/WebCore/Modules/mediastream/SDPProcessor.cpp:300
&gt; +        RefPtr&lt;InspectorObject&gt; mdescObject = InspectorObject::create();</span >

Same for &quot;mdescObject&quot;.

<span class="quote">&gt; Source/WebCore/platform/mediastream/gtk/SDPProcessorScriptResourceGtk.cpp:45
&gt; +String scriptString()
&gt; +{
&gt; +    return String(sdpJavaScript);
&gt; +}</span >

This should probably return a const String&amp;, and store it locally in a &quot;static NeverDestroyed&lt;const String&gt;&quot;.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>