WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
134594
[CoordinatedGraphics] Use the C++11 syntax to clean-up for loops
https://bugs.webkit.org/show_bug.cgi?id=134594
Summary
[CoordinatedGraphics] Use the C++11 syntax to clean-up for loops
Hunseop Jeong
Reported
2014-07-03 07:41:52 PDT
Start using auto keyword for loops.
Attachments
Patch
(10.93 KB, patch)
2014-07-03 07:59 PDT
,
Hunseop Jeong
no flags
Details
Formatted Diff
Diff
I used the more C++11 syntax to clean-up for loops by your guide. Thanks Darin.
(12.21 KB, patch)
2014-07-03 18:47 PDT
,
Hunseop Jeong
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Hunseop Jeong
Comment 1
2014-07-03 07:59:29 PDT
Created
attachment 234343
[details]
Patch
Darin Adler
Comment 2
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());
Hunseop Jeong
Comment 3
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.
WebKit Commit Bot
Comment 4
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
>
WebKit Commit Bot
Comment 5
2014-07-04 15:26:39 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug