Bug 145425

Summary: Use modern for-loops in WebCore/plugins, storage, style, testing and workers.
Product: WebKit Reporter: Hunseop Jeong <hs85.jeong>
Component: WebCore Misc.Assignee: Hunseop Jeong <hs85.jeong>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, cdumez, commit-queue, darin, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews104 for mac-mavericks-wk2
none
Archive of layout-test-results from ews100 for mac-mavericks
none
Patch
none
Patch none

Description Hunseop Jeong 2015-05-27 21:10:49 PDT
cleanup for loop with ranged-based for loop.
Comment 1 Hunseop Jeong 2015-05-27 21:22:01 PDT
Created attachment 253828 [details]
Patch
Comment 2 Build Bot 2015-05-27 22:05:42 PDT
Comment on attachment 253828 [details]
Patch

Attachment 253828 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/4935507167412224

New failing tests:
fast/css/style-element-process-crash.html
fast/dom/HTMLDocument/object-by-name-or-id.html
http/tests/misc/acid2-pixel.html
http/tests/misc/acid2.html
fast/css/mask-missing-image-crash.html
fast/dom/HTMLObjectElement/form/nested-form-element.html
fast/css/acid2.html
Comment 3 Build Bot 2015-05-27 22:05:45 PDT
Created attachment 253833 [details]
Archive of layout-test-results from ews104 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 4 Build Bot 2015-05-27 22:17:46 PDT
Comment on attachment 253828 [details]
Patch

Attachment 253828 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5116671706529792

New failing tests:
fast/css/style-element-process-crash.html
fast/dom/HTMLDocument/object-by-name-or-id.html
http/tests/misc/acid2.html
plugins/crash-restoring-plugin-page-from-page-cache.html
fast/dom/HTMLObjectElement/form/nested-form-element.html
fast/css/acid2.html
Comment 5 Build Bot 2015-05-27 22:17:50 PDT
Created attachment 253835 [details]
Archive of layout-test-results from ews100 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 6 Hunseop Jeong 2015-05-28 00:42:44 PDT
Created attachment 253840 [details]
Patch
Comment 7 Darin Adler 2015-05-28 12:42:43 PDT
Comment on attachment 253840 [details]
Patch

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

> Source/WebCore/plugins/PluginMainThreadScheduler.cpp:98
>      {
>          // Empty all the queues in the original map
> -        CallQueueMap::iterator end = m_callQueueMap.end();
> -        for (CallQueueMap::iterator it = m_callQueueMap.begin(); it != end; ++it)
> -            it->value.clear();
> +        for (auto& call : m_callQueueMap.values())
> +            call.clear();
>      }

No need for the braces and indentation around this any more. They were there to scope the "end" local variable.

> Source/WebCore/storage/StorageEventDispatcher.cpp:67
> +    for (auto& entry : page->group().pages()) {

I think we should call this "pageInGroup" instead of "entry".

> Source/WebCore/workers/WorkerGlobalScope.cpp:180
> +        const URL& url = scriptExecutionContext()->completeURL(entry);

This would be more efficient if it was URL, not const URL& and ...

> Source/WebCore/workers/WorkerGlobalScope.cpp:185
>          completedURLs.append(url);

... this used WTF::move(url).
Comment 8 Hunseop Jeong 2015-05-28 19:13:18 PDT
Created attachment 253889 [details]
Patch
Comment 9 Hunseop Jeong 2015-05-28 19:27:54 PDT
(In reply to comment #7)
> Comment on attachment 253840 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253840&action=review
> 
> > Source/WebCore/plugins/PluginMainThreadScheduler.cpp:98
> >      {
> >          // Empty all the queues in the original map
> > -        CallQueueMap::iterator end = m_callQueueMap.end();
> > -        for (CallQueueMap::iterator it = m_callQueueMap.begin(); it != end; ++it)
> > -            it->value.clear();
> > +        for (auto& call : m_callQueueMap.values())
> > +            call.clear();
> >      }
> 
> No need for the braces and indentation around this any more. They were there
> to scope the "end" local variable.
Removed the braces and indentations.
> 
> > Source/WebCore/storage/StorageEventDispatcher.cpp:67
> > +    for (auto& entry : page->group().pages()) {
> 
> I think we should call this "pageInGroup" instead of "entry".
Done.
> 
> > Source/WebCore/workers/WorkerGlobalScope.cpp:180
> > +        const URL& url = scriptExecutionContext()->completeURL(entry);
> 
> This would be more efficient if it was URL, not const URL& and ...
> 
> > Source/WebCore/workers/WorkerGlobalScope.cpp:185
> >          completedURLs.append(url);
> 
> ... this used WTF::move(url).
Done. If I find the code that is similar as your guide, I will modify it.
Comment 10 WebKit Commit Bot 2015-05-29 10:01:32 PDT
Comment on attachment 253889 [details]
Patch

Clearing flags on attachment: 253889

Committed r184990: <http://trac.webkit.org/changeset/184990>
Comment 11 WebKit Commit Bot 2015-05-29 10:01:49 PDT
All reviewed patches have been landed.  Closing bug.