Bug 130402

Summary: Removing MediaStreamVector typedef
Product: WebKit Reporter: Thiago de Barros Lacerda <thiago.lacerda>
Component: WebCore Misc.Assignee: Thiago de Barros Lacerda <thiago.lacerda>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, glenn, hta, jer.noble, philipj, sergio, tommyw
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 124288    
Attachments:
Description Flags
Patch none

Description Thiago de Barros Lacerda 2014-03-18 09:58:48 PDT
As did in r158480 for MediaStreamTrackVector and MediaStreamSourceVector. Those typedefs just compromises the code readability.
Comment 1 Thiago de Barros Lacerda 2014-03-18 10:06:30 PDT
Created attachment 227063 [details]
Patch
Comment 2 WebKit Commit Bot 2014-03-18 12:48:24 PDT
Comment on attachment 227063 [details]
Patch

Clearing flags on attachment: 227063

Committed r165834: <http://trac.webkit.org/changeset/165834>
Comment 3 WebKit Commit Bot 2014-03-18 12:48:28 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2014-03-19 18:42:34 PDT
Comment on attachment 227063 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=227063&action=review

> Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp:520
> -    for (MediaStreamVector::iterator iter = m_localStreams.begin(); iter != m_localStreams.end(); ++iter) {
> +    for (auto iter = m_localStreams.begin(); iter != m_localStreams.end(); ++iter) {
>          if ((*iter)->id() == streamId)
>              return iter->get();
>      }

When you touch a loop like this one it’s best to make it a modern C++ loop too:

    for (auto& stream : m_localStreams) {
        if (stream->id() == streamId)
            return stream->get();
    }

Isn’t that better?
Comment 5 Thiago de Barros Lacerda 2014-03-20 06:42:34 PDT
(In reply to comment #4)
> (From update of attachment 227063 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=227063&action=review
> 
> > Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp:520
> > -    for (MediaStreamVector::iterator iter = m_localStreams.begin(); iter != m_localStreams.end(); ++iter) {
> > +    for (auto iter = m_localStreams.begin(); iter != m_localStreams.end(); ++iter) {
> >          if ((*iter)->id() == streamId)
> >              return iter->get();
> >      }
> 
> When you touch a loop like this one it’s best to make it a modern C++ loop too:
> 
>     for (auto& stream : m_localStreams) {
>         if (stream->id() == streamId)
>             return stream->get();
>     }
> 
> Isn’t that better?

Indeed Darin, I will do that next time. Thanks