<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170113] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170113">170113</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-06-18 12:40:25 -0700 (Wed, 18 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Adopt modern C++11 loops and fix WebArchive creation functions
https://bugs.webkit.org/show_bug.cgi?id=134032

Reviewed by Andreas Kling.

Source/WebCore:
Use modern loops in a couple of places, fix DocumentLoader::subresources() to return a Vector,
and stop using Vectors of PassRefPtrs.

* WebCore.exp.in:
* dom/Document.cpp:
(WebCore::Document::textInserted):
(WebCore::Document::textRemoved):
(WebCore::Document::textNodesMerged):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::subresources):
(WebCore::DocumentLoader::getSubresources): Deleted.
* loader/DocumentLoader.h:
* loader/appcache/ApplicationCache.cpp:
(WebCore::ApplicationCache::dump):
* loader/appcache/ApplicationCache.h:
(WebCore::ApplicationCache::resources):
(WebCore::ApplicationCache::begin): Deleted.
(WebCore::ApplicationCache::end): Deleted.
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::fillResourceList):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
(WebCore::ApplicationCacheStorage::store):
(WebCore::ApplicationCacheStorage::empty):
(WebCore::ApplicationCacheStorage::storeCopyOfCache):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
(WebCore::LegacyWebArchive::createFromSelection):
* loader/archive/cf/LegacyWebArchive.h:
* xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::dispatchDeferredEvents):

Source/WebKit/mac:
* WebView/WebArchive.mm:
(-[WebArchive initWithMainResource:subresources:subframeArchives:]):
* WebView/WebDataSource.mm:
(-[WebDataSource subresources]):

Source/WebKit2:
* Shared/APIWebArchive.cpp:
(API::WebArchive::WebArchive):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoadercpp">trunk/Source/WebCore/loader/DocumentLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoaderh">trunk/Source/WebCore/loader/DocumentLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCachecpp">trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheh">trunk/Source/WebCore/loader/appcache/ApplicationCache.h</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderappcacheApplicationCacheStoragecpp">trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderarchivecfLegacyWebArchivecpp">trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderarchivecfLegacyWebArchiveh">trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.h</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestProgressEventThrottlecpp">trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebArchivemm">trunk/Source/WebKit/mac/WebView/WebArchive.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebDataSourcemm">trunk/Source/WebKit/mac/WebView/WebDataSource.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIWebArchivecpp">trunk/Source/WebKit2/Shared/APIWebArchive.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/ChangeLog        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2014-06-18  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Adopt modern C++11 loops and fix WebArchive creation functions
+        https://bugs.webkit.org/show_bug.cgi?id=134032
+
+        Reviewed by Andreas Kling.
+
+        Use modern loops in a couple of places, fix DocumentLoader::subresources() to return a Vector,
+        and stop using Vectors of PassRefPtrs.
+
+        * WebCore.exp.in:
+        * dom/Document.cpp:
+        (WebCore::Document::textInserted):
+        (WebCore::Document::textRemoved):
+        (WebCore::Document::textNodesMerged):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::subresources):
+        (WebCore::DocumentLoader::getSubresources): Deleted.
+        * loader/DocumentLoader.h:
+        * loader/appcache/ApplicationCache.cpp:
+        (WebCore::ApplicationCache::dump):
+        * loader/appcache/ApplicationCache.h:
+        (WebCore::ApplicationCache::resources):
+        (WebCore::ApplicationCache::begin): Deleted.
+        (WebCore::ApplicationCache::end): Deleted.
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
+        * loader/appcache/ApplicationCacheHost.cpp:
+        (WebCore::ApplicationCacheHost::fillResourceList):
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
+        (WebCore::ApplicationCacheStorage::store):
+        (WebCore::ApplicationCacheStorage::empty):
+        (WebCore::ApplicationCacheStorage::storeCopyOfCache):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create):
+        (WebCore::LegacyWebArchive::createFromSelection):
+        * loader/archive/cf/LegacyWebArchive.h:
+        * xml/XMLHttpRequestProgressEventThrottle.cpp:
+        (WebCore::XMLHttpRequestProgressEventThrottle::dispatchDeferredEvents):
+
</ins><span class="cx"> 2014-06-18  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove duplicate code using sdiv.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -682,7 +682,7 @@
</span><span class="cx"> __ZN7WebCore16IconDatabaseBase4openERKN3WTF6StringES4_
</span><span class="cx"> __ZN7WebCore16LegacyWebArchive19createFromSelectionEPNS_5FrameE
</span><span class="cx"> __ZN7WebCore16LegacyWebArchive21rawDataRepresentationEv
</span><del>-__ZN7WebCore16LegacyWebArchive6createEN3WTF10PassRefPtrINS_15ArchiveResourceEEERNS1_6VectorIS4_Lm0ENS1_15CrashOnOverflowEEERNS5_INS2_IS0_EELm0ES6_EE
</del><ins>+__ZN7WebCore16LegacyWebArchive6createEN3WTF10PassRefPtrINS_15ArchiveResourceEEENS1_6VectorINS1_6RefPtrIS3_EELm0ENS1_15CrashOnOverflowEEENS5_INS6_IS0_EELm0ES8_EE
</ins><span class="cx"> __ZN7WebCore16LegacyWebArchive6createEPNS_12SharedBufferE
</span><span class="cx"> __ZN7WebCore16LegacyWebArchive6createEPNS_4NodeENSt3__18functionIFbRNS_5FrameEEEE
</span><span class="cx"> __ZN7WebCore16LegacyWebArchive6createEPNS_5FrameE
</span><span class="lines">@@ -1640,9 +1640,9 @@
</span><span class="cx"> __ZNK7WebCore14DocumentLoader11responseURLEv
</span><span class="cx"> __ZNK7WebCore14DocumentLoader11subresourceERKNS_3URLE
</span><span class="cx"> __ZNK7WebCore14DocumentLoader12mainResourceEv
</span><ins>+__ZNK7WebCore14DocumentLoader12subresourcesEv
</ins><span class="cx"> __ZNK7WebCore14DocumentLoader13urlForHistoryEv
</span><span class="cx"> __ZNK7WebCore14DocumentLoader14unreachableURLEv
</span><del>-__ZNK7WebCore14DocumentLoader15getSubresourcesERN3WTF6VectorINS1_10PassRefPtrINS_15ArchiveResourceEEELm0ENS1_15CrashOnOverflowEEE
</del><span class="cx"> __ZNK7WebCore14DocumentLoader15originalRequestEv
</span><span class="cx"> __ZNK7WebCore14DocumentLoader16mainResourceDataEv
</span><span class="cx"> __ZNK7WebCore14DocumentLoader17parsedArchiveDataEv
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -3611,9 +3611,8 @@
</span><span class="cx"> void Document::textInserted(Node* text, unsigned offset, unsigned length)
</span><span class="cx"> {
</span><span class="cx">     if (!m_ranges.isEmpty()) {
</span><del>-        HashSet&lt;Range*&gt;::const_iterator end = m_ranges.end();
-        for (HashSet&lt;Range*&gt;::const_iterator it = m_ranges.begin(); it != end; ++it)
-            (*it)-&gt;textInserted(text, offset, length);
</del><ins>+        for (auto&amp; range : m_ranges)
+            range-&gt;textInserted(text, offset, length);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Update the markers for spelling and grammar checking.
</span><span class="lines">@@ -3623,9 +3622,8 @@
</span><span class="cx"> void Document::textRemoved(Node* text, unsigned offset, unsigned length)
</span><span class="cx"> {
</span><span class="cx">     if (!m_ranges.isEmpty()) {
</span><del>-        HashSet&lt;Range*&gt;::const_iterator end = m_ranges.end();
-        for (HashSet&lt;Range*&gt;::const_iterator it = m_ranges.begin(); it != end; ++it)
-            (*it)-&gt;textRemoved(text, offset, length);
</del><ins>+        for (auto&amp; range : m_ranges)
+            range-&gt;textRemoved(text, offset, length);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Update the markers for spelling and grammar checking.
</span><span class="lines">@@ -3637,9 +3635,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_ranges.isEmpty()) {
</span><span class="cx">         NodeWithIndex oldNodeWithIndex(oldNode);
</span><del>-        HashSet&lt;Range*&gt;::const_iterator end = m_ranges.end();
-        for (HashSet&lt;Range*&gt;::const_iterator it = m_ranges.begin(); it != end; ++it)
-            (*it)-&gt;textNodesMerged(oldNodeWithIndex, offset);
</del><ins>+        for (auto&amp; range : m_ranges)
+            range-&gt;textNodesMerged(oldNodeWithIndex, offset);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // FIXME: This should update markers for spelling and grammar checking.
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.cpp        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -1105,20 +1105,19 @@
</span><span class="cx">     return ArchiveResource::create(data-&gt;sharedBuffer(), url, resource-&gt;response());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DocumentLoader::getSubresources(Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt;&amp; subresources) const
</del><ins>+Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; DocumentLoader::subresources() const
</ins><span class="cx"> {
</span><span class="cx">     if (!isCommitted())
</span><del>-        return;
</del><ins>+        return { };
</ins><span class="cx"> 
</span><del>-    const CachedResourceLoader::DocumentResourceMap&amp; allResources = m_cachedResourceLoader-&gt;allCachedResources();
-    CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
-    for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
-        RefPtr&lt;ArchiveResource&gt; subresource = this-&gt;subresource(URL(ParsedURLString, it-&gt;value-&gt;url()));
-        if (subresource)
-            subresources.append(subresource.release());
</del><ins>+    Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; subresources;
+
+    for (auto&amp; cachedResourceHandle : m_cachedResourceLoader-&gt;allCachedResources().values()) {
+        if (RefPtr&lt;ArchiveResource&gt; subresource = this-&gt;subresource(URL(ParsedURLString, cachedResourceHandle-&gt;url())))
+            subresources.append(std::move(subresource));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return;
</del><ins>+    return subresources;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DocumentLoader::deliverSubstituteResourcesAfterDelay()
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.h (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.h        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/loader/DocumentLoader.h        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -162,9 +162,8 @@
</span><span class="cx">         // Return an ArchiveResource for the URL, either creating from live data or
</span><span class="cx">         // pulling from the ArchiveResourceCollection
</span><span class="cx">         PassRefPtr&lt;ArchiveResource&gt; subresource(const URL&amp;) const;
</span><del>-        void getSubresources(Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt;&amp;) const;
</del><ins>+        Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; subresources() const;
</ins><span class="cx"> 
</span><del>-
</del><span class="cx"> #ifndef NDEBUG
</span><span class="cx">         bool isSubstituteLoadPending(ResourceLoader*) const;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -222,11 +222,9 @@
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> void ApplicationCache::dump()
</span><span class="cx"> {
</span><del>-    HashMap&lt;String, RefPtr&lt;ApplicationCacheResource&gt;&gt;::const_iterator end = m_resources.end();
-    
-    for (HashMap&lt;String, RefPtr&lt;ApplicationCacheResource&gt;&gt;::const_iterator it = m_resources.begin(); it != end; ++it) {
-        printf(&quot;%s &quot;, it-&gt;key.ascii().data());
-        ApplicationCacheResource::dumpType(it-&gt;value-&gt;type());
</del><ins>+    for (const auto&amp; urlAndResource : m_resources) {
+        printf(&quot;%s &quot;, urlAndResource.key.utf8().data());
+        ApplicationCacheResource::dumpType(urlAndResource.value-&gt;type());
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCache.h (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCache.h        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCache.h        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -81,8 +81,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     typedef HashMap&lt;String, RefPtr&lt;ApplicationCacheResource&gt;&gt; ResourceMap;
</span><del>-    ResourceMap::const_iterator begin() const { return m_resources.begin(); }
-    ResourceMap::const_iterator end() const { return m_resources.end(); }
</del><ins>+    const ResourceMap&amp; resources() const { return m_resources; }
</ins><span class="cx">     
</span><span class="cx">     void setStorageID(unsigned storageID) { m_storageID = storageID; }
</span><span class="cx">     unsigned storageID() const { return m_storageID; }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheGroupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -765,7 +765,7 @@
</span><span class="cx">     ASSERT(m_pendingEntries.isEmpty());
</span><span class="cx"> 
</span><span class="cx">     if (isUpgradeAttempt) {
</span><del>-        for (const auto&amp; urlAndResource : *m_newestCache) {
</del><ins>+        for (const auto&amp; urlAndResource : m_newestCache-&gt;resources()) {
</ins><span class="cx">             unsigned type = urlAndResource.value-&gt;type();
</span><span class="cx">             if (type &amp; ApplicationCacheResource::Master)
</span><span class="cx">                 addEntry(urlAndResource.key, type);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -286,15 +286,17 @@
</span><span class="cx">     ApplicationCache* cache = applicationCache();
</span><span class="cx">     if (!cache || !cache-&gt;isComplete())
</span><span class="cx">         return;
</span><del>-    
-    for (const auto&amp; urlAndResource : *cache) {
-        RefPtr&lt;ApplicationCacheResource&gt; resource = urlAndResource.value;
</del><ins>+
+    for (const auto&amp; urlAndResource : cache-&gt;resources()) {
+        ApplicationCacheResource* resource = urlAndResource.value.get();
+
</ins><span class="cx">         unsigned type = resource-&gt;type();
</span><del>-        bool isMaster   = type &amp; ApplicationCacheResource::Master;
</del><ins>+        bool isMaster = type &amp; ApplicationCacheResource::Master;
</ins><span class="cx">         bool isManifest = type &amp; ApplicationCacheResource::Manifest;
</span><span class="cx">         bool isExplicit = type &amp; ApplicationCacheResource::Explicit;
</span><del>-        bool isForeign  = type &amp; ApplicationCacheResource::Foreign;
</del><ins>+        bool isForeign = type &amp; ApplicationCacheResource::Foreign;
</ins><span class="cx">         bool isFallback = type &amp; ApplicationCacheResource::Fallback;
</span><ins>+
</ins><span class="cx">         resources-&gt;append(ResourceInfo(resource-&gt;url(), isMaster, isManifest, isFallback, isForeign, isExplicit, resource-&gt;estimatedSizeInStorage()));
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderappcacheApplicationCacheStoragecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -275,10 +275,7 @@
</span><span class="cx">     ASSERT(!url.hasFragmentIdentifier());
</span><span class="cx"> 
</span><span class="cx">     // Check if an appropriate cache already exists in memory.
</span><del>-    CacheGroupMap::const_iterator end = m_cachesInMemory.end();
-    for (CacheGroupMap::const_iterator it = m_cachesInMemory.begin(); it != end; ++it) {
-        ApplicationCacheGroup* group = it-&gt;value;
-        
</del><ins>+    for (auto group : m_cachesInMemory.values()) {
</ins><span class="cx">         ASSERT(!group-&gt;isObsolete());
</span><span class="cx"> 
</span><span class="cx">         if (ApplicationCache* cache = group-&gt;newestCache()) {
</span><span class="lines">@@ -741,17 +738,14 @@
</span><span class="cx">     unsigned cacheStorageID = static_cast&lt;unsigned&gt;(m_database.lastInsertRowID());
</span><span class="cx"> 
</span><span class="cx">     // Store all resources
</span><del>-    {
-        ApplicationCache::ResourceMap::const_iterator end = cache-&gt;end();
-        for (ApplicationCache::ResourceMap::const_iterator it = cache-&gt;begin(); it != end; ++it) {
-            unsigned oldStorageID = it-&gt;value-&gt;storageID();
-            if (!store(it-&gt;value.get(), cacheStorageID))
-                return false;
</del><ins>+    for (auto&amp; resource : cache-&gt;resources().values()) {
+        unsigned oldStorageID = resource-&gt;storageID();
+        if (!store(resource.get(), cacheStorageID))
+            return false;
</ins><span class="cx"> 
</span><del>-            // Storing the resource succeeded. Log its old storageID in case
-            // it needs to be restored later.
-            storageIDJournal-&gt;add(it-&gt;value.get(), oldStorageID);
-        }
</del><ins>+        // Storing the resource succeeded. Log its old storageID in case
+        // it needs to be restored later.
+        storageIDJournal-&gt;add(resource.get(), oldStorageID);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     // Store the online whitelist
</span><span class="lines">@@ -1293,10 +1287,9 @@
</span><span class="cx">     // Clear the storage IDs for the caches in memory.
</span><span class="cx">     // The caches will still work, but cached resources will not be saved to disk 
</span><span class="cx">     // until a cache update process has been initiated.
</span><del>-    CacheGroupMap::const_iterator end = m_cachesInMemory.end();
-    for (CacheGroupMap::const_iterator it = m_cachesInMemory.begin(); it != end; ++it)
-        it-&gt;value-&gt;clearStorageID();
-    
</del><ins>+    for (auto group : m_cachesInMemory.values())
+        group-&gt;clearStorageID();
+
</ins><span class="cx">     checkForDeletedResources();
</span><span class="cx"> }
</span><span class="cx">     
</span><span class="lines">@@ -1357,10 +1350,7 @@
</span><span class="cx">     cacheCopy-&gt;setFallbackURLs(cache-&gt;fallbackURLs());
</span><span class="cx"> 
</span><span class="cx">     // Traverse the cache and add copies of all resources.
</span><del>-    ApplicationCache::ResourceMap::const_iterator end = cache-&gt;end();
-    for (ApplicationCache::ResourceMap::const_iterator it = cache-&gt;begin(); it != end; ++it) {
-        ApplicationCacheResource* resource = it-&gt;value.get();
-        
</del><ins>+    for (auto&amp; resource : cache-&gt;resources().values()) {
</ins><span class="cx">         RefPtr&lt;ApplicationCacheResource&gt; resourceCopy = ApplicationCacheResource::create(resource-&gt;url(), resource-&gt;response(), resource-&gt;type(), resource-&gt;data(), resource-&gt;path());
</span><span class="cx">         
</span><span class="cx">         cacheCopy-&gt;addResource(resourceCopy.release());
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderarchivecfLegacyWebArchivecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -237,7 +237,7 @@
</span><span class="cx">     return adoptRef(new LegacyWebArchive);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;LegacyWebArchive&gt; LegacyWebArchive::create(PassRefPtr&lt;ArchiveResource&gt; mainResource, Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt;&amp; subresources, Vector&lt;PassRefPtr&lt;LegacyWebArchive&gt;&gt;&amp; subframeArchives)
</del><ins>+PassRefPtr&lt;LegacyWebArchive&gt; LegacyWebArchive::create(PassRefPtr&lt;ArchiveResource&gt; mainResource, Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; subresources, Vector&lt;RefPtr&lt;LegacyWebArchive&gt;&gt; subframeArchives)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(mainResource);
</span><span class="cx">     if (!mainResource)
</span><span class="lines">@@ -247,10 +247,10 @@
</span><span class="cx">     archive-&gt;setMainResource(mainResource);
</span><span class="cx">     
</span><span class="cx">     for (unsigned i = 0; i &lt; subresources.size(); ++i)
</span><del>-        archive-&gt;addSubresource(subresources[i]);
</del><ins>+        archive-&gt;addSubresource(std::move(subresources[i]));
</ins><span class="cx">     
</span><span class="cx">     for (unsigned i = 0; i &lt; subframeArchives.size(); ++i)
</span><del>-        archive-&gt;addSubframeArchive(subframeArchives[i]);  
</del><ins>+        archive-&gt;addSubframeArchive(std::move(subframeArchives[i]));
</ins><span class="cx">         
</span><span class="cx">     return archive.release();
</span><span class="cx"> }
</span><span class="lines">@@ -461,19 +461,15 @@
</span><span class="cx">     if (!documentLoader)
</span><span class="cx">         return 0;
</span><span class="cx">         
</span><del>-    Vector&lt;PassRefPtr&lt;LegacyWebArchive&gt;&gt; subframeArchives;
</del><ins>+    Vector&lt;RefPtr&lt;LegacyWebArchive&gt;&gt; subframeArchives;
</ins><span class="cx">     
</span><del>-    unsigned children = frame-&gt;tree().childCount();
-    for (unsigned i = 0; i &lt; children; ++i) {
-        RefPtr&lt;LegacyWebArchive&gt; childFrameArchive = create(frame-&gt;tree().child(i));
-        if (childFrameArchive)
-            subframeArchives.append(childFrameArchive.release());
</del><ins>+    for (unsigned i = 0; i &lt; frame-&gt;tree().childCount(); ++i) {
+        if (RefPtr&lt;LegacyWebArchive&gt; childFrameArchive = create(frame-&gt;tree().child(i)))
+            subframeArchives.append(std::move(childFrameArchive));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt; subresources;
-    documentLoader-&gt;getSubresources(subresources);
-
-    return create(documentLoader-&gt;mainResource(), subresources, subframeArchives);
</del><ins>+    auto subresources = documentLoader-&gt;subresources();
+    return create(documentLoader-&gt;mainResource(), std::move(subresources), std::move(subframeArchives));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;LegacyWebArchive&gt; LegacyWebArchive::create(Range* range)
</span><span class="lines">@@ -512,8 +508,8 @@
</span><span class="cx">         
</span><span class="cx">     RefPtr&lt;ArchiveResource&gt; mainResource = ArchiveResource::create(utf8Buffer(markupString), responseURL, response.mimeType(), &quot;UTF-8&quot;, frame-&gt;tree().uniqueName());
</span><span class="cx"> 
</span><del>-    Vector&lt;PassRefPtr&lt;LegacyWebArchive&gt;&gt; subframeArchives;
-    Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt; subresources;
</del><ins>+    Vector&lt;RefPtr&lt;LegacyWebArchive&gt;&gt; subframeArchives;
+    Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; subresources;
</ins><span class="cx">     HashSet&lt;URL&gt; uniqueSubresources;
</span><span class="cx"> 
</span><span class="cx">     size_t nodesSize = nodes.size();    
</span><span class="lines">@@ -525,28 +521,25 @@
</span><span class="cx">             if (frameFilter &amp;&amp; !frameFilter(*childFrame))
</span><span class="cx">                 continue;
</span><span class="cx">                 
</span><del>-            RefPtr&lt;LegacyWebArchive&gt; subframeArchive = create(childFrame-&gt;document(), frameFilter);
-            
-            if (subframeArchive)
-                subframeArchives.append(subframeArchive);
</del><ins>+            if (RefPtr&lt;LegacyWebArchive&gt; subframeArchive = create(childFrame-&gt;document(), frameFilter))
+                subframeArchives.append(std::move(subframeArchive));
</ins><span class="cx">             else
</span><span class="cx">                 LOG_ERROR(&quot;Unabled to archive subframe %s&quot;, childFrame-&gt;tree().uniqueName().string().utf8().data());
</span><ins>+
</ins><span class="cx">         } else {
</span><span class="cx">             ListHashSet&lt;URL&gt; subresourceURLs;
</span><span class="cx">             node.getSubresourceURLs(subresourceURLs);
</span><span class="cx">             
</span><span class="cx">             DocumentLoader* documentLoader = frame-&gt;loader().documentLoader();
</span><del>-            ListHashSet&lt;URL&gt;::iterator iterEnd = subresourceURLs.end();
-            for (ListHashSet&lt;URL&gt;::iterator iter = subresourceURLs.begin(); iter != iterEnd; ++iter) {
-                const URL&amp; subresourceURL = *iter;
</del><ins>+
+            for (const auto&amp; subresourceURL : subresourceURLs) {
</ins><span class="cx">                 if (uniqueSubresources.contains(subresourceURL))
</span><span class="cx">                     continue;
</span><span class="cx"> 
</span><span class="cx">                 uniqueSubresources.add(subresourceURL);
</span><span class="cx"> 
</span><del>-                RefPtr&lt;ArchiveResource&gt; resource = documentLoader-&gt;subresource(subresourceURL);
-                if (resource) {
-                    subresources.append(resource.release());
</del><ins>+                if (RefPtr&lt;ArchiveResource&gt; resource = documentLoader-&gt;subresource(subresourceURL)) {
+                    subresources.append(std::move(resource));
</ins><span class="cx">                     continue;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -557,9 +550,9 @@
</span><span class="cx">                 CachedResource* cachedResource = memoryCache()-&gt;resourceForRequest(request, frame-&gt;page()-&gt;sessionID());
</span><span class="cx">                 if (cachedResource) {
</span><span class="cx">                     ResourceBuffer* data = cachedResource-&gt;resourceBuffer();
</span><del>-                    resource = ArchiveResource::create(data ? data-&gt;sharedBuffer() : 0, subresourceURL, cachedResource-&gt;response());
-                    if (resource) {
-                        subresources.append(resource.release());
</del><ins>+
+                    if (RefPtr&lt;ArchiveResource&gt; resource = ArchiveResource::create(data ? data-&gt;sharedBuffer() : 0, subresourceURL, cachedResource-&gt;response())) {
+                        subresources.append(std::move(resource));
</ins><span class="cx">                         continue;
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="lines">@@ -581,7 +574,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return create(mainResource.release(), subresources, subframeArchives);
</del><ins>+    return create(mainResource.release(), subresources, std::move(subframeArchives));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;LegacyWebArchive&gt; LegacyWebArchive::createFromSelection(Frame* frame)
</span><span class="lines">@@ -612,14 +605,7 @@
</span><span class="cx">     String iframeMarkup = &quot;&lt;iframe frameborder=\&quot;no\&quot; marginwidth=\&quot;0\&quot; marginheight=\&quot;0\&quot; width=\&quot;98%%\&quot; height=\&quot;98%%\&quot; src=\&quot;&quot; + frame-&gt;loader().documentLoader()-&gt;response().url().string() + &quot;\&quot;&gt;&lt;/iframe&gt;&quot;;
</span><span class="cx">     RefPtr&lt;ArchiveResource&gt; iframeResource = ArchiveResource::create(utf8Buffer(iframeMarkup), blankURL(), &quot;text/html&quot;, &quot;UTF-8&quot;, String());
</span><span class="cx"> 
</span><del>-    Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt; subresources;
-
-    Vector&lt;PassRefPtr&lt;LegacyWebArchive&gt;&gt; subframeArchives;
-    subframeArchives.append(archive);
-    
-    archive = create(iframeResource.release(), subresources, subframeArchives);
-    
-    return archive.release();
</del><ins>+    return create(iframeResource.release(), Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; { }, Vector&lt;RefPtr&lt;LegacyWebArchive&gt;&gt; { archive });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderarchivecfLegacyWebArchiveh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.h (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.h        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.h        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">     static PassRefPtr&lt;LegacyWebArchive&gt; create();
</span><span class="cx">     static PassRefPtr&lt;LegacyWebArchive&gt; create(SharedBuffer*);
</span><span class="cx">     static PassRefPtr&lt;LegacyWebArchive&gt; create(const URL&amp;, SharedBuffer*);
</span><del>-    static PassRefPtr&lt;LegacyWebArchive&gt; create(PassRefPtr&lt;ArchiveResource&gt; mainResource, Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt;&amp; subresources, Vector&lt;PassRefPtr&lt;LegacyWebArchive&gt;&gt;&amp; subframeArchives);
</del><ins>+    static PassRefPtr&lt;LegacyWebArchive&gt; create(PassRefPtr&lt;ArchiveResource&gt; mainResource, Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; subresources, Vector&lt;RefPtr&lt;LegacyWebArchive&gt;&gt; subframeArchives);
</ins><span class="cx">     static PassRefPtr&lt;LegacyWebArchive&gt; create(Node*, std::function&lt;bool (Frame&amp;)&gt; frameFilter = nullptr);
</span><span class="cx">     static PassRefPtr&lt;LegacyWebArchive&gt; create(Frame*);
</span><span class="cx">     static PassRefPtr&lt;LegacyWebArchive&gt; createFromSelection(Frame*);
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestProgressEventThrottlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -140,16 +140,13 @@
</span><span class="cx">     m_deferEvents = false;
</span><span class="cx"> 
</span><span class="cx">     // Take over the deferred events before dispatching them which can potentially add more.
</span><del>-    Vector&lt;RefPtr&lt;Event&gt;&gt; deferredEvents;
-    m_deferredEvents.swap(deferredEvents);
</del><ins>+    auto deferredEvents = std::move(m_deferredEvents);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Event&gt; deferredProgressEvent = m_deferredProgressEvent;
</span><del>-    m_deferredProgressEvent = 0;
</del><ins>+    m_deferredProgressEvent = nullptr;
</ins><span class="cx"> 
</span><del>-    Vector&lt;RefPtr&lt;Event&gt;&gt;::const_iterator it = deferredEvents.begin();
-    const Vector&lt;RefPtr&lt;Event&gt;&gt;::const_iterator end = deferredEvents.end();
-    for (; it != end; ++it)
-        dispatchEvent(*it);
</del><ins>+    for (auto&amp; deferredEvent : deferredEvents)
+        dispatchEvent(deferredEvent.release());
</ins><span class="cx"> 
</span><span class="cx">     // The progress event will be in the m_deferredEvents vector if the load was finished while suspended.
</span><span class="cx">     // If not, just send the most up-to-date progress on resume.
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-06-18  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Adopt modern C++11 loops and fix WebArchive creation functions
+        https://bugs.webkit.org/show_bug.cgi?id=134032
+
+        Reviewed by Andreas Kling.
+
+        * WebView/WebArchive.mm:
+        (-[WebArchive initWithMainResource:subresources:subframeArchives:]):
+        * WebView/WebDataSource.mm:
+        (-[WebDataSource subresources]):
+
</ins><span class="cx"> 2014-06-15  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add an autorelease() member function to RetainPtr
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebArchivemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebArchive.mm (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebArchive.mm        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebKit/mac/WebView/WebArchive.mm        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -178,24 +178,22 @@
</span><span class="cx">     
</span><span class="cx">     RefPtr&lt;ArchiveResource&gt; coreMainResource = mainResource ? [mainResource _coreResource] : 0;
</span><span class="cx"> 
</span><del>-    Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt; coreResources;
-    NSEnumerator *enumerator = [subresources objectEnumerator];
-    WebResource *subresource;
-    while ((subresource = [enumerator nextObject]) != nil)
</del><ins>+    Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; coreResources;
+    for (WebResource *subresource in subresources)
</ins><span class="cx">         coreResources.append([subresource _coreResource]);
</span><span class="cx"> 
</span><del>-    Vector&lt;PassRefPtr&lt;LegacyWebArchive&gt;&gt; coreArchives;
-    enumerator = [subframeArchives objectEnumerator];
-    WebArchive *subframeArchive;
-    while ((subframeArchive = [enumerator nextObject]) != nil)
</del><ins>+    Vector&lt;RefPtr&lt;LegacyWebArchive&gt;&gt; coreArchives;
+    for (WebArchive *subframeArchive in subframeArchives)
</ins><span class="cx">         coreArchives.append([subframeArchive-&gt;_private coreArchive]);
</span><span class="cx"> 
</span><del>-    [_private setCoreArchive:LegacyWebArchive::create(coreMainResource.release(), coreResources, coreArchives)];
-    if (![_private coreArchive]) {
</del><ins>+    RefPtr&lt;LegacyWebArchive&gt; coreArchive = LegacyWebArchive::create(coreMainResource.release(), std::move(coreResources), std::move(coreArchives));
+    if (!coreArchive) {
</ins><span class="cx">         [self release];
</span><span class="cx">         return nil;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    [_private setCoreArchive:coreArchive.release()];
+
</ins><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebDataSourcemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebDataSource.mm (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebDataSource.mm        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebKit/mac/WebView/WebDataSource.mm        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -606,19 +606,15 @@
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)subresources
</span><span class="cx"> {
</span><del>-    Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt; coreSubresources;
-    toPrivate(_private)-&gt;loader-&gt;getSubresources(coreSubresources);
</del><ins>+    auto coreSubresources = toPrivate(_private)-&gt;loader-&gt;subresources();
</ins><span class="cx"> 
</span><del>-    NSMutableArray *subresources = [[NSMutableArray alloc] initWithCapacity:coreSubresources.size()];
-    for (unsigned i = 0; i &lt; coreSubresources.size(); ++i) {
-        WebResource *resource = [[WebResource alloc] _initWithCoreResource:coreSubresources[i]];
-        if (resource) {
-            [subresources addObject:resource];
-            [resource release];
-        }
</del><ins>+    auto subresources = adoptNS([[NSMutableArray alloc] initWithCapacity:coreSubresources.size()]);
+    for (const auto&amp; coreSubresource : coreSubresources) {
+        if (auto resource = adoptNS([[WebResource alloc] _initWithCoreResource:coreSubresource]))
+            [subresources addObject:resource.get()];
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return [subresources autorelease];
</del><ins>+    return subresources.autorelease();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (WebResource *)subresourceForURL:(NSURL *)URL
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -1,5 +1,15 @@
</span><span class="cx"> 2014-06-18  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Adopt modern C++11 loops and fix WebArchive creation functions
+        https://bugs.webkit.org/show_bug.cgi?id=134032
+
+        Reviewed by Andreas Kling.
+
+        * Shared/APIWebArchive.cpp:
+        (API::WebArchive::WebArchive):
+
+2014-06-18  Anders Carlsson  &lt;andersca@apple.com&gt;
+
</ins><span class="cx">         Give WKWebView on iOS a mobile user agent
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=134034
</span><span class="cx">         &lt;rdar://problem/17346489&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIWebArchivecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/APIWebArchive.cpp (170112 => 170113)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/APIWebArchive.cpp        2014-06-18 19:19:52 UTC (rev 170112)
+++ trunk/Source/WebKit2/Shared/APIWebArchive.cpp        2014-06-18 19:40:25 UTC (rev 170113)
</span><span class="lines">@@ -65,21 +65,24 @@
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;ArchiveResource&gt; coreMainResource = m_cachedMainResource-&gt;coreArchiveResource();
</span><span class="cx"> 
</span><del>-    Vector&lt;PassRefPtr&lt;ArchiveResource&gt;&gt; coreArchiveResources;
</del><ins>+    Vector&lt;RefPtr&lt;ArchiveResource&gt;&gt; coreArchiveResources;
+    coreArchiveResources.reserveInitialCapacity(m_cachedSubresources-&gt;size());
</ins><span class="cx">     for (size_t i = 0; i &lt; m_cachedSubresources-&gt;size(); ++i) {
</span><span class="cx">         RefPtr&lt;WebArchiveResource&gt; resource = m_cachedSubresources-&gt;at&lt;WebArchiveResource&gt;(i);
</span><span class="cx">         ASSERT(resource);
</span><del>-        coreArchiveResources.append(resource-&gt;coreArchiveResource());
</del><ins>+        coreArchiveResources.uncheckedAppend(resource-&gt;coreArchiveResource());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Vector&lt;PassRefPtr&lt;LegacyWebArchive&gt;&gt; coreSubframeLegacyWebArchives;
</del><ins>+    Vector&lt;RefPtr&lt;LegacyWebArchive&gt;&gt; coreSubframeLegacyWebArchives;
+    coreSubframeLegacyWebArchives.reserveInitialCapacity(m_cachedSubframeArchives-&gt;size());
+
</ins><span class="cx">     for (size_t i = 0; i &lt; m_cachedSubframeArchives-&gt;size(); ++i) {
</span><span class="cx">         RefPtr&lt;WebArchive&gt; subframeWebArchive = m_cachedSubframeArchives-&gt;at&lt;WebArchive&gt;(i);
</span><span class="cx">         ASSERT(subframeWebArchive);
</span><del>-        coreSubframeLegacyWebArchives.append(subframeWebArchive-&gt;coreLegacyWebArchive());
</del><ins>+        coreSubframeLegacyWebArchives.uncheckedAppend(subframeWebArchive-&gt;coreLegacyWebArchive());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_legacyWebArchive = LegacyWebArchive::create(coreMainResource.release(), coreArchiveResources, coreSubframeLegacyWebArchives);
</del><ins>+    m_legacyWebArchive = LegacyWebArchive::create(coreMainResource.release(), std::move(coreArchiveResources), std::move(coreSubframeLegacyWebArchives));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebArchive::WebArchive(API::Data* data)
</span></span></pre>
</div>
</div>

</body>
</html>