Title: [190338] trunk/Source/WebCore
Revision
190338
Author
commit-qu...@webkit.org
Date
2015-09-29 22:53:51 -0700 (Tue, 29 Sep 2015)

Log Message

Use modern for-loops in WebCore/loader.
https://bugs.webkit.org/show_bug.cgi?id=149397

Patch by Hunseop Jeong <hs85.je...@samsung.com> on 2015-09-29
Reviewed by Darin Adler.

No new tests because there is no behavior change.

* loader/CrossOriginAccessControl.cpp:
(WebCore::parseAccessControlExposeHeadersAllowList):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::substituteResourceDeliveryTimerFired):
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::~FrameLoader):
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::detachChildren):
(WebCore::FrameLoader::shouldClose):
(WebCore::FrameLoader::tellClientAboutPastMemoryCacheLoads):
* loader/HistoryController.cpp:
(WebCore::HistoryController::currentFramesMatchItem):
* loader/SubframeLoader.cpp:
(WebCore::findPluginMIMETypeFromURL):
(WebCore::SubframeLoader::createJavaAppletWidget):
* loader/appcache/ApplicationCache.cpp:
(WebCore::ApplicationCache::isURLInOnlineWhitelist):
(WebCore::ApplicationCache::urlMatchesFallbackNamespace):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
(WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
(WebCore::ApplicationCacheGroup::postListenerTask):
* loader/appcache/ApplicationCacheHost.cpp:
(WebCore::ApplicationCacheHost::stopDeferringEvents):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::StorageIDJournal::~StorageIDJournal):
(WebCore::ApplicationCacheStorage::store):
(WebCore::ApplicationCacheStorage::getOriginsWithCache):
* loader/archive/Archive.cpp:
(WebCore::Archive::clearAllSubframeArchivesImpl):
* loader/archive/ArchiveResourceCollection.cpp:
(WebCore::ArchiveResourceCollection::addAllResources):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createPropertyListRepresentation):
(WebCore::LegacyWebArchive::create):
* loader/archive/mhtml/MHTMLArchive.cpp:
(WebCore::MHTMLArchive::generateMHTMLData):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::switchClientsToRevalidatedResource):
(WebCore::CachedImage::createImage):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::switchClientsToRevalidatedResource):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::~CachedResourceLoader):
(WebCore::CachedResourceLoader::reloadImagesIfNotDeferred):
(WebCore::CachedResourceLoader::garbageCollectDocumentResources):
(WebCore::CachedResourceLoader::isPreloaded):
(WebCore::CachedResourceLoader::printPreloadStats):
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::removeAllIcons):
(WebCore::IconDatabase::setIconDataForIconURL):
(WebCore::IconDatabase::iconRecordCountWithData):
(WebCore::IconDatabase::notifyPendingLoadDecisions):
(WebCore::IconDatabase::performURLImport):
(WebCore::IconDatabase::performPendingRetainAndReleaseOperations):
(WebCore::IconDatabase::readFromDatabase):
(WebCore::IconDatabase::writeToDatabase):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (190337 => 190338)


--- trunk/Source/WebCore/ChangeLog	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/ChangeLog	2015-09-30 05:53:51 UTC (rev 190338)
@@ -1,3 +1,72 @@
+2015-09-29  Hunseop Jeong  <hs85.je...@samsung.com>
+
+        Use modern for-loops in WebCore/loader.
+        https://bugs.webkit.org/show_bug.cgi?id=149397
+
+        Reviewed by Darin Adler.
+
+        No new tests because there is no behavior change.
+
+        * loader/CrossOriginAccessControl.cpp:
+        (WebCore::parseAccessControlExposeHeadersAllowList):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::substituteResourceDeliveryTimerFired):
+        * loader/FormSubmission.cpp:
+        (WebCore::FormSubmission::create):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::~FrameLoader):
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        (WebCore::FrameLoader::detachChildren):
+        (WebCore::FrameLoader::shouldClose):
+        (WebCore::FrameLoader::tellClientAboutPastMemoryCacheLoads):
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::currentFramesMatchItem):
+        * loader/SubframeLoader.cpp:
+        (WebCore::findPluginMIMETypeFromURL):
+        (WebCore::SubframeLoader::createJavaAppletWidget):
+        * loader/appcache/ApplicationCache.cpp:
+        (WebCore::ApplicationCache::isURLInOnlineWhitelist):
+        (WebCore::ApplicationCache::urlMatchesFallbackNamespace):
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
+        (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
+        (WebCore::ApplicationCacheGroup::postListenerTask):
+        * loader/appcache/ApplicationCacheHost.cpp:
+        (WebCore::ApplicationCacheHost::stopDeferringEvents):
+        * loader/appcache/ApplicationCacheStorage.cpp:
+        (WebCore::StorageIDJournal::~StorageIDJournal):
+        (WebCore::ApplicationCacheStorage::store):
+        (WebCore::ApplicationCacheStorage::getOriginsWithCache):
+        * loader/archive/Archive.cpp:
+        (WebCore::Archive::clearAllSubframeArchivesImpl):
+        * loader/archive/ArchiveResourceCollection.cpp:
+        (WebCore::ArchiveResourceCollection::addAllResources):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::createPropertyListRepresentation):
+        (WebCore::LegacyWebArchive::create):
+        * loader/archive/mhtml/MHTMLArchive.cpp:
+        (WebCore::MHTMLArchive::generateMHTMLData):
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::switchClientsToRevalidatedResource):
+        (WebCore::CachedImage::createImage):
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::switchClientsToRevalidatedResource):
+        * loader/cache/CachedResourceLoader.cpp:
+        (WebCore::CachedResourceLoader::~CachedResourceLoader):
+        (WebCore::CachedResourceLoader::reloadImagesIfNotDeferred):
+        (WebCore::CachedResourceLoader::garbageCollectDocumentResources):
+        (WebCore::CachedResourceLoader::isPreloaded):
+        (WebCore::CachedResourceLoader::printPreloadStats):
+        * loader/icon/IconDatabase.cpp:
+        (WebCore::IconDatabase::removeAllIcons):
+        (WebCore::IconDatabase::setIconDataForIconURL):
+        (WebCore::IconDatabase::iconRecordCountWithData):
+        (WebCore::IconDatabase::notifyPendingLoadDecisions):
+        (WebCore::IconDatabase::performURLImport):
+        (WebCore::IconDatabase::performPendingRetainAndReleaseOperations):
+        (WebCore::IconDatabase::readFromDatabase):
+        (WebCore::IconDatabase::writeToDatabase):
+
 2015-09-29  Chris Dumez  <cdu...@apple.com>
 
         sectionRowIndex must return -1 when its parent is not a table, tbody, thead, or tfoot

Modified: trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -170,8 +170,8 @@
 {
     Vector<String> headers;
     headerValue.split(',', false, headers);
-    for (unsigned headerCount = 0; headerCount < headers.size(); headerCount++) {
-        String strippedHeader = headers[headerCount].stripWhiteSpace();
+    for (auto& header : headers) {
+        String strippedHeader = header.stripWhiteSpace();
         if (!strippedHeader.isEmpty())
             headerSet.add(strippedHeader);
     }

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -1148,11 +1148,10 @@
     SubstituteResourceMap copy;
     copy.swap(m_pendingSubstituteResources);
 
-    SubstituteResourceMap::const_iterator end = copy.end();
-    for (SubstituteResourceMap::const_iterator it = copy.begin(); it != end; ++it) {
-        RefPtr<ResourceLoader> loader = it->key;
-        SubstituteResource* resource = it->value.get();
-        
+    for (auto& entry : copy) {
+        auto& loader = entry.key;
+        SubstituteResource* resource = entry.value.get();
+
         if (resource)
             resource->deliver(*loader);
         else {

Modified: trunk/Source/WebCore/loader/FormSubmission.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/FormSubmission.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/FormSubmission.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -201,11 +201,10 @@
     Vector<std::pair<String, String>> formValues;
 
     bool containsPasswordData = false;
-    for (unsigned i = 0; i < form->associatedElements().size(); ++i) {
-        FormAssociatedElement& control = *form->associatedElements()[i];
-        HTMLElement& element = control.asHTMLElement();
+    for (auto& control : form->associatedElements()) {
+        HTMLElement& element = control->asHTMLElement();
         if (!element.isDisabledFormControl())
-            control.appendFormData(*domFormData, isMultiPartForm);
+            control->appendFormData(*domFormData, isMultiPartForm);
         if (is<HTMLInputElement>(element)) {
             HTMLInputElement& input = downcast<HTMLInputElement>(element);
             if (input.isTextField()) {

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -244,9 +244,8 @@
 {
     setOpener(nullptr);
 
-    HashSet<Frame*>::iterator end = m_openedFrames.end();
-    for (HashSet<Frame*>::iterator it = m_openedFrames.begin(); it != end; ++it)
-        (*it)->loader().m_opener = 0;
+    for (auto& frame : m_openedFrames)
+        frame->loader().m_opener = nullptr;
 
     m_client.frameLoaderDestroyed();
 
@@ -1858,10 +1857,7 @@
         m_frame.view()->forceLayout();
 #endif
 
-        const ResponseVector& responses = m_documentLoader->responses();
-        size_t count = responses.size();
-        for (size_t i = 0; i < count; i++) {
-            const ResourceResponse& response = responses[i];
+        for (auto& response : m_documentLoader->responses()) {
             // FIXME: If the WebKit client changes or cancels the request, this is not respected.
             ResourceError error;
             unsigned long identifier;
@@ -2428,8 +2424,8 @@
     childrenToDetach.reserveInitialCapacity(m_frame.tree().childCount());
     for (Frame* child = m_frame.tree().lastChild(); child; child = child->tree().previousSibling())
         childrenToDetach.uncheckedAppend(*child);
-    for (unsigned i = 0; i < childrenToDetach.size(); ++i)
-        childrenToDetach[i]->loader().detachFromParent();
+    for (auto& child : childrenToDetach)
+        child->loader().detachFromParent();
 }
 
 void FrameLoader::closeAndRemoveChild(Frame* child)
@@ -3432,9 +3428,8 @@
     Vector<ResourceRequest> pastLoads;
     m_documentLoader->takeMemoryCacheLoadsForClientNotification(pastLoads);
 
-    size_t size = pastLoads.size();
-    for (size_t i = 0; i < size; ++i) {
-        CachedResource* resource = MemoryCache::singleton().resourceForRequest(pastLoads[i], m_frame.page()->sessionID());
+    for (auto& pastLoad : pastLoads) {
+        CachedResource* resource = MemoryCache::singleton().resourceForRequest(pastLoad, m_frame.page()->sessionID());
 
         // FIXME: These loads, loaded from cache, but now gone from the cache by the time
         // Page::setMemoryCacheClientCallsEnabled(true) is called, will not be seen by the client.

Modified: trunk/Source/WebCore/loader/HistoryController.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/HistoryController.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/HistoryController.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -779,9 +779,8 @@
     if (childItems.size() != m_frame.tree().childCount())
         return false;
     
-    unsigned size = childItems.size();
-    for (unsigned i = 0; i < size; ++i) {
-        if (!m_frame.tree().child(childItems[i]->target()))
+    for (auto& item : childItems) {
+        if (!m_frame.tree().child(item->target()))
             return false;
     }
     

Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/SubframeLoader.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -171,11 +171,10 @@
     Vector<MimeClassInfo> mimes;
     Vector<size_t> mimePluginIndices;
     pluginData.getWebVisibleMimesAndPluginIndices(mimes, mimePluginIndices);
-    for (size_t i = 0; i < mimes.size(); ++i) {
-        const MimeClassInfo& mimeClassInfo = mimes[i];
-        for (size_t j = 0; j < mimeClassInfo.extensions.size(); ++j) {
-            if (equalIgnoringCase(extension, mimeClassInfo.extensions[j]))
-                return mimeClassInfo.type;
+    for (auto& mime : mimes) {
+        for (auto& mimeExtension : mime.extensions) {
+            if (equalIgnoringCase(extension, mimeExtension))
+                return mime.type;
         }
     }
 

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCache.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -153,9 +153,8 @@
 
 bool ApplicationCache::isURLInOnlineWhitelist(const URL& url)
 {
-    size_t whitelistSize = m_onlineWhitelist.size();
-    for (size_t i = 0; i < whitelistSize; ++i) {
-        if (protocolHostAndPortAreEqual(url, m_onlineWhitelist[i]) && url.string().startsWith(m_onlineWhitelist[i].string()))
+    for (auto& whitelistURL : m_onlineWhitelist) {
+        if (protocolHostAndPortAreEqual(url, whitelistURL) && url.string().startsWith(whitelistURL.string()))
             return true;
     }
     return false;
@@ -171,11 +170,10 @@
 
 bool ApplicationCache::urlMatchesFallbackNamespace(const URL& url, URL* fallbackURL)
 {
-    size_t fallbackCount = m_fallbackURLs.size();
-    for (size_t i = 0; i < fallbackCount; ++i) {
-        if (protocolHostAndPortAreEqual(url, m_fallbackURLs[i].first) && url.string().startsWith(m_fallbackURLs[i].first.string())) {
+    for (auto& fallback : m_fallbackURLs) {
+        if (protocolHostAndPortAreEqual(url, fallback.first) && url.string().startsWith(fallback.first.string())) {
             if (fallbackURL)
-                *fallbackURL = m_fallbackURLs[i].second;
+                *fallbackURL = fallback.second;
             return true;
         }
     }

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -729,9 +729,8 @@
     m_cacheBeingUpdated = ApplicationCache::create();
     m_cacheBeingUpdated->setGroup(this);
 
-    HashSet<DocumentLoader*>::const_iterator masterEnd = m_pendingMasterResourceLoaders.end();
-    for (HashSet<DocumentLoader*>::const_iterator iter = m_pendingMasterResourceLoaders.begin(); iter != masterEnd; ++iter)
-        associateDocumentLoaderWithCache(*iter, m_cacheBeingUpdated.get());
+    for (auto& loader : m_pendingMasterResourceLoaders)
+        associateDocumentLoaderWithCache(loader, m_cacheBeingUpdated.get());
 
     // We have the manifest, now download the resources.
     setUpdateStatus(Downloading);
@@ -751,9 +750,8 @@
     for (const auto& explicitURL : manifest.explicitURLs)
         addEntry(explicitURL, ApplicationCacheResource::Explicit);
 
-    size_t fallbackCount = manifest.fallbackURLs.size();
-    for (size_t i = 0; i  < fallbackCount; ++i)
-        addEntry(manifest.fallbackURLs[i].second, ApplicationCacheResource::Fallback);
+    for (auto& fallbackURL : manifest.fallbackURLs)
+        addEntry(fallbackURL.second, ApplicationCacheResource::Fallback);
     
     m_cacheBeingUpdated->setOnlineWhitelist(manifest.onlineWhitelistedURLs);
     m_cacheBeingUpdated->setFallbackURLs(manifest.fallbackURLs);
@@ -941,9 +939,8 @@
             // Need to copy loaders, because the cache group may be destroyed at the end of iteration.
             Vector<DocumentLoader*> loaders;
             copyToVector(m_pendingMasterResourceLoaders, loaders);
-            size_t count = loaders.size();
-            for (size_t i = 0; i != count; ++i)
-                disassociateDocumentLoader(loaders[i]); // This can delete this group.
+            for (auto& loader : loaders)
+                disassociateDocumentLoader(loader); // This can delete this group.
 
             // Reinstate the oldNewestCache, if there was one.
             if (oldNewestCache) {
@@ -1079,9 +1076,8 @@
 
 void ApplicationCacheGroup::postListenerTask(ApplicationCacheHost::EventID eventID, int progressTotal, int progressDone, const HashSet<DocumentLoader*>& loaderSet)
 {
-    HashSet<DocumentLoader*>::const_iterator loaderSetEnd = loaderSet.end();
-    for (HashSet<DocumentLoader*>::const_iterator iter = loaderSet.begin(); iter != loaderSetEnd; ++iter)
-        postListenerTask(eventID, progressTotal, progressDone, *iter);
+    for (auto& loader : loaderSet)
+        postListenerTask(eventID, progressTotal, progressDone, loader);
 }
 
 void ApplicationCacheGroup::postListenerTask(ApplicationCacheHost::EventID eventID, int progressTotal, int progressDone, DocumentLoader* loader)

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -305,10 +305,8 @@
 void ApplicationCacheHost::stopDeferringEvents()
 {
     Ref<DocumentLoader> protect(m_documentLoader);
-    for (unsigned i = 0; i < m_deferredEvents.size(); ++i) {
-        const DeferredEvent& deferred = m_deferredEvents[i];
-        dispatchDOMEvent(deferred.eventID, deferred.progressTotal, deferred.progressDone);
-    }
+    for (auto& event : m_deferredEvents)
+        dispatchDOMEvent(event.eventID, event.progressTotal, event.progressDone);
     m_deferredEvents.clear();
     m_defersEvents = false;
 }

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -50,9 +50,8 @@
 public:  
     ~StorageIDJournal()
     {
-        size_t size = m_records.size();
-        for (size_t i = 0; i < size; ++i)
-            m_records[i].restore();
+        for (auto& record : m_records)
+            record.restore();
     }
 
     void add(T* resource, unsigned storageID)
@@ -751,12 +750,11 @@
     // Store the online whitelist
     const Vector<URL>& _onlineWhitelist_ = cache->onlineWhitelist();
     {
-        size_t whitelistSize = onlineWhitelist.size();
-        for (size_t i = 0; i < whitelistSize; ++i) {
+        for (auto& whitelistURL : onlineWhitelist) {
             SQLiteStatement statement(m_database, "INSERT INTO CacheWhitelistURLs (url, cache) VALUES (?, ?)");
             statement.prepare();
 
-            statement.bindText(1, onlineWhitelist[i]);
+            statement.bindText(1, whitelistURL);
             statement.bindInt64(2, cacheStorageID);
 
             if (!executeStatement(statement))
@@ -779,13 +777,12 @@
     // Store fallback URLs.
     const FallbackURLVector& fallbackURLs = cache->fallbackURLs();
     {
-        size_t fallbackCount = fallbackURLs.size();
-        for (size_t i = 0; i < fallbackCount; ++i) {
+        for (auto& fallbackURL : fallbackURLs) {
             SQLiteStatement statement(m_database, "INSERT INTO FallbackURLs (namespace, fallbackURL, cache) VALUES (?, ?, ?)");
             statement.prepare();
 
-            statement.bindText(1, fallbackURLs[i].first);
-            statement.bindText(2, fallbackURLs[i].second);
+            statement.bindText(1, fallbackURL.first);
+            statement.bindText(2, fallbackURL.second);
             statement.bindInt64(3, cacheStorageID);
 
             if (!executeStatement(statement))
@@ -1529,9 +1526,8 @@
 
     // Multiple manifest URLs might share the same SecurityOrigin, so we might be creating extra, wasted origins here.
     // The current schema doesn't allow for a more efficient way of building this list.
-    size_t count = urls.size();
-    for (size_t i = 0; i < count; ++i)
-        origins.add(SecurityOrigin::create(urls[i]));
+    for (auto& url : urls)
+        origins.add(SecurityOrigin::create(url));
 }
 
 void ApplicationCacheStorage::deleteAllEntries()

Modified: trunk/Source/WebCore/loader/archive/Archive.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/archive/Archive.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/archive/Archive.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -43,10 +43,10 @@
 
 void Archive::clearAllSubframeArchivesImpl(Vector<RefPtr<Archive>>* clearedArchives)
 {
-    for (Vector<RefPtr<Archive>>::iterator it = m_subframeArchives.begin(); it != m_subframeArchives.end(); ++it) {
-        if (!clearedArchives->contains(*it)) {
-            clearedArchives->append(*it);
-            (*it)->clearAllSubframeArchivesImpl(clearedArchives);
+    for (auto& archive : m_subframeArchives) {
+        if (!clearedArchives->contains(archive)) {
+            clearedArchives->append(archive);
+            archive->clearAllSubframeArchivesImpl(clearedArchives);
         }
     }
     m_subframeArchives.clear();

Modified: trunk/Source/WebCore/loader/archive/ArchiveResourceCollection.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/archive/ArchiveResourceCollection.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/archive/ArchiveResourceCollection.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -41,21 +41,18 @@
     if (!archive)
         return;
 
-    const Vector<RefPtr<ArchiveResource>>& subresources = archive->subresources();
-    for (Vector<RefPtr<ArchiveResource>>::const_iterator iterator = subresources.begin(); iterator != subresources.end(); ++iterator)
-        m_subresources.set((*iterator)->url(), iterator->get());
+    for (auto& subresource : archive->subresources())
+        m_subresources.set(subresource->url(), subresource.get());
 
-    const Vector<RefPtr<Archive>>& subframes = archive->subframeArchives();
-    for (Vector<RefPtr<Archive>>::const_iterator iterator = subframes.begin(); iterator != subframes.end(); ++iterator) {
-        RefPtr<Archive> archive = *iterator;
-        ASSERT(archive->mainResource());
+    for (auto& subframeArchive : archive->subframeArchives()) {
+        ASSERT(subframeArchive->mainResource());
 
-        const String& frameName = archive->mainResource()->frameName();
+        const String& frameName = subframeArchive->mainResource()->frameName();
         if (!frameName.isNull())
-            m_subframes.set(frameName, archive.get());
+            m_subframes.set(frameName, subframeArchive.get());
         else {
             // In the MHTML case, frames don't have a name so we use the URL instead.
-            m_subframes.set(archive->mainResource()->url().string(), archive.get());
+            m_subframes.set(subframeArchive->mainResource()->url().string(), subframeArchive.get());
         }
     }
 }

Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -133,10 +133,8 @@
     CFDictionarySetValue(propertyList.get(), LegacyWebArchiveMainResourceKey, mainResourceDict.get());
 
     RetainPtr<CFMutableArrayRef> subresourcesArray = adoptCF(CFArrayCreateMutable(0, archive->subresources().size(), &kCFTypeArrayCallBacks));
-    const Vector<RefPtr<ArchiveResource>>& subresources(archive->subresources());
-    for (unsigned i = 0; i < subresources.size(); ++i) {
-        RetainPtr<CFDictionaryRef> subresource = createPropertyListRepresentation(subresources[i].get(), Subresource);
-        if (subresource)
+    for (auto& resource : archive->subresources()) {
+        if (RetainPtr<CFDictionaryRef> subresource = createPropertyListRepresentation(resource.get(), Subresource))
             CFArrayAppendValue(subresourcesArray.get(), subresource.get());
         else
             LOG(Archives, "LegacyWebArchive - Failed to create property list for subresource");
@@ -145,10 +143,8 @@
         CFDictionarySetValue(propertyList.get(), LegacyWebArchiveSubresourcesKey, subresourcesArray.get());
 
     RetainPtr<CFMutableArrayRef> subframesArray = adoptCF(CFArrayCreateMutable(0, archive->subframeArchives().size(), &kCFTypeArrayCallBacks));
-    const Vector<RefPtr<Archive>>& subframeArchives(archive->subframeArchives());
-    for (unsigned i = 0; i < subframeArchives.size(); ++i) {
-        RetainPtr<CFDictionaryRef> subframeArchive = createPropertyListRepresentation(subframeArchives[i].get());
-        if (subframeArchive)
+    for (auto& subframe : archive->subframeArchives()) {
+        if (RetainPtr<CFDictionaryRef> subframeArchive = createPropertyListRepresentation(subframe.get()))
             CFArrayAppendValue(subframesArray.get(), subframeArchive.get());
         else
             LOG(Archives, "LegacyWebArchive - Failed to create property list for subframe archive");
@@ -246,12 +242,12 @@
     RefPtr<LegacyWebArchive> archive = create();
     archive->setMainResource(mainResource);
     
-    for (unsigned i = 0; i < subresources.size(); ++i)
-        archive->addSubresource(WTF::move(subresources[i]));
-    
-    for (unsigned i = 0; i < subframeArchives.size(); ++i)
-        archive->addSubframeArchive(WTF::move(subframeArchives[i]));
-        
+    for (auto& subresource : subresources)
+        archive->addSubresource(WTF::move(subresource));
+
+    for (auto& subframeArchive : subframeArchives)
+        archive->addSubframeArchive(WTF::move(subframeArchive));
+
     return archive.release();
 }
 

Modified: trunk/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -176,9 +176,7 @@
     RefPtr<SharedBuffer> mhtmlData = SharedBuffer::create();
     mhtmlData->append(asciiString.data(), asciiString.length());
 
-    for (size_t i = 0; i < resources.size(); ++i) {
-        const PageSerializer::Resource& resource = resources[i];
-
+    for (auto& resource : resources) {
         stringBuilder.clear();
         stringBuilder.append(endOfResourceBoundary);
         stringBuilder.append("Content-Type: ");

Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/cache/CachedImage.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -149,12 +149,12 @@
     if (!m_pendingContainerSizeRequests.isEmpty()) {
         // A copy of pending size requests is needed as they are deleted during CachedResource::switchClientsToRevalidateResouce().
         ContainerSizeRequests switchContainerSizeRequests;
-        for (ContainerSizeRequests::iterator it = m_pendingContainerSizeRequests.begin(); it != m_pendingContainerSizeRequests.end(); ++it)
-            switchContainerSizeRequests.set(it->key, it->value);
+        for (auto& request : m_pendingContainerSizeRequests)
+            switchContainerSizeRequests.set(request.key, request.value);
         CachedResource::switchClientsToRevalidatedResource();
         CachedImage& revalidatedCachedImage = downcast<CachedImage>(*resourceToRevalidate());
-        for (ContainerSizeRequests::iterator it = switchContainerSizeRequests.begin(); it != switchContainerSizeRequests.end(); ++it)
-            revalidatedCachedImage.setContainerSizeForRenderer(it->key, it->value.first, it->value.second);
+        for (auto& request : switchContainerSizeRequests)
+            revalidatedCachedImage.setContainerSizeForRenderer(request.key, request.value.first, request.value.second);
         return;
     }
 
@@ -353,8 +353,8 @@
     if (m_image) {
         // Send queued container size requests.
         if (m_image->usesContainerSize()) {
-            for (ContainerSizeRequests::iterator it = m_pendingContainerSizeRequests.begin(); it != m_pendingContainerSizeRequests.end(); ++it)
-                setContainerSizeForRenderer(it->key, it->value.first, it->value.second);
+            for (auto& request : m_pendingContainerSizeRequests)
+                setContainerSizeForRenderer(request.key, request.value.first, request.value.second);
         }
         m_pendingContainerSizeRequests.clear();
     }

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -625,9 +625,7 @@
     LOG(ResourceLoading, "CachedResource %p switchClientsToRevalidatedResource %p", this, m_resourceToRevalidate);
 
     m_switchingClientsToRevalidatedResource = true;
-    HashSet<CachedResourceHandleBase*>::iterator end = m_handlesToRevalidate.end();
-    for (HashSet<CachedResourceHandleBase*>::iterator it = m_handlesToRevalidate.begin(); it != end; ++it) {
-        CachedResourceHandleBase* handle = *it;
+    for (auto& handle : m_handlesToRevalidate) {
         handle->m_resource = m_resourceToRevalidate;
         m_resourceToRevalidate->registerHandle(handle);
         --m_handleCount;
@@ -636,30 +634,28 @@
     m_handlesToRevalidate.clear();
 
     Vector<CachedResourceClient*> clientsToMove;
-    HashCountedSet<CachedResourceClient*>::iterator end2 = m_clients.end();
-    for (HashCountedSet<CachedResourceClient*>::iterator it = m_clients.begin(); it != end2; ++it) {
-        CachedResourceClient* client = it->key;
-        unsigned count = it->value;
+    for (auto& entry : m_clients) {
+        CachedResourceClient* client = entry.key;
+        unsigned count = entry.value;
         while (count) {
             clientsToMove.append(client);
             --count;
         }
     }
 
-    unsigned moveCount = clientsToMove.size();
-    for (unsigned n = 0; n < moveCount; ++n)
-        removeClient(clientsToMove[n]);
+    for (auto& client : clientsToMove)
+        removeClient(client);
     ASSERT(m_clients.isEmpty());
 
-    for (unsigned n = 0; n < moveCount; ++n)
-        m_resourceToRevalidate->addClientToSet(clientsToMove[n]);
-    for (unsigned n = 0; n < moveCount; ++n) {
+    for (auto& client : clientsToMove)
+        m_resourceToRevalidate->addClientToSet(client);
+    for (auto& client : clientsToMove) {
         // Calling didAddClient may do anything, including trying to cancel revalidation.
         // Assert that it didn't succeed.
         ASSERT(m_resourceToRevalidate);
         // Calling didAddClient for a client may end up removing another client. In that case it won't be in the set anymore.
-        if (m_resourceToRevalidate->m_clients.contains(clientsToMove[n]))
-            m_resourceToRevalidate->didAddClient(clientsToMove[n]);
+        if (m_resourceToRevalidate->m_clients.contains(client))
+            m_resourceToRevalidate->didAddClient(client);
     }
     m_switchingClientsToRevalidatedResource = false;
 }

Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -138,9 +138,8 @@
     m_document = 0;
 
     clearPreloads();
-    DocumentResourceMap::iterator end = m_documentResources.end();
-    for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != end; ++it)
-        it->value->setOwningCachedResourceLoader(0);
+    for (auto& resource : m_documentResources.values())
+        resource->setOwningCachedResourceLoader(nullptr);
 
     // Make sure no requests still point to this CachedResourceLoader
     ASSERT(m_requestCount == 0);
@@ -861,9 +860,7 @@
 
 void CachedResourceLoader::reloadImagesIfNotDeferred()
 {
-    DocumentResourceMap::iterator end = m_documentResources.end();
-    for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != end; ++it) {
-        CachedResource* resource = it->value.get();
+    for (auto& resource : m_documentResources.values()) {
         if (is<CachedImage>(*resource) && resource->stillNeedsLoad() && !clientDefersImage(resource->url()))
             downcast<CachedImage>(*resource).load(*this, defaultCachedResourceOptions());
     }
@@ -945,15 +942,15 @@
     typedef Vector<String, 10> StringVector;
     StringVector resourcesToDelete;
 
-    for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != m_documentResources.end(); ++it) {
-        if (it->value->hasOneHandle()) {
-            resourcesToDelete.append(it->key);
-            it->value->setOwningCachedResourceLoader(0);
+    for (auto& resource : m_documentResources) {
+        if (resource.value->hasOneHandle()) {
+            resourcesToDelete.append(resource.key);
+            resource.value->setOwningCachedResourceLoader(nullptr);
         }
     }
 
-    for (StringVector::const_iterator it = resourcesToDelete.begin(); it != resourcesToDelete.end(); ++it)
-        m_documentResources.remove(*it);
+    for (auto& resource : resourcesToDelete)
+        m_documentResources.remove(resource);
 }
 
 void CachedResourceLoader::performPostLoadActions()
@@ -1049,17 +1046,13 @@
     const URL& url = ""
 
     if (m_preloads) {
-        ListHashSet<CachedResource*>::iterator end = m_preloads->end();
-        for (ListHashSet<CachedResource*>::iterator it = m_preloads->begin(); it != end; ++it) {
-            CachedResource* resource = *it;
+        for (auto& resource : *m_preloads) {
             if (resource->url() == url)
                 return true;
         }
     }
 
-    Deque<PendingPreload>::const_iterator dequeEnd = m_pendingPreloads.end();
-    for (Deque<PendingPreload>::const_iterator it = m_pendingPreloads.begin(); it != dequeEnd; ++it) {
-        PendingPreload pendingPreload = *it;
+    for (auto& pendingPreload : m_pendingPreloads) {
         if (pendingPreload.m_request.resourceRequest().url() == url)
             return true;
     }
@@ -1097,34 +1090,32 @@
     unsigned stylesheetMisses = 0;
     unsigned images = 0;
     unsigned imageMisses = 0;
-    ListHashSet<CachedResource*>::iterator end = m_preloads.end();
-    for (ListHashSet<CachedResource*>::iterator it = m_preloads.begin(); it != end; ++it) {
-        CachedResource* res = *it;
-        if (res->preloadResult() == CachedResource::PreloadNotReferenced)
-            printf("!! UNREFERENCED PRELOAD %s\n", res->url().latin1().data());
-        else if (res->preloadResult() == CachedResource::PreloadReferencedWhileComplete)
-            printf("HIT COMPLETE PRELOAD %s\n", res->url().latin1().data());
-        else if (res->preloadResult() == CachedResource::PreloadReferencedWhileLoading)
-            printf("HIT LOADING PRELOAD %s\n", res->url().latin1().data());
+    for (auto& resource : m_preloads) {
+        if (resource->preloadResult() == CachedResource::PreloadNotReferenced)
+            printf("!! UNREFERENCED PRELOAD %s\n", resource->url().latin1().data());
+        else if (resource->preloadResult() == CachedResource::PreloadReferencedWhileComplete)
+            printf("HIT COMPLETE PRELOAD %s\n", resource->url().latin1().data());
+        else if (resource->preloadResult() == CachedResource::PreloadReferencedWhileLoading)
+            printf("HIT LOADING PRELOAD %s\n", resource->url().latin1().data());
         
-        if (res->type() == CachedResource::Script) {
+        if (resource->type() == CachedResource::Script) {
             scripts++;
-            if (res->preloadResult() < CachedResource::PreloadReferencedWhileLoading)
+            if (resource->preloadResult() < CachedResource::PreloadReferencedWhileLoading)
                 scriptMisses++;
-        } else if (res->type() == CachedResource::CSSStyleSheet) {
+        } else if (resource->type() == CachedResource::CSSStyleSheet) {
             stylesheets++;
-            if (res->preloadResult() < CachedResource::PreloadReferencedWhileLoading)
+            if (resource->preloadResult() < CachedResource::PreloadReferencedWhileLoading)
                 stylesheetMisses++;
         } else {
             images++;
-            if (res->preloadResult() < CachedResource::PreloadReferencedWhileLoading)
+            if (resource->preloadResult() < CachedResource::PreloadReferencedWhileLoading)
                 imageMisses++;
         }
         
-        if (res->errorOccurred())
-            MemoryCache::singleton().remove(res);
+        if (resource->errorOccurred())
+            MemoryCache::singleton().remove(resource);
         
-        res->decreasePreloadCount();
+        resource->decreasePreloadCount();
     }
     m_preloads = nullptr;
     

Modified: trunk/Source/WebCore/loader/icon/IconDatabase.cpp (190337 => 190338)


--- trunk/Source/WebCore/loader/icon/IconDatabase.cpp	2015-09-30 04:31:18 UTC (rev 190337)
+++ trunk/Source/WebCore/loader/icon/IconDatabase.cpp	2015-09-30 05:53:51 UTC (rev 190338)
@@ -190,11 +190,9 @@
         
         // Clear the IconRecords for every page URL - RefCounting will cause the IconRecords themselves to be deleted
         // We don't delete the actual PageRecords because we have the "retain icon for url" count to keep track of
-        HashMap<String, PageURLRecord*>::iterator iter = m_pageURLToRecordMap.begin();
-        HashMap<String, PageURLRecord*>::iterator end = m_pageURLToRecordMap.end();
-        for (; iter != end; ++iter)
-            (*iter).value->setIconRecord(0);
-            
+        for (auto& pageURL : m_pageURLToRecordMap.values())
+            pageURL->setIconRecord(nullptr);
+
         // Clear the iconURL -> IconRecord map
         m_iconURLToRecordMap.clear();
                     
@@ -585,11 +583,11 @@
         // Start the timer to commit this change - or further delay the timer if it was already started
         scheduleOrDeferSyncTimer();
 
-        for (unsigned i = 0; i < pageURLs.size(); ++i) {
+        for (auto& pageURL : pageURLs) {
             AutodrainedPool pool;
 
-            LOG(IconDatabase, "Dispatching notification that retaining pageURL %s has a new icon", urlForLogging(pageURLs[i]).ascii().data());
-            m_client->didChangeIconForPageURL(pageURLs[i]);
+            LOG(IconDatabase, "Dispatching notification that retaining pageURL %s has a new icon", urlForLogging(pageURL).ascii().data());
+            m_client->didChangeIconForPageURL(pageURL);
         }
     }
 }
@@ -775,13 +773,10 @@
 {
     LockHolder locker(m_urlAndIconLock);
     size_t result = 0;
-    
-    HashMap<String, IconRecord*>::iterator i = m_iconURLToRecordMap.begin();
-    HashMap<String, IconRecord*>::iterator end = m_iconURLToRecordMap.end();
-    
-    for (; i != end; ++i)
-        result += ((*i).value->imageDataStatus() == ImageDataStatusPresent);
-            
+
+    for (auto& iconRecord : m_iconURLToRecordMap.values())
+        result += (iconRecord->imageDataStatus() == ImageDataStatusPresent);
+
     return result;
 }
 
@@ -816,14 +811,12 @@
     // This method should only be called upon completion of the initial url import from the database
     ASSERT(m_iconURLImportComplete);
     LOG(IconDatabase, "Notifying all DocumentLoaders that were waiting on a load decision for their icons");
-    
-    HashSet<RefPtr<DocumentLoader>>::iterator i = m_loadersPendingDecision.begin();
-    HashSet<RefPtr<DocumentLoader>>::iterator end = m_loadersPendingDecision.end();
-    
-    for (; i != end; ++i)
-        if ((*i)->refCount() > 1)
-            (*i)->iconLoadDecisionAvailable();
-            
+        
+    for (auto& loader : m_loadersPendingDecision) {
+        if (loader->refCount() > 1)
+            loader->iconLoadDecisionAvailable();
+    }
+
     m_loadersPendingDecision.clear();
 }
 
@@ -1288,11 +1281,11 @@
 
         performPendingRetainAndReleaseOperations();
 
-        for (unsigned i = 0; i < urls.size(); ++i) {
-            if (!m_retainedPageURLs.contains(urls[i])) {
-                PageURLRecord* record = m_pageURLToRecordMap.get(urls[i]);
+        for (auto& url : urls) {
+            if (!m_retainedPageURLs.contains(url)) {
+                PageURLRecord* record = m_pageURLToRecordMap.get(url);
                 if (record && !databaseCleanupCounter) {
-                    m_pageURLToRecordMap.remove(urls[i]);
+                    m_pageURLToRecordMap.remove(url);
                     IconRecord* iconRecord = record->iconRecord();
                     
                     // If this page is the only remaining retainer of its icon, mark that icon for deletion and don't bother
@@ -1302,7 +1295,7 @@
                         
                         {
                             LockHolder locker(m_pendingReadingLock);
-                            m_pageURLsInterestedInIcons.remove(urls[i]);
+                            m_pageURLsInterestedInIcons.remove(url);
                             m_iconsPendingReading.remove(iconRecord);
                         }
                         {
@@ -1314,18 +1307,18 @@
                     delete record;
                 }
             } else {
-                urlsToNotify.append(urls[i]);
+                urlsToNotify.append(url);
             }
         }
     }
 
     LOG(IconDatabase, "Notifying %lu interested page URLs that their icon URL is known due to the import", static_cast<unsigned long>(urlsToNotify.size()));
     // Now that we don't hold any locks, perform the actual notifications
-    for (unsigned i = 0; i < urlsToNotify.size(); ++i) {
+    for (auto& url : urlsToNotify) {
         AutodrainedPool pool;
 
-        LOG(IconDatabase, "Notifying icon info known for pageURL %s", urlsToNotify[i].ascii().data());
-        dispatchDidImportIconURLForPageURLOnMainThread(urlsToNotify[i]);
+        LOG(IconDatabase, "Notifying icon info known for pageURL %s", url.ascii().data());
+        dispatchDidImportIconURLForPageURLOnMainThread(url);
         if (shouldStopThreadActivity())
             return;
     }
@@ -1465,14 +1458,14 @@
         m_retainOrReleaseIconRequested = false;
     }
 
-    for (HashCountedSet<String>::const_iterator it = toRetain.begin(), end = toRetain.end(); it != end; ++it) {
-        ASSERT(!it->key.impl() || it->key.impl()->hasOneRef());
-        performRetainIconForPageURL(it->key, it->value);
+    for (auto& entry : toRetain) {
+        ASSERT(!entry.key.impl() || entry.key.impl()->hasOneRef());
+        performRetainIconForPageURL(entry.key, entry.value);
     }
 
-    for (HashCountedSet<String>::const_iterator it = toRelease.begin(), end = toRelease.end(); it != end; ++it) {
-        ASSERT(!it->key.impl() || it->key.impl()->hasOneRef());
-        performReleaseIconForPageURL(it->key, it->value);
+    for (auto& entry : toRelease) {
+        ASSERT(!entry.key.impl() || entry.key.impl()->hasOneRef());
+        performReleaseIconForPageURL(entry.key, entry.value);
     }
 }
 
@@ -1528,12 +1521,10 @@
                         outerHash = &(icons[i]->retainingPageURLs());
                     }
                     
-                    HashSet<String>::const_iterator iter = outerHash->begin();
-                    HashSet<String>::const_iterator end = outerHash->end();
-                    for (; iter != end; ++iter) {
-                        if (innerHash->contains(*iter)) {
-                            LOG(IconDatabase, "%s is interested in the icon we just read. Adding it to the notification list and removing it from the interested set", urlForLogging(*iter).ascii().data());
-                            urlsToNotify.add(*iter);
+                    for (auto& outer : *outerHash) {
+                        if (innerHash->contains(outer)) {
+                            LOG(IconDatabase, "%s is interested in the icon we just read. Adding it to the notification list and removing it from the interested set", urlForLogging(outer).ascii().data());
+                            urlsToNotify.add(outer);
                         }
                         
                         // If we ever get to the point were we've seen every url interested in this icon, break early
@@ -1545,10 +1536,8 @@
                     if (urlsToNotify.size() == m_pageURLsInterestedInIcons.size())
                         m_pageURLsInterestedInIcons.clear();
                     else {
-                        iter = urlsToNotify.begin();
-                        end = urlsToNotify.end();
-                        for (; iter != end; ++iter)
-                            m_pageURLsInterestedInIcons.remove(*iter);
+                        for (auto& url : urlsToNotify)
+                            m_pageURLsInterestedInIcons.remove(url);
                     }
                 }
             }
@@ -1612,19 +1601,19 @@
         SQLiteTransaction syncTransaction(m_syncDB);
         syncTransaction.begin();
 
-        for (unsigned i = 0; i < iconSnapshots.size(); ++i) {
-            writeIconSnapshotToSQLDatabase(iconSnapshots[i]);
-            LOG(IconDatabase, "Wrote IconRecord for IconURL %s with timeStamp of %i to the DB", urlForLogging(iconSnapshots[i].iconURL()).ascii().data(), iconSnapshots[i].timestamp());
+        for (auto& snapshot : iconSnapshots) {
+            writeIconSnapshotToSQLDatabase(snapshot);
+            LOG(IconDatabase, "Wrote IconRecord for IconURL %s with timeStamp of %i to the DB", urlForLogging(snapshot.iconURL()).ascii().data(), snapshot.timestamp());
         }
 
-        for (unsigned i = 0; i < pageSnapshots.size(); ++i) {
+        for (auto& snapshot : pageSnapshots) {
             // If the icon URL is empty, this page is meant to be deleted
             // ASSERTs are sanity checks to make sure the mappings exist if they should and don't if they shouldn't
-            if (pageSnapshots[i].iconURL().isEmpty())
-                removePageURLFromSQLDatabase(pageSnapshots[i].pageURL());
+            if (snapshot.iconURL().isEmpty())
+                removePageURLFromSQLDatabase(snapshot.pageURL());
             else
-                setIconURLForPageURLInSQLDatabase(pageSnapshots[i].iconURL(), pageSnapshots[i].pageURL());
-            LOG(IconDatabase, "Committed IconURL for PageURL %s to database", urlForLogging(pageSnapshots[i].pageURL()).ascii().data());
+                setIconURLForPageURLInSQLDatabase(snapshot.iconURL(), snapshot.pageURL());
+            LOG(IconDatabase, "Committed IconURL for PageURL %s to database", urlForLogging(snapshot.pageURL()).ascii().data());
         }
 
         syncTransaction.commit();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to