[Webkit-unassigned] [Bug 154867] WebRTC: Implement MediaEndpointPeerConnection::createOffer()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 7 05:58:51 PST 2016


https://bugs.webkit.org/show_bug.cgi?id=154867

--- Comment #11 from Adam Bergkvist <adam.bergkvist at ericsson.com> ---
(In reply to comment #8)
> Comment on attachment 272580 [details]
> Proposed patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=272580&action=review

Thanks for taking time to review. Find answers inline.

> > 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;
> }

Yes. I created simple a macro to define a bunch of these functions.

> > 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"?

Fixed. Went with mediaDescription.

> > Source/WebCore/Modules/mediastream/SDPProcessor.cpp:300
> > +        RefPtr<InspectorObject> mdescObject = InspectorObject::create();
> 
> Same for "mdescObject".

Fixed. Went with mediaDescriptionObject.

> > 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>".

Indeed. Fixed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160307/32e617c1/attachment.html>


More information about the webkit-unassigned mailing list