Bug 137271 - [TexMap] Sprinkle range-based for-loops in GraphicsLayerTextureMapper, TextureMapperLayer
Summary: [TexMap] Sprinkle range-based for-loops in GraphicsLayerTextureMapper, Textur...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords:
: 124999 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-09-30 14:31 PDT by Zan Dobersek
Modified: 2020-11-08 18:02 PST (History)
7 users (show)

See Also:


Attachments
Patch (7.20 KB, patch)
2014-09-30 14:33 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***