<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#c11">Comment # 11</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:adam.bergkvist@ericsson.com" title="Adam Bergkvist <adam.bergkvist@ericsson.com>"> <span class="fn">Adam Bergkvist</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=154867#c8">comment #8</a>)
<span class="quote">> Comment on <span class="bz_obsolete"><a href="attachment.cgi?id=272580&action=diff" name="attach_272580" title="Proposed patch">attachment 272580</a> <a href="attachment.cgi?id=272580&action=edit" title="Proposed patch">[details]</a></span>
> Proposed patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=272580&action=review">https://bugs.webkit.org/attachment.cgi?id=272580&action=review</a></span >
Thanks for taking time to review. Find answers inline.
<span class="quote">> > Source/WebCore/Modules/mediastream/SDPProcessor.cpp:74
> > + candidateObject->setString(ASCIILiteral("type"), candidate.type());
> > + candidateObject->setString(ASCIILiteral("foundation"), candidate.foundation());
> > + candidateObject->setInteger(ASCIILiteral("componentId"), candidate.componentId());
> > + candidateObject->setString(ASCIILiteral("transport"), candidate.transport());
> > + candidateObject->setInteger(ASCIILiteral("priority"), candidate.priority());
> > + candidateObject->setString(ASCIILiteral("address"), candidate.address());
> > + candidateObject->setInteger(ASCIILiteral("port"), candidate.port());
> > + if (!candidate.tcpType().isEmpty())
> > + candidateObject->setString(ASCIILiteral("tcpType"), candidate.tcpType());
> > + if (candidate.type().convertToASCIIUppercase() != "HOST") {
> > + candidateObject->setString(ASCIILiteral("relatedAddress"), candidate.relatedAddress());
> > + candidateObject->setInteger(ASCIILiteral("relatedPort"), candidate.relatedPort());
> > + }
>
> 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<String> objects? E.g.:
>
> static const String& typeString()
> {
> static NeverDestroyed<const String> type { ASCIILiteral("type") };
> return type;
> }</span >
Yes. I created simple a macro to define a bunch of these functions.
<span class="quote">> > Source/WebCore/Modules/mediastream/SDPProcessor.cpp:86
> > + if (candidateObject.getString(ASCIILiteral("type"), stringValue))
> > + candidate->setType(stringValue);
>
> Ditto.
>
> > Source/WebCore/Modules/mediastream/SDPProcessor.cpp:153
> > + if (mdescObject->getString(ASCIILiteral("type"), stringValue))
> > + mdesc->setType(stringValue);
>
> Ditto.
>
> > Source/WebCore/Modules/mediastream/SDPProcessor.cpp:299
> > + for (const RefPtr<PeerMediaDescription>& mdesc : configuration.mediaDescriptions()) {
>
> "mdesc" is not a very, ahem, descriptive name. "description"?</span >
Fixed. Went with mediaDescription.
<span class="quote">> > Source/WebCore/Modules/mediastream/SDPProcessor.cpp:300
> > + RefPtr<InspectorObject> mdescObject = InspectorObject::create();
>
> Same for "mdescObject".</span >
Fixed. Went with mediaDescriptionObject.
<span class="quote">> > Source/WebCore/platform/mediastream/gtk/SDPProcessorScriptResourceGtk.cpp:45
> > +String scriptString()
> > +{
> > + return String(sdpJavaScript);
> > +}
>
> This should probably return a const String&, and store it locally in a
> "static NeverDestroyed<const String>".</span >
Indeed. Fixed.</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>