Bug 134594

Summary: [CoordinatedGraphics] Use the C++11 syntax to clean-up for loops
Product: WebKit Reporter: Hunseop Jeong <hs85.jeong>
Component: WebKit2Assignee: Hunseop Jeong <hs85.jeong>
Status: RESOLVED FIXED    
Severity: Normal CC: bunhere, cdumez, cmarcelo, commit-queue, gyuyoung.kim, kondapallykalyan, luiz, noam, sergio
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: Linux   
Attachments:
Description Flags
Patch
none
I used the more C++11 syntax to clean-up for loops by your guide. Thanks Darin. none

Description Hunseop Jeong 2014-07-03 07:41:52 PDT
Start using auto keyword for loops.
Comment 1 Hunseop Jeong 2014-07-03 07:59:29 PDT
Created attachment 234343 [details]
Patch
Comment 2 Darin Adler 2014-07-03 10:23:01 PDT
Comment on attachment 234343 [details]
Patch

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

If you’re going to touch all these loops, then you should clean them up even more using C++11 syntax and the functions like keys() and values() for simple iterations of maps. Example:

> Source/WebCore/platform/graphics/TiledBackingStore.cpp:118
> -    TileMap::iterator end = m_tiles.end();
> -    for (TileMap::iterator it = m_tiles.begin(); it != end; ++it) {
> +    for (auto it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it) {
>          if (!it->value->isDirty())
>              continue;
>          dirtyTiles.append(it->value);

for (auto& tile : m_tiles.values()) {
        if (tile->isDirty())
            dirtyTiles.append(tile);
    }

> Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp:239
> +    for (auto iter = m_imageBackings.begin(), end = m_imageBackings.end(); iter != end; ++iter)
>          iter->value->update();

for (auto& backing : m_imageBackings.values())
        backing->update();

> Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp:82
> +    for (auto it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it)
>          m_tilesToRemove.add(it->key);

for (auto& key : m_tiles.keys())
        m_tilesToRemove.add(key);

> Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:563
> +    for (auto it = m_backingStoresWithPendingBuffers.begin(), end = m_backingStoresWithPendingBuffers.end(); it != end; ++it)
>          (*it)->commitTileOperations(m_textureMapper.get());

for (auto& store : m_backingStoresWithPendingBuffers)
        store->commitTileOperations(m_textureMapper.get());
Comment 3 Hunseop Jeong 2014-07-03 18:47:01 PDT
Created attachment 234387 [details]
I used the more C++11 syntax to clean-up for loops by your guide. Thanks Darin.
Comment 4 WebKit Commit Bot 2014-07-04 15:26:33 PDT
Comment on attachment 234387 [details]
I used the more C++11 syntax to clean-up for loops by your guide. Thanks Darin.

Clearing flags on attachment: 234387

Committed r170813: <http://trac.webkit.org/changeset/170813>
Comment 5 WebKit Commit Bot 2014-07-04 15:26:39 PDT
All reviewed patches have been landed.  Closing bug.