Title: [290341] trunk/Source/WebCore
- Revision
- 290341
- Author
- [email protected]
- Date
- 2022-02-22 17:26:27 -0800 (Tue, 22 Feb 2022)
Log Message
CachedResourceLoader::allCachedSVGImages() reparses resource URLs unnecessarily
https://bugs.webkit.org/show_bug.cgi?id=237002
Reviewed by Darin Adler.
Store URLs in the HashMaps instead of Strings since we have URLs initially and we
need URLs eventually. This avoids having to re-parse the URL unnecessarily, which
is fairly expensive.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
(WebCore::CachedResourceLoader::determineRevalidationPolicy const):
(WebCore::CachedResourceLoader::notifyFinished):
* loader/cache/CachedResourceLoader.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (290340 => 290341)
--- trunk/Source/WebCore/ChangeLog 2022-02-23 00:44:41 UTC (rev 290340)
+++ trunk/Source/WebCore/ChangeLog 2022-02-23 01:26:27 UTC (rev 290341)
@@ -1,3 +1,20 @@
+2022-02-22 Chris Dumez <[email protected]>
+
+ CachedResourceLoader::allCachedSVGImages() reparses resource URLs unnecessarily
+ https://bugs.webkit.org/show_bug.cgi?id=237002
+
+ Reviewed by Darin Adler.
+
+ Store URLs in the HashMaps instead of Strings since we have URLs initially and we
+ need URLs eventually. This avoids having to re-parse the URL unnecessarily, which
+ is fairly expensive.
+
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestResource):
+ (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
+ (WebCore::CachedResourceLoader::notifyFinished):
+ * loader/cache/CachedResourceLoader.h:
+
2022-02-22 Frédéric Wang <[email protected]>
null ptr deref via WebXRSystem::requestSession
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (290340 => 290341)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2022-02-23 00:44:41 UTC (rev 290340)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2022-02-23 01:26:27 UTC (rev 290341)
@@ -1092,7 +1092,7 @@
}
if (document() && !document()->loadEventFinished() && !resource->resourceRequest().url().protocolIsData())
- m_validatedURLs.add(resource->resourceRequest().url().string());
+ m_validatedURLs.add(resource->resourceRequest().url());
ASSERT(resource->url() == url.string());
m_documentResources.set(resource->url().string(), resource);
@@ -1300,7 +1300,7 @@
}
// During the initial load, avoid loading the same resource multiple times for a single document, even if the cache policies would tell us to.
- if (document() && !document()->loadEventFinished() && m_validatedURLs.contains(existingResource->url().string()))
+ if (document() && !document()->loadEventFinished() && m_validatedURLs.contains(existingResource->url()))
return Use;
// CachePolicy::Reload always reloads
@@ -1509,7 +1509,7 @@
void CachedResourceLoader::notifyFinished(const CachedResource& resource)
{
if (isSVGImageCachedResource(&resource))
- m_cachedSVGImagesURLs.add(resource.url().string());
+ m_cachedSVGImagesURLs.add(resource.url());
}
Vector<Ref<SVGImage>> CachedResourceLoader::allCachedSVGImages() const
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.h (290340 => 290341)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.h 2022-02-23 00:44:41 UTC (rev 290340)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.h 2022-02-23 01:26:27 UTC (rev 290341)
@@ -200,8 +200,8 @@
bool canRequestAfterRedirection(CachedResource::Type, const URL&, const ResourceLoaderOptions&, const URL& preRedirectURL) const;
bool canRequestInContentDispositionAttachmentSandbox(CachedResource::Type, const URL&) const;
- HashSet<String> m_validatedURLs;
- HashSet<String> m_cachedSVGImagesURLs;
+ HashSet<URL> m_validatedURLs;
+ HashSet<URL> m_cachedSVGImagesURLs;
mutable DocumentResourceMap m_documentResources;
WeakPtr<Document> m_document;
DocumentLoader* m_documentLoader;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes