Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1201)

Unified Diff: Source/core/rendering/svg/SVGResourcesCache.cpp

Issue 543803005: Using some C++11 goodness to cleanup the iterator code in SVGResourceCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/SVGResourcesCache.cpp
diff --git a/Source/core/rendering/svg/SVGResourcesCache.cpp b/Source/core/rendering/svg/SVGResourcesCache.cpp
index 8f28c1cd1855f1518d6b6c4d0138d13c2397cd03..20bcdfda34e3ab0124475d50fcc37bb851c3990e 100644
--- a/Source/core/rendering/svg/SVGResourcesCache.cpp
+++ b/Source/core/rendering/svg/SVGResourcesCache.cpp
@@ -60,9 +60,8 @@ void SVGResourcesCache::addResourcesFromRenderObject(RenderObject* object, const
HashSet<RenderSVGResourceContainer*> resourceSet;
resources->buildSetOfResources(resourceSet);
- HashSet<RenderSVGResourceContainer*>::iterator end = resourceSet.end();
- for (HashSet<RenderSVGResourceContainer*>::iterator it = resourceSet.begin(); it != end; ++it)
- (*it)->addClient(object);
+ for (auto* resourceContainer : resourceSet)
+ resourceContainer->addClient(object);
}
void SVGResourcesCache::removeResourcesFromRenderObject(RenderObject* object)
@@ -75,9 +74,8 @@ void SVGResourcesCache::removeResourcesFromRenderObject(RenderObject* object)
HashSet<RenderSVGResourceContainer*> resourceSet;
resources->buildSetOfResources(resourceSet);
- HashSet<RenderSVGResourceContainer*>::iterator end = resourceSet.end();
- for (HashSet<RenderSVGResourceContainer*>::iterator it = resourceSet.begin(); it != end; ++it)
- (*it)->removeClient(object);
+ for (auto* resourceContainer : resourceSet)
+ resourceContainer->removeClient(object);
}
static inline SVGResourcesCache* resourcesCacheFromRenderObject(const RenderObject* renderer)
@@ -184,13 +182,12 @@ void SVGResourcesCache::resourceDestroyed(RenderSVGResourceContainer* resource)
// The resource itself may have clients, that need to be notified.
cache->removeResourcesFromRenderObject(resource);
- CacheMap::iterator end = cache->m_cache.end();
- for (CacheMap::iterator it = cache->m_cache.begin(); it != end; ++it) {
- it->value->resourceDestroyed(resource);
+ for (auto& it : cache->m_cache) {
Nico 2014/09/25 21:23:34 why "it"?
Savago 2014/09/25 21:41:43 The original code used 'it' (I'm assuming for 'ite
+ it.value->resourceDestroyed(resource);
// Mark users of destroyed resources as pending resolution based on the id of the old resource.
Element* resourceElement = resource->element();
- Element* clientElement = toElement(it->key->node());
+ Element* clientElement = toElement(it.key->node());
SVGDocumentExtensions& extensions = clientElement->document().accessSVGExtensions();
extensions.addPendingResource(resourceElement->fastGetAttribute(HTMLNames::idAttr), clientElement);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698