Bug 137271

Summary: [TexMap] Sprinkle range-based for-loops in GraphicsLayerTextureMapper, TextureMapperLayer
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal CC: cmarcelo, commit-queue, kondapallykalyan, luiz, mrobinson, noam, p.szymanski3
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Zan Dobersek 2014-09-30 14:31:58 PDT
[TexMap] Sprinkle range-based for-loops in GraphicsLayerTextureMapper, TextureMapperLayer
Comment 1 Zan Dobersek 2014-09-30 14:33:53 PDT
Created attachment 238963 [details]
Patch
Comment 2 WebKit Commit Bot 2014-09-30 14:35:34 PDT
Attachment 238963 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:642:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Sergio Villar Senin 2014-10-01 01:02:51 PDT
Comment on attachment 238963 [details]
Patch

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

I love range based for loops.

I guess the style issue is a false positive, time to report a bug?

> Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:644
> +        });

Haven't seen this before in WK code. Is it an accepted C++11 feature?
Comment 4 Zan Dobersek 2014-10-01 05:04:17 PDT
Comment on attachment 238963 [details]
Patch

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

>> Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp:644
>> +        });
> 
> Haven't seen this before in WK code. Is it an accepted C++11 feature?

It's already used in a few places, for instance MediaSource.cpp.
http://trac.webkit.org/browser/trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp

I believe these utilities are an elegant replacement for manually writing out these idioms. The compilers are also smart enough to properly optimize the lambda expression. The only shortfall is the need to explicitly declare the start and end of the range, instead of being able to simply pass a range-like object to the function.
Comment 5 Zan Dobersek 2014-10-01 13:45:32 PDT
(In reply to comment #3)
> (From update of attachment 238963 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=238963&action=review
> 
> I guess the style issue is a false positive, time to report a bug?
> 

Reported bug #137309.
Comment 6 Zan Dobersek 2014-10-01 13:53:30 PDT
Comment on attachment 238963 [details]
Patch

Clearing flags on attachment: 238963

Committed r174168: <http://trac.webkit.org/changeset/174168>
Comment 7 Zan Dobersek 2014-10-01 13:53:39 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Fujii Hironori 2020-11-08 18:02:53 PST
*** Bug 124999 has been marked as a duplicate of this bug. ***