Title: [197399] trunk/Source/WebCore
- Revision
- 197399
- Author
- [email protected]
- Date
- 2016-03-01 06:29:18 -0800 (Tue, 01 Mar 2016)
Log Message
MemoryCache::forEachResource() should guard resources across function invocation.
<https://webkit.org/b/154846>
Reviewed by Antti Koivisto.
It occurred to me that we should protect the CachedResources from being
deleted while invoking the custom function here, lest we create a giant footgun.
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::forEachResource):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (197398 => 197399)
--- trunk/Source/WebCore/ChangeLog 2016-03-01 11:58:59 UTC (rev 197398)
+++ trunk/Source/WebCore/ChangeLog 2016-03-01 14:29:18 UTC (rev 197399)
@@ -1,3 +1,16 @@
+2016-03-01 Andreas Kling <[email protected]>
+
+ MemoryCache::forEachResource() should guard resources across function invocation.
+ <https://webkit.org/b/154846>
+
+ Reviewed by Antti Koivisto.
+
+ It occurred to me that we should protect the CachedResources from being
+ deleted while invoking the custom function here, lest we create a giant footgun.
+
+ * loader/cache/MemoryCache.cpp:
+ (WebCore::MemoryCache::forEachResource):
+
2016-03-01 Csaba Osztrogonác <[email protected]>
[Mac][cmake] One more unreviewed speculative buildfix after r197375. Just for fun.
Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (197398 => 197399)
--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp 2016-03-01 11:58:59 UTC (rev 197398)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp 2016-03-01 14:29:18 UTC (rev 197399)
@@ -279,8 +279,10 @@
void MemoryCache::forEachResource(const std::function<void(CachedResource&)>& function)
{
- for (auto& lruList : m_allResources) {
- for (auto& resource : *lruList)
+ for (auto& unprotectedLRUList : m_allResources) {
+ Vector<CachedResourceHandle<CachedResource>> lruList;
+ copyToVector(*unprotectedLRUList, lruList);
+ for (auto& resource : lruList)
function(*resource);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes